-
Notifications
You must be signed in to change notification settings - Fork 0
Map Design
A core aspect of any RTS game is the game map, in which the core gameplay takes place. The map must be able to house a city of a fixed size, while taking up sufficient amount of space in the map to house the core resources of the game. A key challenge in the design was the infancy of the development cycle, which meant that constant gameplay factors such as the city size, enemy numbers and general gameplay loops were largely undetermined. This meant that any solution for the game map had to be adaptable and scalable, to fit the needs of the game as it progressed.
The solution to the demands of the game map was delivered in the form of the algorithm employed by MapGenerator, which possesses the functionality to generate a game map of a given tile width and height, which contains an island holding a city of set size.
The MapGenerator delivers its functionality by doing the following:
- Generate a 2D array of char of the width and height provided - to represent the entirety of the game map
- Fill each entry with an Ocean character - as any tile not filled by subsequent functions will be considered ocean
- Pick a random point on the map to place the city, such that the city dimensions of width and height will still fit - with a buffer to build the island around
- Pick two points on either side of the city, with the distance between them being the specified length of the island
- Iterate between each point and place a vertex, or edge of the map, with points being above the city
- Iterate between each point and place a vertex of the map, with points being below the city
- Interpolate between each pair of vertices and fill in the island
Although it was implemented fairly quickly, the algorithm encountered some key issues when implemented in the game engine
Initially, the map filling function was encountering an error, as the edges of the map had potentially 3 vertices, instead of the usual two, causing an effect like this (below figure visualised after step 5 and 7 was completed, step 6 not implemented).
The game engine's default code comes equipped with placing isometric entities, however, it seemed as though this code was incorrect as entities spawned using the spawnEntityAt() function were being placed at a location slightly offset to their desired location. This behaviour is indicated in the below image:
This was resolved by editing the function which converted a tile point to a world point - which allows entities to be placed correctly on the map.
The map generation was complex to test, given it will have a different output each run, however several measures were taken to ensure its consistency.
- Exceptions were included in the map generation algorithm to informatively demonstrate where and when an issue arose. Issues were defined as any map generated without the desired qualities (i.e. size, island containing a map, etc)
- The algorithm was run 10,000 times to test speed, consistency and error rate
- Step 2 was repeated, with many bugfixes and algorithm development until no errors were present
- To further verify its efficacy, a function to output the map to a text file was written, and used to output the map as it was being built. Each stage of a map being built was confirmed to be built correctly, (i.e. choosing correct position of city, making sure island points are chosen correctly etc..)
- Step 4 was repeated over dozens of maps during development, until no errors could be recognised
Map
City
Buildings
Unit Selections
Game User Testing: Theme of Unit Selection & Spell System
Health Bars
In Game menu
- Feature
- User Testing:In Game Menu
Landscape Tile Design Feedback