« first day (3410 days earlier)      last day (1593 days later) » 

6:04 AM
@Vaillancourt me too
 
 
5 hours later…
10:52 AM
Hey guys
Anyone alive?
 
Me, somewhat :P
How's it going?
 
Wanted to ask a question. Would you like to listen?
 
hi
yes, ask
 
Do you have experience with box2d and SFML?
 
I don't :/
 
10:57 AM
Well anyway i was told to not use Pixel per something thing
 
well, i have some experience with SDL, but didn't do anything serious with it
 
So working with real coordinates now
But everything is so small. How to set view port in sfml?
 
I'm not sure how its done in sfml :/
 
Box2d uses meters
So i guess if i dont scale meters in pixels its 1pixel per meter.
What do you work with guys?
 
I've done a lot of 2D games in the past, and I always loved working with pixels, as I have perfect control over the screen
But lately I've been using OpenGL (3D)and I still haven't decided how to approach supporting different screen sizes
 
11:02 AM
Can you see your games in action?
Can i ?
 
Do you have android?
 
Nope
Its on playmarket?
 
It's on Google Play :/
 
Let me see
Whats the title?
 
Infinite runner called "Ritle": https://play.google.com/store/apps/details?id=com.darkdimension.ritle_run

Puzzle game called "Blemish": https://play.google.com/store/apps/details?id=com.darkdimension.blemish
I think Blemish is handling screen sizes beautifully, you can rotate your device, minimize and resume the game, or anything you want, and it all works smoothly
I also made a version of "Ritle" for the web: https://darkdimension.itch.io/ritle
But let's say I'm not interested in making more web games :P
 
11:11 AM
Good job! Was it hard to get in on Google play?
 
Not really, at the time I was doing native android development, so publishing to Google Play was easy.
It was a little cumbersome to create some assets that Google Play Store requires (as I'm not really an artist)
 
You get money from that?
 
No :P
these are games I made for fun years ago
I have a new game I plan to sell around holidays, but that's another story
 
11:29 AM
Do you work alone?
 
Yeah, for the most part it works, but making assets and sound effects is a little more time consuming than I would like :P
 
The most time consuming part for me is refactoring
 
To be fair, refactoring never ends :P
 
I'm doing it 99% of the time and not even close to its end
 
This is why I like making smaller projects, and slowly increase their scale
The bigger the project, the more cumbersome the refactoring
 
11:36 AM
If you make a small project and slowly increase its scale, it will become big anyway. I think it's better to make a big project initially!
 
Refactoring what?
 
Code, of course.
 
How can you make big project initially? I cant imagine
 
@trollingchar Yes, but the idea is, if it starts small, you can make it maintainable and scalable, before you start adding more features, so its more flexible
I've tried making a big project initially, that project never made it to the public :P
 
I always try to make something very simple first. Then making it bigger and bigger. Thats how it comes naturally so i dont know how you capable of doing that.
 
11:40 AM
I agree with that, but I guess it depends on the person
 
I started from making prototypes, but they were incompatible with features I wanted to add.
So I decided that I must think before I write code
 
This reminds me a saying I've heard
 
waterfall model is the best
 
While programming, typing on the keyboard is as important as moving a piece in a chess game.
I like agile myself :P
 
I like waterfall because it encourages you to prepare for difficulties that you see, rather than trying to overcome them when it's impossible without doing additional work.
Some things are hidden, but that's another story.
 
11:57 AM
I think it depends on the project
When it comes to a hobby project, i like agile, because I can adapt the project to difficulties I face as I get more experience
I've done waterfall projects in the past, but I get demotivated when my original designs are too hard (for me) to implement
 
When facing unforeseen difficulty, we have no choice other than to adapt the project, this does not depend on what you are using, waterfall or agile
 
Yeah but on waterfall you create different parts of the project, with the "assumption" of how the rest of the project will look like. But if something changes that, then most of the project has to change to adapt to the changes.
On agile, everything is made in an abstract way, as its still unclear how the rest of the project will look like once its all done
 
I prefer to have a plan and understanding of the game architecture when it doesn't even exist yet. Agile just doesn't work for me, I can't make any progress with it because things break when I make a change, and other things break when I fix first things.
 
Well, fair enough, I'm not saying one is better than the other, just that agile works better for me (I've used both to a big extend in the past)
 
