Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

create a game engine from scratch

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.
 
At 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.
 
My suggestion:
Start with a simple loop. Something like:

Code:
while(running){

   ///holy game stuff batman

}

exit();

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:

Code:
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();

   }

}

 
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.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top