4
\$\begingroup\$

Do any of you have any good examples from two or more games that share some of the same game logic, but are of entirely different genres? Could very well be one of your own games. Take Warcraft 3 and World of Warcraft for instance. Entirely different games, but they could have some game logic in common without us knowing.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ You are being a little vague on what you mean by "game logic". \$\endgroup\$ Sep 4, 2010 at 19:41

3 Answers 3

9
\$\begingroup\$

Game logic re-use can be a wonderful thing! Here's where and how we've used much of ours from project to project. About 75% of our 2004 title exists throughout the games we've created in the subsequent six years, even though they are all quite different:

Here are a few places where we've re-used modules:

  • Tools: The level editor for Inago Rage exists as part of Aaaaa! and Ooo!, but it also formed the basis for gameplay for Epidemic Groove (the player's interface for building defenses is an augmented version of the map editor from the previous game).
  • Libraries: The audio wrapper for our sound library of choice is shared between all five titles. We've improved this with each iteration.
  • Game Logic: Elements such as player movement logic were/are re-used where appropriate. No need to re-invent the wheel.
  • Utility: Certain elements such as text display/HUD are re-used and (ideally) augmented each time.

Pluses: Over these titles, we've learned the following positive things:

  • Re-use reduces the time required to prototype new ideas.
  • It can also reduce time-to-market once we're past the prototype stage.
  • Elements that seem outdated can serve as a basis for more polished future work. For example, if the UI that displays the score is ugly and aliased, no matter -- we can use it during development, and polish when we're ready.

Minuses: And the following negative things:

  • Re-use can sometimes constrain what we do when we prototype. For example, we never considered an RTS-style game because it was too far from what we'd done before.
  • Sometimes we neglect to refactor, so we end up with the code equivalent of junk DNA. There are routines that handle weapons upgrades from our 2004 FPS in our 2009 title whose gameplay does not involve combat.
  • If the code sits atop one engine, porting it all to another engine can be difficult. (For example, we want to move to Unity for cross-platform compatibility, but that requires a certain time investment we didn't want to make just yet.)

Still, I think our inclination to re-use has kept us in business thus far, and would recommend the practice. Hope that helps!

\$\endgroup\$
2
  • \$\begingroup\$ Exactly what I was looking for, thanks! Out of curiosity; did you ever end up refining parts of an old game due to having reiterated/tuned up a small part of it in a different, newer game? \$\endgroup\$
    – Erlend
    Sep 5, 2010 at 19:56
  • \$\begingroup\$ Absolutely! For example, our 2009 title got some of the guts of our 2010 title (for audio, I think it was). But we don't do it as much as we should. \$\endgroup\$ Sep 5, 2010 at 21:41
0
\$\begingroup\$

The easiest examples of this are two games that use the same engine, or one game that is a "mod" of another game (which is just a special case of "same game engine" really).

And yes, of course you can do that. One of the Warcraft mods took away the concept of destroying the opponent and essentially created what is now known as the "Tower Defense" genre, which is a bit different from the Realtime Strategy genre. Portal and Half-Life 2 share their game engine in common; I'm not sure exactly what genre to call Portal, maybe a physics-based puzzle game, but I'd be hesitant to call it a pure first-person shooter.

If you want to get technical, all games using, say, Game Maker are built using the same tools, and therefore share some of the same objects and behaviors. Or even games using C++ that are all using if statements, for loops and pointers, whether they be RPGs or FPSs or retro-arcade games. So it all depends on how loosely you define things.

From the question title, I'm guessing that what you're REALLY looking for here is a general list of "game programming" tasks that are used in a variety of games, beyond just "normal" programming -- in other words, what functionality should be common to every "game engine"? And yes, there are a few things: random number generation; displaying sprites (for 2d games) or polygons (for 3d games) to the screen; ability to accept and respond to player input in real-time; collision detection; pathfinding; playing sound effects and background music.

\$\endgroup\$
0
\$\begingroup\$

I believe this deals with logic like "making the player jump". I've heard that question from inexperienced developers a couple times. What you're looking for is more algorithmic in nature. For example, the code to make an actor jump in a game could be uniformly used in any engine and any game that supports jumping characters.

It needs: - a velocity vector for the actor - a force modifying the velocity (jump) - changing actor position based on velocity every frame - reducing velocity every frame based on gravity - certain minima and maxima, like min/max speed

This works in a 2D Jump 'n Run, a 3rd person action-adventure or a 1st person shooter in any engine. Only the parameters (force, gravity, coordinate system) change.

But sharing this kind of code across games of different genres is unlikely simply because developers:

  1. change engines (sometimes depending on game genre)
  2. stick to a certain genre anyway
  3. simply re-write the code because it's so simple or requires significant architectural changes because of the game genre or game engine
  4. love to reinvent the wheel (some do)
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .