2015-07-09

Thoughts on AI programming

One course that I had during this spring semester was called Game Programming V, where the main focus was on AI theory and programming.

There was a lot of new theory during this course, but it was useful nonetheless. It covered both simpler for of AI like path-finding (using A* and similar techniques) and decision trees as well as more complex forms of AI like neural networks. This is a lot to talk about in just one blog post, but if there is one thing that the course thought me is that AI does not necessarily have to be hard, if you think of what you actually need for AI in your game.

One technique that I have used for some of the games I've made so far is called a finite state machine, which can be described (simplified a bit) as a class that keeps track of what state a the game, a character or whatever is currently in. If certain conditions becomes true, then the state changes. A concrete example of this would be a unit who's first stage is patrolling an area. If an enemy unit walks into a units vision, the state of the unit might change to defend or something else. This is rather simple to code, but can still be interesting AI in a game.

Another example of AI decision making that isn't necessarily boring (in my opinion) is in the Long War mod for XCOM: Enemy Within. At the start of each month, the aliens will make a decision on what kinds of missions that they will send against the player based on two factors; how much they perceive XCOM as a threat and how much resources they have available. Even if their decision is only based on two factors, it can still create interesting scenarios in the long run. Granted this also depends on other factors as well.

2015-06-18

Final version of my thesis work

The final version of my thesis work (That I talked about earlier) has now been formally passed by my examiner. The feedback that I got from my examiner was mostly to clarify some things in the thesis and fix spelling and grammatical errors. One thing changed since the last post was the value of the gas resource. Previously it was valued at 1.4 minerals but in the final version it was valued at 1.6 minerals instead, with the justification being available in the thesis

More summary of my works at Campus Gotland will come later.

The thesis can be downloaded from the DiVA archive here:

The file "fulltext" is the thesis itself and the file "attachment" contains an Excel spreadsheet with the data that was used in the thesis

2015-06-01

Overview of my thesis work

It was a while since I last wrote something here, but now I'll write about what I did for my bachelor thesis work. My thesis was about the internal economy in RTS games; more precisely StarCraft II: Heart of the Swarm. My thesis was about if you could look at cost per DPS as a way to approach game balance on.

So how did I approach this matter? As the first step of the process, I decided to break down the various properties of all units in the game, with the most important properties being their cost and their DPS values. After lots the data had been gathered, average values were calculated for all the various properties. Both total averages and average per individual race in the game was calculated.

In order to make the analysis easier, I decided to treat a unit's cost as just a single variable, minerals. 1 unit of gas assumed to be slightly higher than 1.4 minerals (The total mineral cost of all units divided by the total gas cost of all units equaled roughly 1.4). Even though the exact number used may not have been ideal, it simplified the analysis process.

After that, the analysis process begun. Here, I would look at some units and mechanics in the game, compared their properties to the average values and make an analysis on if the units had some benefits or drawbacks for its cost/DPS ratio.

One example of this is the Protoss unit Dark Templar. Even though it's cost is very close to the average cost in the game (302 and 305 mineral respectively). And despite this, if the Dark Templar would have costed according to the average cost/DPS ratio (which was 27,8 minerals/DPS), it would have needed to cost 722 minerals (as the Dark Templar almost have 26 DPS). I figured that the Dark Templar has some drawbacks that compensates for it's high DPS (in relation to it's cost): it has very low health and a fairly long build time.

Another example of this included the Zergling unit (belonging to the Zerg). If  a Zergling were to cost according to the average cost/DPS values in the game, it would have needed to cost 160 minerals, compared to 25 minerals that it costs now. I assumed that one of the reasons for this was because the  Zergling is among the units with the lowest health in the entire game.

I did this kind of analysis for 1 mechanic and about 3 different units per race in the game. This study was obviously not a complete one, due to the time available for the thesis. But in the end I got to the conclusion that it could be possible to approach game balance by looking at a unit's cost/DPS ratio. I do however feel that the subject needs to be approached with caution, because when I was doing the analysis, some units came of as being way to powerful for their cost (among them the Zergling unit)

The full thesis, as well as the complete data used for the theis, will be posted here when it passes all the required formalia. Lastly, I want to give a big thanks to my tutor Jakob Berglund-Rogert for tons of valuable feedback during the process of writing the thesis.