Jump to content

  • Log In with Google      Sign In   
  • Create Account

Creating a 2D engine from scratch...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Riyoha   Members   -  Reputation: 102

Like
0Likes
Like

Posted 28 August 2011 - 06:26 PM

I'm currently studying a Game Development course, but I wanna try some stuff on my own....I still haven't got to 3D yet, so I was thinking, why not try making a simple 2D game

Thing is, I know (at least I'd say) enough C++ to get it done, but I don't know where to start....

C++ I know is all the basics (variables, classes, functions, memory management, new, delete, pointers, virtual etc.), but taking what I know and turning that into a game.....s'kinda daunting, I mean, I've programmed a little to practice the stuff, but it hasn't been "complete" things, more, sections of things....as part of the course, I have seen a little of a 2D engine, but I want to make my own (more for the experience than anything)

I know more or less what sort of game I want to make....it'll be single player for now (although I would like to add an online multiplayer component at some point, not MMO, just two/three other players in a game....if it's not super difficult/pointless, maybe a basic lobby with chat).....it'll be kinda like Monster Hunter for those who know it, only much, much simpler (at least to start ^_^) and 2D.....I'd like to make it so adding stuff in is relatively easy (eg, if I want to add a new enemy I don't want to have to remake the game from the ground up)

Mainly, what I'm wondering is....where to start? (any good tutorials are welcome too ^^_)

Sponsor:

#2 ViperG   Members   -  Reputation: 206

Like
1Likes
Like

Posted 28 August 2011 - 07:14 PM

I'm actually doing it right now, I went the whole 2D from scratch. It definitely is way more work and takes way more time than I thought. 2nd go round I really would like to just use an already existing engine.

But I am learning... ALOT.... very time consuming.

Anyways, If you are totally new to this, I would start with http://nehe.gamedev.net if you want to go the opengl route.

Some people might reply his code is old and outdated, but you can still learn from it. Unfortunately, I don't know of any other active sites that has tutorials as in depth as nehe.

http://www.gametutorials.com used to be free, now you have to pay for it.

Black Sky A Star Control 2/Elite like game

#3 jbadams   Senior Staff   -  Reputation: 18619

Like
0Likes
Like

Posted 29 August 2011 - 01:03 AM

Start with the basics, and build from there:
  • Set up a window (and get it running full-screen if you're planning to do that).
    • You'll need to choose a windowing API -- depending on your choice it may also provide your rendering functionality and even other things such as input handling. Common choices for people using C++ include SFML or SDL (you could use Lazy Foo's Tutorials for SDL). You could also choose to do the lower-level work yourself using DirectX or OpenGL. Note that whatever choice you make you'll need to learn how to work with libraries, which is an important skill.
  • Display an image in your window.
    • For this you would either use the drawing functionality provided by the API you chose above, or if you chose an API that only sets up a Window you would now choose a graphics API as well. SFML and SDL both provide easy-to-use functions for loading and displaying images -- if you're working directly with OpenGL or DirectX you'll have a little more work to do but should still be able to get this working relatively quickly.
  • Figure out how to get your image to move around in response to user input.
    • Again, you'll either be using functionality provided by your initial API choice, or you'll need to choose an input library. Start with a single keyboard button or mouse-click as input, and build from there -- you should spend a little time at this point learning how to respond to multiple key-presses, responding to mouse-movement and clicks, etc.
  • Add a second image, and set up some basic collision detection such that your original image can not move through the new one.
  • You should now be at the point where you could assemble the bits and pieces you've built into a basic game such as Pong or BreakOut by adding additional objects and applying some game specific logic (in Pong for example, you would need to implement a bouncing ball). This is the stage where you can start fleshing out the type of game you want to make -- you might want to turn your original image into a character for a side-scroller who jumps and falls back down, or you might want to turn it into an overhead space-ship dodging asteroids.

Hope that helps! Posted Image

#4 Riyoha   Members   -  Reputation: 102

Like
0Likes
Like

Posted 29 August 2011 - 04:28 PM

Thanks, that does help ^_^

All of the replies so far help actually! Although the course I'm doing shows me DirectX I'll still check out that Nehe tutorial, and JBAdams, thanks so much for breaking it down like that...it makes a lot more sense to me now ^_^




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS