Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Programming - A Game Engine  (Read 711 times)

stuntaneous

  • Bay Watcher
  • [PREFSTRING:ungodly beard of awesome]
    • View Profile
Programming - A Game Engine
« on: December 18, 2010, 10:00:48 am »

Where does a game engine end and a specific game begin? I find myself attempting a lot of similar projects and repeating a lot of the low level, mundane tasks. I assume this means I should be making a nice, independent engine that suits my needs to streamline the process. Should I be considering making one? I'm assuming I should be but then I'm not sure how to design one. As I started out, I'm not sure what is exclusively a part of the engine and what isn't.

Any reading material on the topic would be appreciated. Any questions I should be asking myself can't hurt either. As you can tell, I don't particularly know what I'm after :D Just hoping to attract some helpful information.
Logged

olemars

  • Bay Watcher
    • View Profile
Re: Programming - A Game Engine
« Reply #1 on: December 21, 2010, 04:15:49 am »

When someone says "I'm making a game engine" it's usually a bad sign. There are enough noble projects like that around to fill several large virtual graveyeards. Most successful "game engines" began life as games proper, or had utilization in a specific game as the end goal. The trick as I see it is to make the game first, something that works and is useful, then pull out the bits that could be useful later on and call it an engine.

In your case, look at your previous projects, identify the low level, mundane tasks you repeat, extract that code and stuff it in a library, refactoring as needed. Use that library in your new projects. As you program, if you notice you've written something that would fit well in that library, move it in there instead. If you do object orientation well enough and have some discipline and thought towards the structure of the library, this should be pretty straightforward and eventually should turn into something engine-y enough for your needs.
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Programming - A Game Engine
« Reply #2 on: December 21, 2010, 09:51:11 am »

Write your first game as you would normally. (obviously well unit-tested and cleanly programmed)

When you write your second game pull out and tweak any duplicate code in a way that works cleanly for both, this allows you to release updates to both without duplicating code base.

As you write further games you'll note what is being pulled out and what is stay with each game, the former could be considered the engine.

Don't try to write 'generic' code you'll end up wasting time when you find that the way you thought it should be generic isn't how it should have been generic, the way you end up with truly generic code is when it's used by a lot of projects. I'm sorry if this sounds like a lot of effort but I've yet to find a shortcut that actually works :)
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Programming - A Game Engine
« Reply #3 on: December 21, 2010, 08:02:48 pm »

At the very least, keeping a copy of all of the basic code you commonly use can be a good idea, so that when starting a new project you can just copy the common code and have everything already working and ready for the new code.
Logged
Eh?
Eh!

stuntaneous

  • Bay Watcher
  • [PREFSTRING:ungodly beard of awesome]
    • View Profile
Re: Programming - A Game Engine
« Reply #4 on: December 24, 2010, 05:24:33 pm »

Thanks for the replies guys.
Logged