Sunday, June 26, 2016

RTS Engine UML

This is more of a technical post. A request of sorts.

I'm building my RTS from the ground up, in Unity. This means building the RTS engine itself. I've tried and followed several tutorials and full guides to get some really nice results - and in the processes finally understood how Unity works and how to properly arrange the source codes and assets.

However, before I get down to properly implementing the engine, I'm doing some more research into various approaches on how different RTS engines are built.

Currently I'm compiling UMLs from such engines as:

Since I'm using Unity as the underlying engine, the UML I'm compiling is more of a logical nature, dealing with the Hierarchy of in game objects - Units, Buildings, Players, Goals - and the Global Managers - AI, Resources and other relevant game states. Everything else is handled by the Unity engine itself.

I'd love to get some advice and pointers on what and where to look for more info on Real Time Strategy frameworks and object Hierarchies.

In one of my Navy roles, as an ILS officer, we printed out a giant, 2 meter long poster, describing the Cradle to the Grave Logistic Support method. Worked well in guiding many projects,

Ideally, I'd be able to compile and print out a nice wall scroll of a suitable UML, to admire while I code. Also, doodle all over it with changes and improvements.

13 comments:

  1. Hey there,

    regarding object hierarchies:

    The Gang of Four says, you should favor object composition over class inheritance. So you could do some research on Entity Component Systems.
    Here are some slides from my game programming lecturer from university:
    http://www.slideshare.net/npruehs/game-programming-02-componentbased-entity-systems

    And here is a tutorial from Unity regarding the implementation of an event system:
    https://unity3d.com/learn/tutorials/topics/scripting/events-creating-simple-messaging-system

    In Unity, you would not create classes, which implement the logic you need for e.g. a tank, but compose the tank of different components, such as "Health Component", "Movement Component" and such, and create systems, which operate on the Components from all game objects.
    Benefit would be, that you can compose your behaviour out of different components and reduce coupling. Means work on one feature won't influence others.

    Hope this helps

    ReplyDelete
  2. Hi,

    I created RTS Creator, http://store.steampowered.com/app/327490/ .

    It was a 5 year long project that started from scratch using BlitzMAX as a programming language. Throughout the process I learned to write the graphic renderer with OpenGL as well as write a threaded server\client model. There were a lot of lessons learned and when I began I honestly didn't know where to even start. It went through 7 major revisions before I finally had a design that was both closed for modification and open for extension as the goal was to have every aspect of the engine fully editable.

    Since then I've become fairly proficient with Unity, and creating a real RTS Engine in Unity poses some challenges.

    1. Physics
    Unity uses PhysX, a non-deterministic physics engine. Determinism is a pre-requisite in multiplayer RTS Games, otherwise you'll reach bandwidth bottlenecks very quickly. Without getting into the details of latency and bandwidth, imagine 100 units max vs 2000, the difference is huge.

    2. Multiplayer
    With a deterministic physics engine, you then need a multiplayer model that implements the "lock-step" technique in order to keep games synchronized. A short explanation of how this works is, when a player issues a command, that command is sent to all other players but is not issued until a few hundred milliseconds(depending on the latency of all players) later. All players then act on the command at the same time. This avoids the need to send data synchronizing all objects in the game. This is also why in some games you see a message like "The network game is out of sync." Here's a link on an article to the lock-step model.
    http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php

    3. Threading
    A well designed RTS Engine is going to maximize it's use of threading. Unity by default only uses the main thread. I suggest checking this article out before considering a design in how to incorporate something similar into Unity.
    https://software.intel.com/en-us/articles/designing-the-framework-of-a-parallel-game-engine

    Understanding these 3 things and coming up with a good design for them will give you a solid core foundation to build off of.

    BLaBZ

    ReplyDelete
  3. Hi,

    I created RTS Creator, http://store.steampowered.com/app/327490/ .

    It was a 5 year long project that started from scratch using BlitzMAX as a programming language. Throughout the process I learned to write the graphic renderer with OpenGL as well as write a threaded server\client model. There were a lot of lessons learned and when I began I honestly didn't know where to even start. It went through 7 major revisions before I finally had a design that was both closed for modification and open for extension as the goal was to have every aspect of the engine fully editable.

    Since then I've become fairly proficient with Unity, and creating a real RTS Engine in Unity poses some challenges.

    1. Physics
    Unity uses PhysX, a non-deterministic physics engine. Determinism is a pre-requisite in multiplayer RTS Games, otherwise you'll reach bandwidth bottlenecks very quickly. Without getting into the details of latency and bandwidth, imagine 100 units max vs 2000, the difference is huge.

    2. Multiplayer
    With a deterministic physics engine, you then need a multiplayer model that implements the "lock-step" technique in order to keep games synchronized. A short explanation of how this works is, when a player issues a command, that command is sent to all other players but is not issued until a few hundred milliseconds(depending on the latency of all players) later. All players then act on the command at the same time. This avoids the need to send data synchronizing all objects in the game. This is also why in some games you see a message like "The network game is out of sync." Here's a link on an article to the lock-step model.
    http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php

    3. Threading
    A well designed RTS Engine is going to maximize it's use of threading. Unity by default only uses the main thread. I suggest checking this article out before considering a design in how to incorporate something similar into Unity.
    https://software.intel.com/en-us/articles/designing-the-framework-of-a-parallel-game-engine

    Understanding these 3 things and coming up with a good design for them will give you a solid core foundation to build off of.

    BLaBZ

    ReplyDelete
    Replies
    1. Weird, your reply went to Spam, for some reason (maybe cause of double post).

      But thanks for this, will think about these.
      Currently, building a Vertical Slice, so maybe for brevity's sake, will use more off the shelf stuff as they are.

      Thank you very much.

      Delete
    2. Also, regarding LockStep specifically - yeah, I'm well versed in that.

      Delete
  4. Benefit would be, that you can compose your behaviour out of different components and reduce coupling.https://www.liedetectortest.uk

    ReplyDelete
  5. Whatever place you are at in your studies, these popular books on psychology are sure to give you a little extra help in your quest on the road to your career.how to write a dissertation guide

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. El lado mas humano de Freud

    ReplyDelete
  8. Thanks so much for the blog.Really thank you! Want more. stay positive quotes

    ReplyDelete
  9. The author has composed this blog in the most aesthetic way. Awe inspiring!
    Psytechnologies

    ReplyDelete
  10. Your website is really cool and this is a great inspiring article. Juana de arco

    ReplyDelete