Structure of a Game Engine?

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
Lord Pingas
Chaos Rift Regular
Chaos Rift Regular
Posts: 178
Joined: Thu Dec 31, 2009 9:33 am
Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
Programming Language of Choice: C++
Location: Hiding In My Mum's Basement With My Pokemon Cards

Structure of a Game Engine?

Post by Lord Pingas »

Hi, I want to get to work on a basic SDL engine that can be used to make small 2d games.

How would I go about the structure of a game engine?

And how would I seperate the engine from the actual game? External .txt files?

Can someone please show me the light?

How would I organise my files and classes, as a matter of fact, what classes would I use?

Thanks!
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Structure of a Game Engine?

Post by GroundUpEngine »

Have a skim through this topic, gotta run hope it helps ;)
http://thechaosrift.com/viewtopic.php?f ... e29#p53934
User avatar
Lord Pingas
Chaos Rift Regular
Chaos Rift Regular
Posts: 178
Joined: Thu Dec 31, 2009 9:33 am
Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
Programming Language of Choice: C++
Location: Hiding In My Mum's Basement With My Pokemon Cards

Re: Structure of a Game Engine?

Post by Lord Pingas »

I had a look at the thread and I came up with this:

I will have a general cCore or cSystem class that has the five functions that get called in main (onInit, onRun, onInput, onUpdate and onCleanup).

With it there will be other classes such as cCharacter and cNPC in a seperate game folder that will inherit from a cSprite, cSpritesheet class from the engine so that it can render the Player and NPC and such.

Sounds good?

What are all the things I would need in the engine?
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Structure of a Game Engine?

Post by eatcomics »

kittens definitely need kittens... And uh turtles too if its not too much of a bother :D but seriously it depends on what you want the engine for. Broad do anything engine? a puzzle game engine. I see you say you want a 2D game engine. That's kinda broad, so it would have to be pretty generic and extensible. I'd say what you've got planned out here is a good start. But you'll probably want to look at some sort of scripting language possibly. Also you'll need Different object/entity classes. Collision. Tiles. And all that good stuff. All this will get you a good start if not on your way to being able to make an actual game
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Structure of a Game Engine?

Post by dandymcgee »

Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Structure of a Game Engine?

Post by GroundUpEngine »

dandymcgee wrote:Write games, not engines.
Nobody is denying that, but on a side note engines are the future ;)
User avatar
WSPSNIPER
Chaos Rift Regular
Chaos Rift Regular
Posts: 145
Joined: Sun Jan 03, 2010 6:19 pm
Current Project: top down shooter
Favorite Gaming Platforms: ps3
Programming Language of Choice: c++

Re: Structure of a Game Engine?

Post by WSPSNIPER »

GroundUpEngine wrote:
dandymcgee wrote:Write games, not engines.
Nobody is denying that, but on a side note engines are the future ;)
agree engines are the future because people want to do as little work in as little time as possiable to save money so they will use an engine to help them out... most companys dont want to pay someone to develop the engine from ground up so they will find an engine that is already made and buy it for less then it would cost to pay developers and cut off a lot of development time
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Structure of a Game Engine?

Post by Falco Girgis »

...you might really like AiGD17 then...
User avatar
hurstshifter
ES Beta Backer
ES Beta Backer
Posts: 713
Joined: Mon Jun 08, 2009 8:33 pm
Favorite Gaming Platforms: SNES
Programming Language of Choice: C/++
Location: Boston, MA
Contact:

Re: Structure of a Game Engine?

Post by hurstshifter »

GyroVorbis wrote:...you might really like AiGD17 then...
:shock:
"Time is an illusion. Lunchtime, doubly so."
http://www.thenerdnight.com
User avatar
ismetteren
Chaos Rift Junior
Chaos Rift Junior
Posts: 276
Joined: Mon Jul 21, 2008 4:13 pm

Re: Structure of a Game Engine?

Post by ismetteren »

GyroVorbis wrote:...you might really like AiGD17 then...
I guess that means you are goong to talk about the structure of the engine. I've always wanted to get an idea of how you did it. Now i can't wait even less ;)
Image ImageImage Image
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Structure of a Game Engine?

Post by XianForce »

GyroVorbis wrote:...you might really like AiGD17 then...
*GASP*
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Structure of a Game Engine?

Post by GroundUpEngine »

GyroVorbis wrote:...you might really like AiGD17 then...
well then...
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Structure of a Game Engine?

Post by dandymcgee »

GroundUpEngine wrote:
dandymcgee wrote:Write games, not engines.
Nobody is denying that, but on a side note engines are the future ;)
That's good and all, but for a newbie chances are your portfolio will look a lot more enticing with a working game than a working engine using the same ideas used by games in the early 90's. That's the point I was trying to make at least. There's absolutely nothing wrong with doing it for the experience, to the contrary I would highly recommend it. In the end, we all know anything is better than nothing. ;)
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: Structure of a Game Engine?

Post by RyanPridgeon »

GyroVorbis wrote:...you might really like AiGD17 then...
WIN!
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Structure of a Game Engine?

Post by GroundUpEngine »

dandymcgee wrote:
GroundUpEngine wrote:
dandymcgee wrote:Write games, not engines.
Nobody is denying that, but on a side note engines are the future ;)
That's good and all, but for a newbie chances are your portfolio will look a lot more enticing with a working game than a working engine using the same ideas used by games in the early 90's. That's the point I was trying to make at least. There's absolutely nothing wrong with doing it for the experience, to the contrary I would highly recommend it. In the end, we all know anything is better than nothing. ;)
Fair point. A good example of clever engine creation is Falco +team because originally the game started to evolved around the engine but more recently the engine evolves around the game, that way everything specifically planned for ES in the beginning can now be achieved and finally determine how ES engine is made. Casing point this focuses on writing the game 8-)
dandymcgee wrote:than a working engine using the same ideas used by games in the early 90's.
This is kinda true, but I would say that's a little exaggerated. Engine programmers these days try to be creative or even innovative with thier ideas and implementations, e.g. looking at current/future hardware and seeing how it can be taken advantage of.
Post Reply