Page 1 of 3

My first steps in game programming

PostPosted: Sun May 04, 2008 10:10 pm
by BenoitRen
The past couple of days I've been spending some time reading the tutorials at lazyfoo.net to get started on game programming using libSDL. Here are my first steps: Chaz walking (for Windows, SDL.DLL included)!

Tomorrow I'll work on motion and animation not being tied to the frame rate, which is currently 20 FPS. :)

And yes, I do plan on making a fan game sometime down the road.

PostPosted: Sun May 04, 2008 11:43 pm
by Nameless
thank you , i was learnin to program but eventually gave up.
now you have helped inspire me to learn. again.
THIS COMMUNITY IS AWESOME.
and nice job with the program so far.

PostPosted: Wed May 07, 2008 9:26 pm
by BenoitRen
Motion and animation no longer depend on the frame rate. The code to have animation at its own pace is entirely my own, too! :D

Newest version uploaded. Same link.

PostPosted: Fri May 09, 2008 11:31 am
by meteor9
Heh heh, I can make him moonwalk.

Although I'm not entirely certain that Chaz has enough coordination to actually do that maneuver. I'll have to assume he's been replaced with a robot of some kind.

Still, that was way too amusing for some reason. Moonwalking! Woo!

PostPosted: Fri May 09, 2008 5:07 pm
by BenoitRen
Be nice to Chaz. :(

Glad it amused someone. :)

PostPosted: Tue Jan 06, 2009 5:46 pm
by BenoitRen
I didn't realise it's been so long since I started doing this. I've been working on it every once in a while since, refactoring code, and adding a title screen of sorts, but nothing new.

The past couple of months have changed that! Mieu is now the character you control, and there's a Chaz NPC in there that walks on its own! He's a prototype for the town NPCs that walk every once in a while.

It's not perfect, as sometimes you can walk through him. I suspect it's because of my collision detection. This will be fixed later.

Download mieu.zip.

PostPosted: Tue Jan 06, 2009 6:58 pm
by Zucca
SDL <3
Nothing else to say.

PostPosted: Tue Jan 06, 2009 11:01 pm
by BenoitRen
I worked some more on the code. Chaz now walks irregularly instead of all the time.

Also, after toying with the executable some more while debugging mentioned code, I noticed a pattern in the collision detection working. It turned out that it was a bug in the code where I try to detect if the given bounding box is the same as the one I'm testing against.

This was done by checking the x and y coordinates of the box. But if I align Mieu on the same x coordinate as Chaz, the movement she makes before colliding with Chaz vertically lands her on the same y coordinate, making my code think I'm trying to test against the same box, and not testing it, with the final result being that no collision was detected.

I fixed this by using pointers to the bounding boxes everywhere instead of passing along the entire struct. Those I can reliably compare, and it saves memory to boot.

PostPosted: Thu Jan 15, 2009 3:24 am
by Dr_Odin
wanna know what fan game you had in mind of making? and if you ever will make one, then please finish it! :wink: :P

PostPosted: Thu Jan 15, 2009 7:35 pm
by BenoitRen
That's a surprise. Some people that know me already do, though. And even if takes a couple years, I will finish it!

PostPosted: Sun Feb 22, 2009 4:36 am
by HTD
Id be more than willing to help with Character Graphics and such things.
Let me know

PostPosted: Sun Feb 22, 2009 9:06 pm
by Zucca
Ben, you might need a tool like this. ;)

PostPosted: Mon Mar 09, 2009 12:18 am
by BenoitRen
I haven't programmed in a month, as I was focused on finishing all the pending web development work. I had time the last couple of days, but couldn't picture in my head how to program talking to an NPC.

So, I sat down with pen and paper, and thought about it while making a sort of schema. Then I programmed it. The basis is there! You can't walk while talking, and the NPC won't walk either. You can still change the direction you face, though. I'll fix that tomorrow with a partial rewrite, because I have sinned against the game loop by including logic in my input handling method, which makes fixing this non-trivial.

PostPosted: Sat Apr 25, 2009 10:13 pm
by BenoitRen
Since the last post I have done a number of improvements to my code.
  • Implemented a binary rendering tree for rendering priority based on the Y coordinate.
  • Created a class to manage the game's state
  • Implemented a rough event system for the town, in which I placed the "talk to NPC" event.
  • Generalised my map class so it isn't bound to the map data file I'm currently using.
  • Implemented a quadtree to dramatically speed up collision testing with map tiles.

Also, I've implemented a caterpillar party! Just two characters at the moment.

Download mieu.zip (Windows).

PostPosted: Sun Apr 26, 2009 7:26 am
by Zucca
Really nice design so far.
Few things I noticed:
- I got stuck on Rika (Rika walked to the sma spot at the same time I walked on it?). Also Chaz stopped moving. Froze?
- Mieu doesn't follow Rhys very precicely when changing direction rapidly... (bigger movement squares?)
- I couldn't talk to NPCs... Pressing enter or space didn't do anything...


On windows how can I follow the changes of stdout and stderr (program seems to create those files)? I guess you directed all the errors to stderr?