12:12 PM
It depends on the developer.
 
Yeah, exactly
 
Do you have any experience with TeX ?
 
No, I don't
 
Ah, it's quite a frustrating language at times (if it counts as a language)
nevermind :P
How's your project going?
 
12:28 PM
I'm refactoring weapons system, the last one remaining.
 
How's the refactored code looking?
 
In other systems it looks good, but here it's not written yet
I want to make an "attack interruption" feature
it's when you press the attack button, a weapon has some frames of startup, and if you're knocked or take damage during this time, your attack is cancelled into a random shot
 
Oh cool! So can players take advantage of that?
Or is it more random?
 
It's just for fun
But do I really need it?
 
Well, if it makes the game more fun, then yeah
 
12:39 PM
It also delays its release
 
You'd know best how to balance that :/
 
 
2 hours later…
2:54 PM
@RundogieRundogie Did you try to set a View to your Window?
 
 
2 hours later…
4:56 PM
@Vaillancourt , yes but the result is still bad.
 
@RundogieRundogie Show us!
 
Okay.thanks for trying to help. Wait!
 
How do you set up your view?
 
Ive never seen anyone working in real world coordinates before. You have something i can look into for further help?
view.setViewPort(sf::FloatRect(0,0,4,4)
Tried different ways as well
 
[Yes, but I do all the scaling manually]9https://github.com/vaillancourt/aStarDirectionHeuristic); I did not know about views when I wrote my project. I did not work with box2d.
How do you create the view and set it to your window?
 
5:12 PM
wind.setView(view)
What is the result im going for?
 
How do you create the view?
 
Why would object look bigger? They are 1px large
sf::View view;
 
What is the size of your world?
Whit is the min and max position (x, y) of your bodies?
 
What do you mean?
 
Your bodies are scattered through your world, yes? They each have a position, what is the minimum and maximum x, and minimum and maximum y for all of those bodies?
 
5:16 PM
I dont know. Its box2d class. b2World.
 
If you don't mind me asking, what do you mean by "real world coordinates" ?
 
hold on
@TomTsagk Using units that are close to MKS. Make a car 4m long and 1.6m wide instead of 32 pixels long and 13 pixels wide.
 
Ah I see
 
By the way its Debug class for box2d im using to render objects.
@Vaillancourt but they still some pixels long and some pixels wide no?
 
float minX = std::numeric_limits<float>::max();
float minY = std::numeric_limits<float>::max();
float maxX = std::numeric_limits<float>::min();
float maxY = std::numeric_limits<float>::min();

for (b2Body *i = world.GetBodyList(); i != 0; i = i->GetNext())
{
  if (i->GetType() == b2_dynamicBody)
  {
    b2Vec2 pos = i->GetPosition();
    minX = std::min( minX, pos.x );
    minY = std::min( minY, pos.y );

    maxX = std::max( maxX, pos.x );
    maxY = std::max( maxY, pos.y );
  }
}


sf::View view(
@RundogieRundogie The sprite will be that size, yes, if you want :)
The dimensions of the sprite will need to match the dimension of the body.
You need to set parameters to the view.
Now this will most likely be stretched because the size ratio of the view will need to match the size ratio of the window. But at least for now this should help you "zoom in" on the bodies of the scene.
@RundogieRundogie I don't know what this means.
 
5:32 PM
With that view i cant see my bodies now.
 
Looks like I inverted the parameters; hold on
// create a view with its center and size
sf::View view(
  sf::Vector2f(minX + (maxX - minX) / 2.0f, minY + (maxY - minY) / 2.0f ),
  sf::Vector2f(maxX - minX, maxY - minY)
  );
 
Still cant see
Sorry
 
Can you provide a minimal chunk of code of what you're doing?
 
Anyway whats the point of all of that? Just to avoid scaling to pixels?
 
Yes and no; the point I see is that if it could "work", you'd only need to focus on your game logic and let the rendering engine manage the scaling for you.
 
5:41 PM
Sorry but what is there to provide? Setting up the view?
Or you mean in general?
 
I'm not sure I understand this question.
 
@Vaillancourt What exactly you want?
 
Ah, well your main loop, including the way you set up the view, how you check the min max values, and how you draw your sprites.
 
Okay , wait. Reminding you that im using custom debug class(SFML API) for rendering.
 
What is that class?
 
5:54 PM
Debug Draw using SFML API
void Game::run()
{

	while (m_window.isOpen())
	{
		sf::Event sfEvent;

		while (m_window.pollEvent(sfEvent))
		{
			if (sfEvent.type == sf::Event::Closed)
			{
				m_window.close();
			}
			if (sfEvent.type == sf::Event::KeyPressed)
			{
				if (sfEvent.key.code == sf::Keyboard::A)
				{
					keyboard(sf::Vector2i(-1, 0));
				}
				if (sfEvent.key.code == sf::Keyboard::D)
				{
					keyboard(sf::Vector2i(1, 0));
				}
				if (sfEvent.key.code == sf::Keyboard::W)
				{
					keyboard(sf::Vector2i(0, -1));
I set up the view in Game constructor. I check min max values in update function. I dont draw sprites.
Debug Class do the drawing.
I think i see the issue.
I need to set Debugger with those coordinates.
 
@RundogieRundogie You need to update the view every frame, what you see will be influenced by where you bodies are; or it needs to be set with the min/max values of the bounding box of your world (in this case, it can be done only once).
I don't know what's in your Debug Class, nor what's in the update method or the draw method
 
6:13 PM
Do you want to analyze debug class?
 
I don't know; I don't know how you're positioning/drawing your sprites, now how you set your world bounding box (if you do), etc...
Do you have your project on github?
 
Debug class that use sfml for box2d yes.
I dont set my world bounding box. I set my windows bounding box.
Debug class does the drawing. Circle shapes, squares etc.
I need to change position of those drawables in debug class i guess.
 
Yeah, ok, how do you call these? What is in your update(m_time) and draw() functions?
 
void Game::update(sf::Time l_delta)
{
	float32 timestep = 1.0f / 60.0f;
	int32 velIter = 6;
	int32 posIter = 2;

	m_world.Step(timestep,velIter,posIter);
	//view
	sf::View view(sf::Vector2f(minX + (maxX - minX) / 2.0f, minY + (maxY - minY) / 2.0f), sf::Vector2f(maxX - minX, maxY - minY));
	m_window.setView(view);

	for (b2Body *i = m_world.GetBodyList(); i != 0; i = i->GetNext())
	{
		if (i->GetType() == b2_dynamicBody)
		{
			b2Vec2 pos = i->GetPosition();
			minX = std::min(minX, pos.x);
			minY = std::min(minY, pos.y);
I guess its better to set my world bounding box position but where?
Need to go deeper into box2d classes?
 
What if you put this code after the for loop?
sf::View view(sf::Vector2f(minX + (maxX - minX) / 2.0f, minY + (maxY - minY) / 2.0f), sf::Vector2f(maxX - minX, maxY - minY));
m_window.setView(view);
Where are those min/max defined?
 
6:28 PM
I dont know yet. But b2World class doesnt have ant gets regarding max min values.
Well sorry it works i forgot to tell
 
Lol, cool :P since when?
 
Long time ago :D
But i d rather set view of my world.
Is that possible?
i want to see the whole picture
 
Now the view only encompasses your bodies, right?
 
yes and since it updates it moves yeah
but i would rather see whole picture .
yes only bodies
 
Ok, well, as you suggested, you'll need to figure out what is the bounding box of the world, fix the view, and make sure your bodies stay within.
If it's a platformer, you'll want to scroll the view, eventually.
 
6:32 PM
wait
but we didnt fix the whole problem.
everything is so small
 
Hmm.
 
Wait
its bigger at a time i spawn first object
then view updates every time i spawn objects and it zooms out further more.
 
Yes, it will make sure that you see all of your objects.
The objects are most likely the size Box2d thinks they are.
(When comparing them with the distances between them all.)
 
The size is fine
i guess then.
 
Is that your first game?
 
6:40 PM
No
 
Ok :)
 
I think i need to change sfml objects position in debugger
 
Aren't they moving?
 
they do but there are glitches
some of them fall throught my wind bound box
through*
then i need to iterate all over physics in debug class?
and set right positions to sfml objects ?
 
The debug class you linked to seems to be there only to draw the shapes.
Do you associate a sprite with each body you create?
 
6:45 PM
yes
 
Each frame you need to update the position of these sprites with the position of the body given by Box2D. Unless there is something that does that for you.
 
its there only to draw shapes yeah. But those shapes need to be position in world coordinates.
 
I would assume that the debug draw does that.
 
Hmm
Okay
are you going to be here?
Im going to try to set world max min values.
 
I'll be here for a couple of hours, then I'll be back only later tonight. And then tomorrow night, and then again the day after that during the evening. Then on Monday I'll be here during the day again :) (That's the most popular Stack Exchange schedule :P)
 
6:52 PM
Okay. Thanks. Do you have any games that you wrote?
 
Oh, not lately, no. I took part in writing a couple of Flash games and NintendoDS games back in the day. I'm no longer a game dev, but I work in a related field (technologically speaking).
 
I see
Sorry
I think im going to stick to pixels per meter.
 
pixels per meter?
 
Just scaling to pixels.
So that patrol car experiment uses real wold coords?
 
7:07 PM
I think it does. Looking at the values in the Simulation.cpp file, it would match real world values.
The world being 1.6km wide, streets being at 200m intervals and such..
 
It seems like i have to use real world coords.
Box2D works with floating point numbers and tolerances have to be used to make Box2D perform well.
These tolerances have been tuned to work well with meters-kilogram-second (MKS) units. In particular,
Box2D has been tuned to work well with moving shapes between 0.1 and 10 meters. So this means
objects between soup cans and buses in size should work well. Static shapes may be up to 50 meters
long without trouble.
Being a 2D physics engine, it is tempting to use pixels as your units. Unfortunately this will lead to a poor
?
 
I would strongly suggest you use real world values. It's much easier to tune your physics behaviour with that.
Now for the display and scaling, you're free to do it manually or with the sf::View :P
 
So the caution is just saying to not use pixels when you set physic bodies? Like to not do the next. shape.SetAsBox(200,200) ?
 
Yes, that's exactly that :)
 
Well i think im being too much cautious then :D
 
7:15 PM
Why?
 
So much time wasted (
i thought i have to set up view with real coords.
 
Well the view would need to match what you want to show of your game world.
 
Yes sure thing.
Okay thanks for the help. Im going to go straight to coding the game. Have a good day )
 
If you make a platformer that is 60 meters high in total, 1000m long, you will not show all of this, you'll need to decide what kind of "view" you want to see around the main character. If the character can go up and down a bit, you'll want to show something like 30m, allowing to go up or down 15m, so you'd need to set the view "y size" 30; then you'd need to set the "x size" to match the aspect ratio of your window.
Good luck :)
 
 
1 hour later…
8:31 PM
People go on vacation, apparently.
 

« first day (3410 days earlier)      last day (1593 days later) »