PROJECT SPECIFICATIONS
_OBJECTIVES
The objective for this project is to design and develop artificial intelligence for different agents in an upcoming game prototype. The prototype is a strategy and commerce game on a science-fiction background. There will be fleets of starships flying through different space stations, doing commerce and even fighting enemy ships and pirates.
Although the game prototype itself is of such a large scale that it could not be developed with the time available and the current resource constraints, it has been split into smaller parts. This project will then focus on the artificial intelligence part.
The main challenge will be to develop a planner which will drive the ships to a goal location. The technique that is intended to be used in order to achieve this objective is the tactical path finding. Not only does it search for the shorter path, but it also takes into account a number of various parameters, such as the toughness of the terrain or route, the proximity of other agents etc. The weight of these factors will allow for different types of agents to choose an adapted path, depending of their preferences.
Ultimately, after having determined different factions within this environment, the ships could be able to find their own way through the various stations in order to make profit. The method to implement this feature could add too much difficulty to the project so this is why it comes last. It is supposed that various sets of rules, similar to those used in Expert Systems, could be used for actions such as buying and selling goods.
In order to get rid of the task of writing a rendering engine from scratch, it has been decided that the Unity engine would be used to implement the game prototype.
_MINIMUM ACHIEVEMENTS:
Have a collision-free motion in an environment with a massive number of agents guided by an artificial intelligence controller. Also demonstrate the use of the Unity engine (player controls, AI scripts).
_EXPECTED ACHIEVEMENTS:
Have the minimum achievements working, along with the tactical factors taken into account. Try a few different approaches so that they can be compared and maybe even played off against each other.
LEAP FORWARD ACHIEVEMENTS:
Have the expected achievements working, and if there is time left and results are good, develop some extra basic decision making techniques and behavior planners, with features such as commerce management, ambush and evasion routes for fleets, different types of ships with specific roles (cargo carrier, gunship, escort starfighter…).
_TECHNOLOGIES TO BE INVESTIGATED:
• Unity game engine.
• Tactical path finding; tactical heuristics, graphs and waypoints.
• Expert (rules-based) systems.
• Tactical path finding; tactical heuristics, graphs and waypoints.
• Expert (rules-based) systems.
_PLANNED SCHEDULE:
November – end of January: Analysis.
January - February: Design.
January - March: Implementation.
End of January: Trivial prototype implemented (mini application with Unity).
End of February: Basic prototype implemented (simple A* path finder, basic tactical factors).
End of March: Advanced prototype implemented (more advanced tactical heuristics).
April: Post-production and Report writing.
January - February: Design.
January - March: Implementation.
End of January: Trivial prototype implemented (mini application with Unity).
End of February: Basic prototype implemented (simple A* path finder, basic tactical factors).
End of March: Advanced prototype implemented (more advanced tactical heuristics).
April: Post-production and Report writing.
First trivial protoype with Unity (end of January)
The first trivial prototype with Unity is now implemented. It represents a basic square map with nine “bases”; one at each corner of the square, one on the middle of each edge and one in its center. There are four agents represented by cylinders, initially located at each corner of the map. A blue-colored spotlight illuminates the location of a cursor with which the user will be able to select and move the agents from one base to another.
The cursor is manipulated with the Numeric Pad numbers keys 1-9 (or, alternatively, with the standard numbers keys). The location of the keys on the keyboard’s Numeric Pad corresponds to the location of the bases on the map. The cursor is used to select both the origin and the destination of the movement alternatively. The program detects if the destination is not already occupied by another agent in order to execute the movement.
The cursor is manipulated with the Numeric Pad numbers keys 1-9 (or, alternatively, with the standard numbers keys). The location of the keys on the keyboard’s Numeric Pad corresponds to the location of the bases on the map. The cursor is used to select both the origin and the destination of the movement alternatively. The program detects if the destination is not already occupied by another agent in order to execute the movement.
This demo only uses the world-space positions of the agents to execute movements. For now there is no proper grid implemented. In the future, a graph structure should be added on the top of the existing code in order to allow agents to find a free way through the nodes representing the bases, in order to reach their destination. This is where the real part of Artificial Intelligence will be implemented.
Second basic prototype with Unity (March)
The second prototype is working and features a basic A-star path finding algorithm implemented on the agents, represented by fruits. A graph structure is used to hold the node grid data. The agents check if the next wanted waypoint is not already occupied by another agent in order to select it as part of the path to their goal location. On the last two snapshots, the apple is blocked and cannot find a path to the destination on the right hand side.
Third prototype presented for the ExpoTees (end of April)
The third prototype released at the beginning of May was including most of the expected features mentioned in the project specifications.
The pathfinding algorithm was fully functional and provided paths relevant to the tactical heuristics that were previously fed as plugin scripts onto the AI agent game object. The UML class diagram that can be found in Appendix B details the associations between the main components of the program.
The environment built for this version was a lot more complex than the previous scenes that only contained a few basic nodes. For this prototype, there was a large grid of nodes on which various and detailed 3D models helped to represent various types of terrain and different agents.
The selection and cursor system had been modified to use the mouse cursor position, which is much more convenient in the case of RTS games. By left-clicking on the location of a controllable agent, represented by starships, the user could select it as the subject of the next move. If a valid agent was selected, the colour of the spotlight illuminating the cursor location turned from white to blue. Then, by right-clicking on another location on the map, the closest valid node was selected as the goal destination and a request was sent to the pathfinder script to produce a path. If a valid path existed, the spotlight colour briefly turned green before turning white again. Though, the previously moved agent remained selected so that the user could request another destination by right clicking anywhere else on the map until he/she selected another agent.
The main problem with this version was that the nodes were too spaced on the grid, resulting in gaps between them. The agents that were located in-between nodes could not be precisely detected on the grid for the node occupation check.
Moreover, there was no obvious representation of the path taken by the agents and the sight of range of enemies (see following pictures).
The pathfinding algorithm was fully functional and provided paths relevant to the tactical heuristics that were previously fed as plugin scripts onto the AI agent game object. The UML class diagram that can be found in Appendix B details the associations between the main components of the program.
The environment built for this version was a lot more complex than the previous scenes that only contained a few basic nodes. For this prototype, there was a large grid of nodes on which various and detailed 3D models helped to represent various types of terrain and different agents.
The selection and cursor system had been modified to use the mouse cursor position, which is much more convenient in the case of RTS games. By left-clicking on the location of a controllable agent, represented by starships, the user could select it as the subject of the next move. If a valid agent was selected, the colour of the spotlight illuminating the cursor location turned from white to blue. Then, by right-clicking on another location on the map, the closest valid node was selected as the goal destination and a request was sent to the pathfinder script to produce a path. If a valid path existed, the spotlight colour briefly turned green before turning white again. Though, the previously moved agent remained selected so that the user could request another destination by right clicking anywhere else on the map until he/she selected another agent.
The main problem with this version was that the nodes were too spaced on the grid, resulting in gaps between them. The agents that were located in-between nodes could not be precisely detected on the grid for the node occupation check.
Moreover, there was no obvious representation of the path taken by the agents and the sight of range of enemies (see following pictures).
Final version of the prototype
During the short window of time after the event and before the hand-in, the prototype has been tweaked so that the nodes were closer from each other and covered twice more surface. Some graphic features have also been added in order to visualise the route provided by the path finder (green lines on the picture) but also the enemies’ range of sight (red lines rotating like a radar device). These graphic features do not appear in the release version but only when launching the application within the Unity editor because their main purpose is to be used as debug tools.
The following schema sums up the functioning of the AI algorithm as presented in the final release of the program.
Two different types of playable ships were implemented on this map, the green ships and the white ships. Green agents were slow and favoured coming closer to the enemies rather than navigating through difficult terrain. White agents were adopting the reverse attitude. Faster than green ships, they associated a higher value to encounters with enemies’ range of sight and preferred to travel on a difficult terrain in order to have a safer route (see following pictures).
The following schema sums up the functioning of the AI algorithm as presented in the final release of the program.
Two different types of playable ships were implemented on this map, the green ships and the white ships. Green agents were slow and favoured coming closer to the enemies rather than navigating through difficult terrain. White agents were adopting the reverse attitude. Faster than green ships, they associated a higher value to encounters with enemies’ range of sight and preferred to travel on a difficult terrain in order to have a safer route (see following pictures).