Sign in to follow this  
IkazrimaZainalAlam

2d platformer engine

Recommended Posts

Greetings fellow members..

I've recently started to take interest in game dev using XNA. So far I've already get the hang of it, the tutorials around the net has been most wonderful..
I'm interested in making my own 2d platformer/side-scroller engine, in an attempt to create an engine akin to Sonic the hedgehog of the genesis era..
I however need some advice before starting, if you guys would be most kindly to give any..

1) Should I worry about handling the animation first, or the engine physics/advance collision detection?
By animation I mean handling sprite sheets and stuff..
I'm kinda confused because some of the tutorials I followed starts with the animation first or just get into the game's logic and use temporary static sprites first..

2) I'm really not good at calculus :(, but I managed to get A's in programming during my uni days..:P
Will this be a problem? Because I'm aware that to implement a 'good' collision with gravities and stuff, it's going to involve calculus..or am I wrong?
So far I've managed to get through just by using (VERY) basic pixel based collision.

Any other advice that you guys can provide is going to be greatly appreciated.

Sorry if my grammar was off, english ain't my native language.

Thanks for reading and replying (I hope you did :D).

Share this post


Link to post
Share on other sites
[quote name='Ikazrima' timestamp='1306516064' post='4816490']
1) Should I worry about handling the animation first, or the engine physics/advance collision detection?
[/quote]
you could handle them completely separately. Have one gameplay thread and one rendering/animation thread. You can go further with this, but the order isn't that important as long as you design all of your pieces to be aware of the order they come in and you are aware of the expected results. I'd usually put gameplay before animation though.

It shouldn't really matter, because in the end your order will look like this:
-gameplay
-animation
-gameplay
-etc
-animation
-gameplay
-animation

[quote]2) I'm really not good at calculus :(, but I managed to get A's in programming during my uni days..:P
[/quote]
It might help you get better at calc because now you can apply it to something and get practice from that. Don't let it discourage you until you run into something discouraging.

Share this post


Link to post
Share on other sites
If your animation is visual only (sprite change), it don't matter. If it's vectorial and gonna apply on your physics, it's important. I also suggest you use a free physic engine instead of coding your own, or it will takes years until you have something working.

Share this post


Link to post
Share on other sites
[quote name='Dunge' timestamp='1306521034' post='4816511']
I also suggest you use a free physic engine instead of coding your own, or it will takes years until you have something working.
[/quote]

You can do a simple physics engine in just a couple days. Coding your own depends a lot on the goals you have for the game. If you are making it to learn, making your own physics is a great idea. Otherwise I would recommend similarly.

Share this post


Link to post
Share on other sites
[quote name='way2lazy2care' timestamp='1306518410' post='4816499']
[quote name='Ikazrima' timestamp='1306516064' post='4816490']
1) Should I worry about handling the animation first, or the engine physics/advance collision detection?
[/quote]
you could handle them completely separately. Have one gameplay thread and one rendering/animation thread. You can go further with this, but the order isn't that important as long as you design all of your pieces to be aware of the order they come in and you are aware of the expected results. I'd usually put gameplay before animation though.

It shouldn't really matter, because in the end your order will look like this:
-gameplay
-animation
-gameplay
-etc
-animation
-gameplay
-animation

[quote]2) I'm really not good at calculus :(, but I managed to get A's in programming during my uni days..:P
[/quote]
It might help you get better at calc because now you can apply it to something and get practice from that. Don't let it discourage you until you run into something discouraging.
[/quote]

Yeah, I figure that gameplay should comes first before animation..
otherwise it's going to be like most games from this generation, amazing eye candy but barebones gameplay.. lol
Heheh, I'm going to relearn calc for the sake of what I'm doing now :)

[quote name='Dunge' timestamp='1306521034' post='4816511']
If your animation is visual only (sprite change), it don't matter. If it's vectorial and gonna apply on your physics, it's important. I also suggest you use a free physic engine instead of coding your own, or it will takes years until you have something working.
[/quote]

It's visual only, by no means it affect physics..
About the free physics engine, could you name a few? I've heard of unity and I know it supports 2d games, but how about the learning curve?
What language does it use? I only have basic c++ knowledge, and none about it graphically..only windows console..
And I don't really mind if it's going to take some time provided there's an extensive beginner tutorial that touch on most of the things..
part of the learning experience I guess, and I'm in no rush :)

thanks for the replies..

Share this post


Link to post
Share on other sites
[quote name='way2lazy2care' timestamp='1306523240' post='4816531']
[quote name='Dunge' timestamp='1306521034' post='4816511']
I also suggest you use a free physic engine instead of coding your own, or it will takes years until you have something working.
[/quote]

