My first steps in game programming

Discuss/post fan stuff (images, fictions, games...)

My first steps in game programming

Postby BenoitRen » Sun May 04, 2008 10:10 pm

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.
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3122
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Postby Nameless » Sun May 04, 2008 11:43 pm

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.
"When We Start Killing , Its All Coming Down Right NOW..." - Within Temptaion - The Howling
User avatar
Nameless
Locusta
Locusta
 
Posts: 37
Joined: Sun Apr 13, 2008 12:45 am

Postby BenoitRen » Wed May 07, 2008 9:26 pm

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.
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3122
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Postby meteor9 » Fri May 09, 2008 11:31 am

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!
meteor9
Blastoid
Blastoid
 
Posts: 194
Joined: Thu Sep 20, 2007 1:58 am
Location: New South Wales

Postby BenoitRen » Fri May 09, 2008 5:07 pm

Be nice to Chaz. :(

Glad it amused someone. :)
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3122
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Postby BenoitRen » Tue Jan 06, 2009 5:46 pm

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.
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3122
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Postby Zucca » Tue Jan 06, 2009 6:58 pm

SDL <3
Nothing else to say.
I am NaN!
User avatar
Zucca
Neifirst
Neifirst
 
Posts: 1916
Joined: Sun Sep 23, 2007 7:06 pm
Location: Rasi, Kouvola, Finland

Postby BenoitRen » Tue Jan 06, 2009 11:01 pm

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.
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3122
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Postby Dr_Odin » Thu Jan 15, 2009 3:24 am

wanna know what fan game you had in mind of making? and if you ever will make one, then please finish it! :wink: :P
User avatar
Dr_Odin
Blastoid
Blastoid
 
Posts: 120
Joined: Wed Feb 13, 2008 11:45 pm

Postby BenoitRen » Thu Jan 15, 2009 7:35 pm

That's a surprise. Some people that know me already do, though. And even if takes a couple years, I will finish it!
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3122
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Postby HTD » Sun Feb 22, 2009 4:36 am

Id be more than willing to help with Character Graphics and such things.
Let me know
User avatar
HTD
Blastoid
Blastoid
 
Posts: 142
Joined: Wed Oct 24, 2007 2:50 pm

Postby Zucca » Sun Feb 22, 2009 9:06 pm

Ben, you might need a tool like this. ;)
I am NaN!
User avatar
Zucca
Neifirst
Neifirst
 
Posts: 1916
Joined: Sun Sep 23, 2007 7:06 pm
Location: Rasi, Kouvola, Finland

Postby BenoitRen » Mon Mar 09, 2009 12:18 am

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.
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3122
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Postby BenoitRen » Sat Apr 25, 2009 10:13 pm

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).
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3122
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Postby Zucca » Sun Apr 26, 2009 7:26 am

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?
I am NaN!
User avatar
Zucca
Neifirst
Neifirst
 
Posts: 1916
Joined: Sun Sep 23, 2007 7:06 pm
Location: Rasi, Kouvola, Finland

Next

Return to Fan stuff

Who is online

Users browsing this forum: No registered users and 25 guests