Orbital Obliterators

EXPAND . FIGHT . CONQUER

Inside the World Engine

A game will always require a world for a player to explore, enjoy and anticipate, but what makes this experience an everlasting joy is if said player can never predict the next world they’re about to step into. – Tom Day, 2015

For those that need reminding or those of whom who have just clicked onto this article, the contents below are relevant to the game “Orbital Obliterators“, and the process taken to make said game.


Introduction

The World Engine within Orbital Obliterators uses a procedural process to generate genuinely random but well thought out maps for a player to experience, this was achieved by the vastly developed and tested algorithm which decides many aspects of play and then consults each decision the further down the tree it gets. The fact that a random map can contain errors and vastly overwhelming clusters of planets against vastly sparse areas makes the ‘completely random’ approach inadequate, therefore a procedural approach was taken, to allow each type of entity in the space map to load separately, and whilst they load randomly, each selected placement is assessed for feasibility before it can be finalized.

The World Map Grid

The grid in which the nodes, ships and objects will be rendered on will by default have to be tessellated in order to prevent any random gaps and spaces in the map, as these kinds of gaps don’t occur in space! It’s important to explore what grid shapes can be used in this sense, take Civilization V (2KGames Inc., 2011) for example, this game used tessellated hexagons as outlined using a lattice by Birkeland:

sdsddsawwd

fdfgsssfggThis kind of math will be tricky to implement considering the small gain it would provide, which would be 6 directions of movement rather than 4 (assuming the use of square tessellation). A square grid is the option chosen due to its simple mathematical approach considering the scope of the project being so large.

The square grid math’s is simpler to implement as it follows the rules as illustrated to the right. Each node would have to have a co-ordinate programmed in and ships would need to keep track of their associated current co-ordinates. Although 6 directions of movement would have been more interesting for the game play, I feel that if I was to implement the software in a professional manor, I’m sure that the addition of hexagonal grids would not be too much to implement over the top of just sorting the maths.

Summary:

This use of square tessellating grids coupled with Dijkstra’s Algorithm is the best approach to take given its simplicity. The constant factor that’s had to be considered with this project is the overall scope. The scope being so large producing a working implementation is paramount. After an initial implementation, more advanced techniques could be considered, which is allotted within the time plan which is covered later.

City States

The world engine takes in an arbitrary amount of nodes, city states and objects and outputs a random world, each time entirely different. There are higher and lower limiters for all settings dependent on the players choice of world size. There is a heavy amount of geometric mathematics involved in the generation which is briefly detailed below.

ySpace Objects

The diagram below shows the process involved to place some of the strategic objects and city states on the map.

x

Note that by this point the grid hasn’t actually been generated, and the whole grid is stored in a multidimensional array of integers ([,]). This makes the code far more efficient as it only has to generate the grid once, rather than generating it incorrectly and needing to restructure itself. These objects and city states take priority over the placement of the final nodes as they are larger objects and harder to geometrically fit in without causing too much ‘lag’ if the nodes positions were calculated first.

Node Placement

Below we can see the final stage of the generation. We’re at the stage after the spots hatched with orange stripes have been removed from the generation list of possible node places. For the rest of the nodes it is calculated where each one should go using a random number. And if a node is attached to another node or an object, its position is reassigned. After 1000 permutations of unsuccessful placements, the game concludes that it’s an impossible placement map, and starts over from the top, although though testing this only happens roughly once in every 100 attempts.z

The process of a Node placement being assessed as to whether it clashes with a Space Object is encapsulated in code below:

#region Objects
for (int h = 0; h < wObjectsCount; h++)
{
    for (int part = 0; part < 4; part++)
    {
        if (Position == ObjPlaces[h, part] 
                || Position == ObjPlaces[h, part] + 1 
                || Position == ObjPlaces[h, part] - 1
                || Position == ObjPlaces[h, part] + columns 
                || Position == ObjPlaces[h, part] - columns
                || Position == ObjPlaces[h, part] + columns + 1 
                || Position == ObjPlaces[h, part] + columns - 1
                || Position == ObjPlaces[h, part] - columns + 1 
                || Position == ObjPlaces[h, part] - columns - 1
                )
        {
            adjustmentflag = true;
        }
    }
}
#endregion
if (!adjustmentflag)
{
    NodePlaces[l] = Position;
    break;
}

End Result:

At the end of the process the resources are handed back to the GUI and the players are presented with something truly random.

Screenshot (1)


Further Reading

Contained in the ePortfolio on this site are multiple articles outlining how this project was made and some of the research techniques and planning that went into the project as a whole. Below are a few honorable mentions:

Picture1 Project Planning

The critical part of a project by far is never the coding although we all want it to be. Planning a project with a good methodology is the key when it comes to success. Read More…

Picture4Conducting Research

Conducting research whether it is market research or research into appropriate techniques is the cornerstone of any modern project and was not underestimated in this project. Read More…

Picture3Carrying out a Study

Its important to look into what kind of game you’re really making… That way you can insure that you’re putting in the right level of cool when developing. Read More…

Picture5Game Statistics System

To keep a player entertained when creating a game that will intentionally last a long time, you need a robust system of content to keep them enthralled right up to the moment. Read More…

Picture6Creating the AI Decision System

To combat players not having any real friends they need someone to play against, the design and process to implement an AI decision system was the result of this problem. Read More…

Picture1332Building the Game Engine

Perhaps the most complex and challenging of the whole system, the main… system! The Game Engine forms the integral glue that holds and manages all the data. Read More…

<< Previous Article | Back | Next Article >>

References

Birkeland, B., 1997. Illustrated Mathematics. In: Illustrated Mathematics Visualisation ofof Mathematical Concepts with Mathcad PLUS 6.0. Lund: Studentlitteratur, Chartwell-Bratt, pp. 95-102.

2KGames Inc., 2011. Civilization V Manual. [Online]
Available at: http://www.2kgames.com/manual/civ5/civmanual_us.php
[Accessed 20 January 2015].