You can do a simple physics engine in just a couple days. Coding your own depends a lot on the goals you have for the game. If you are making it to learn, making your own physics is a great idea. Otherwise I would recommend similarly.
[/quote]

Sorry for double post, it must have been that you posted when I was writing a reply..
I'm making it to learn, and I enjoy making something from scratch :)

Hmm,, the only thing that I 'think' is going to take sometime doing is calculating frictions and slopes..that's what worries me actually since i'm BAD at calc, lol

Share this post


Link to post
Share on other sites
[quote name='Ikazrima' timestamp='1306523352' post='4816532']
About the free physics engine, could you name a few? I've heard of unity and I know it supports 2d games, but how about the learning curve?
What language does it use? I only have basic c++ knowledge, and none about it graphically..only windows console..
And I don't really mind if it's going to take some time provided there's an extensive beginner tutorial that touch on most of the things..
[/quote]

Unity does not support 2d games. It supports 3D games that happen on a plane, which is how people make '2D' games in it. They are supposed to be working on an actual 2D engine though. It has a lot of language options for you to program in. Most scripting languages I think are usable as well as C#.

You can do a quick google search for open source physics engines or 2D physics and you should be able to find a bunch of resources on 2D physics/engines.

Share this post


Link to post
Share on other sites
[quote name='way2lazy2care' timestamp='1306524907' post='4816545']
Unity does not support 2d games. It supports 3D games that happen on a plane, which is how people make '2D' games in it. They are supposed to be working on an actual 2D engine though. It has a lot of language options for you to program in. Most scripting languages I think are usable as well as C#.

You can do a quick google search for open source physics engines or 2D physics and you should be able to find a bunch of resources on 2D physics/engines.
[/quote]

Emm I already have a physics guide to follow, mercury physics guide over at sonic retro..
I guess I won't be touching unity for awhile then, since I'm more interested in 2d right now..
And thinking back, I'm not sure about using available engines as of now..
I might get confused with other people coding,, and I'm not sure to how much the extend that I can modify them to my liking..

Share this post


Link to post
Share on other sites
[quote name='Ikazrima' timestamp='1306523352' post='4816532']
About the free physics engine, could you name a few? I've heard of unity and I know it supports 2d games, but how about the learning curve?
[/quote]

2D physic engines would be thing like Box2D, Chipmunk, or PhysX/Havok limited to one plane. Unity is not a physic library, it's a whole game engine. A game engine contain multiple components; OS integration, asset pipeline (loading/saving/editing models/textures/levels/etc), a rendering engine (sdl, sfml, opengl, directx, etc), sound engine (directsound, openal, etc), AI, utilities functions, of course the physic engine, and much much more.

[quote name='Ikazrima' timestamp='1306523352' post='4816532']
What language does it use? I only have basic c++ knowledge, and none about it graphically..only windows console..
[/quote]

I believe Unity is C++, but most of the libraries I mentioned above can be used with a lot of different language. You know the C++ language (in console), but you probably don't know how to use any library. If your plan really is to make a C++ game engine from scratch, it won't be easy to do everything. A 2d platformer is a massive goal, not an easy one. Your exact situation has been answered thousands of times over on this forum already, and I believe there's even something about it in the forum FAQ.

edit: Sorry I just realized you are meant to use XNA and were talking about your c++ knowledge just because of unity. Most of what I said still apply, but XNA already contain much components you need and will make your life much easier.

Share this post


Link to post
Share on other sites
[quote name='Dunge' timestamp='1306535114' post='4816592']
I believe Unity is C++, but most of the libraries I mentioned above can be used with a lot of different language. You know the C++ language (in console), but you probably don't know how to use any library. If your plan really is to make a C++ game engine from scratch, it won't be easy to do everything. A 2d platformer is a massive goal, not an easy one. Your exact situation has been answered thousands of times over on this forum already, and I believe there's even something about it in the forum FAQ.
[/quote]

Well I guess I left out one important part, it's that I'm coding in C# not C++.. I've tried to program a c++ window application before so I know the horror, that's why I chose c# and XNA since it has already simplified image/sound/etc processing. I know it may seem like a far fetch for me to do so, but I'm willing to take my time as this is just a hobby of mine ;)

I think as of now, I'll just make a simple platformer that only involves gravity pull (no momentum, frictions, stuff...) and I'll implement more features as I go..though I don't know how many years it may take me :)

edit : just realized that you edited yours. lol

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this