I'm wanting to create a game engine from scratch. I've not got much expeirence in any programming language. But at the moment i have started learning java. Can anyone point me in the correct direction? Once my game engine is complete i want to create a game like Grand theft auto Crossed with smackdown vs raw 2010 Serious answers only please.
create a game engine from scratch
Game Making SupportAt Uni we did it from a SAMS book - called something like "how to make a game engine in 24 hours". It was quite useful. What we learned could be applied to any language I guess. There must be tutorials online from googling, I'm not sure.
Basically though the main things you'll want to learn are a graphics library, finite state machines, and basically just how to make a game loop. I'm not sure I'm the one to teach that, there must be better tutorials on that on Google. OpenGL is the graphics library we used and there are many tutorials for it.
But if that's too vague or you need any help don't take ^ for an answer.
Basically though the main things you'll want to learn are a graphics library, finite state machines, and basically just how to make a game loop. I'm not sure I'm the one to teach that, there must be better tutorials on that on Google. OpenGL is the graphics library we used and there are many tutorials for it.
But if that's too vague or you need any help don't take ^ for an answer.
My suggestion:
Start with a simple loop. Something like:
You say from scratch, but I do strongly suggest using libraries. For my C++ projects, I'm using:
Allegro - for all around cross platform help-y stuff (windows, input, basic sound, etc). It has drawing capabilities, but if you want 3d, they suck. learn opengl and roll your own. I suggest learning Allegro5, and using the addon modules for things like Fonts.
Audiere - if you need more advanced sound stuff.
Some kind of database - even if you end up just using your own flatfile format, you'll need a way to load/save/manipulate data. (For a project I'm on at the moment, I'm using SQLite.)
Anyway, once you have your loop and you're all "linked" up, you'll want to get a better workflow in place. The above example might come to resemble something like this:
Once you have that, you'll want to get state management in place. I use a parent class with subclasses, but there are countless ways to implement states. I'll offer one hint: states don't have to be a single variable. Google, and consider, a "state stack", as for some game types that makes certain things significantly easier.
Once you get state management, from there on its all about your engine. Improve or replace those functions, and continue to add and improve and replace and cull the crap until its nice and shiny.
And then, at long, long last, that awaited day, when the actual work can begin.
Edit: the snippets arent real code. hell they aren't even good examples.
but they do summarize the concept I was trying to get across.
Start with a simple loop. Something like:
- while(running){
- ///holy game stuff batman
- }
- exit();
Expand to see the code.
You say from scratch, but I do strongly suggest using libraries. For my C++ projects, I'm using:
Allegro - for all around cross platform help-y stuff (windows, input, basic sound, etc). It has drawing capabilities, but if you want 3d, they suck. learn opengl and roll your own. I suggest learning Allegro5, and using the addon modules for things like Fonts.
Audiere - if you need more advanced sound stuff.
Some kind of database - even if you end up just using your own flatfile format, you'll need a way to load/save/manipulate data. (For a project I'm on at the moment, I'm using SQLite.)
Anyway, once you have your loop and you're all "linked" up, you'll want to get a better workflow in place. The above example might come to resemble something like this:
- class Main(){
- running = true;
- void run(){
- createWindow();
- setupGL();
- initGameStuff(); //running = true happens in here :D
- while(running){
- input.update();
- game.update(); //running = false would happen in here once its time to stop.
- game.render();
- }
- unloadGLStuff();
- destroyWindow();
- }
- }
Expand to see the code.
Once you have that, you'll want to get state management in place. I use a parent class with subclasses, but there are countless ways to implement states. I'll offer one hint: states don't have to be a single variable. Google, and consider, a "state stack", as for some game types that makes certain things significantly easier.
Once you get state management, from there on its all about your engine. Improve or replace those functions, and continue to add and improve and replace and cull the crap until its nice and shiny.
And then, at long, long last, that awaited day, when the actual work can begin.
Edit: the snippets arent real code. hell they aren't even good examples.
but they do summarize the concept I was trying to get across.
Original thread: https://www.hbgames.org/forums/viewtopic.php?t=77704