3. Non-interactive functionality
3.1 RTS-mode
3.1.1 Enemies and neutrals
- Performing: When enemies or neutrals are sighted, they attack you immediately or retreat, depending on the situation.
- Implementation: When an enemy or an neutral game object is close enough to a players object it starts to follow scripted routine or attacks or retreats depending on the mode it's in.
3.1.2 On-game messages
- Performing: Every important message in game is printed on the bottom-left corner of screen and stays there for a while. Applies to FPS mode also.
- Implementation: There are certain events on game, which are important enough to be shown to player. These events send messages to On-Game Message system that prints correct information to screen.
3.1.3 Map
- Performing: The whole map is shown here. Clicking here with left mouse button you can change the place of top-down view or use actions of selected objects directly to a certain place.
- Implementation: The whole game world is projected here like it's seen to player. If CDirectInput class tells that left mouse button is pressed on top this map, correct place of the place in the world is calculated and left mouse button message is generated to object or the game depending on if there is any object selected etc.
3.1.4 Resources
- Performing: Your available resources are displayed in the top-right corner. When collecting resources from sources you can see the increasing resources immediately. The resource collectors must be connected to the command center via pipe or the resources won't be collected at all.
- Implementation: Amount of metal and chemicals are stored in variables and the overall and used amount of power is calculated from all the building objects and energy generator objects preferences. When a pipe object finishes building, it will check for adjacent pipes, store pointers to them and notify about itself, all the pipe objects will then upgrade their animations and "connect" to the other pieces a check will then be done to assure the connection from a command center to the resource collector. When a pipe is destroyed, it will tell it's neighbors and they will clear the appropriate pointers. The pipe graph will then be investigated, whether the resource collectors are still connected.
3.1.5 Environmental occurrences
- Performing: Day and night changes is real time. In day time sunlight provides all the light needed. At nights mechs and bases have additional lights to enable seeing in the darkness. Every now and then at nights lightning strikes down from the sky. Lightnings can be captured with lightning power station thus creating additional energy.
- Implementation: When game time variable increases to match definition of night time, the brightness of the general light source is changed linearly to very low level to indicate darkness. At the same time game starts to calculate random occurrences for lightings with random starting and finishing points (finishing point of course dependant on starting point). If Starting point is near enough to a lightning power station object, finishing point goes automatically to the object, but if not, the lightning strikes down randomly. When lightning power station is present, the amount of lightnings hitting the station is larger than in normal conditions (no station). With every lightning an amount of energy is added to resources (see 3.1.4).
3.1.6 Tactical AI
- Performing: After tactical AI technology has been developed, automatic operation modes can be changed from action menu (or by shortcut keys in fps-mode). Manual commands will be performed in spite of the current operation mode. However, manual controlling from the fps-mode returns mech to autofire mode.
- Implementation: Tactical AI is implemented using scripts, state machines and special knowledge class (see 1.5.2). If attack mode is used, information about enemy base locations and mechs are used to generate plan of actions. Communication between other mechs is possible using messages, for example to synchronize attacks. Damaged mech will try to avoid enemy mechs and defence systems. Defence mode requires information about own bases and resources. Communication between mechs enables distributed defence and asking for help. Scout mode requires information about enemy mechs, terrain and resource locations. In scout mode comminication between mechs is not required.
3.1.7 Strategic AI
- Performing: The computer opponent in the game will try to beat the player using partly pre-scripted strategic AI. It is able to beat beginner player and doesn't get stuck or look obviously stupid. Different strategic actions may be triggered by timers or players actions.
- Implementation: Multilayered AI is implemented using fuzzy logic, simple terrain analysis, pre-scripted build orders and message based state machines (see 1.5.3). The strategic AI can use the advanced tactical AI actions like autoaim even before it has developed them, but only to single mech at a time.
3.2 FPS-mode
3.2.1 Radar
- Performing: When the radar technology is developed, the mechs will get an on screen radar, that will scan the mechs surroundings. The radar will show any mechs in the vicinity, at first if they're in the direction of the radar "beam", and with more advanced technology they are detected if they're near enough.
- Implementation: If the mech has radar technology, it's distance and direction from other mechs are calculated. If they're close enough and at the direction of the radar (for the less advanced radar), they will be shown as dots on the radar.
3.2.2 Damage modelling
- Performing: When a mech or a building is hit by a bullet, it will get damaged. The "bullet" might also be a landmine, which will explode, when a mech walks nearby. Homing bullet types follow the target, unless they have a defence mechanism against homing missiles, explosive bullets create area damage and some bullets also cause long-lasting effect. Landmines may be detected with appropriate technology. A special type of area damage called EMP shockwave is also available, it will do disaterous amount of damage with a wide radius, but does nothing, if the defense mechanism is developed.
- Implementation: If the collision detection algorithm (see 1.2.1) detects a collision between a bullet and a mech/building, the mech/building will be polled for it's armour details. The different damage amounts caused by the bullet will then be scaled by the appropriate armor level of the mech/building and the results summed. The mech's or building's hitpoints will then be reduced by the sum, and panel displaying the hitpoints is updated. The location of the hit makes no difference, a hit is a hit. When a area damage bullet hits a target, it's radius will start growing rapidly, causing damage to surrounding objects every turn. Area-damage bullets may also be timed, they may wait for certain number of game loops to explode. Long lasting damage bullets will follow the mech, causing collisions in every game loop until it's timer runs out or it's removed at a mech building platform (implemented as a mech upgrade). The homing bullets look for a target every few rounds and fix their direction as much as they can (the bullets may miss, and then go round in circle until they hit something, their following timer runs out or they are back on track to the target). When landmine seeing technology is developed, all landmine object will be sent a message so they can set their animation to visible one.
3.2.3 Machine visions
- Performing: When Machine Vision I technology is developed, all enemy mechs visible in fps mode are detected and highlighted with drawing a rectangle around them and showing the distance to them. With level 2 technology, the armour levels and weapon info are shown of the enemy mech. The level 2 info can also be seen in the RTS mode by selecting the enemy mech.
- Implementation: If machine vision technology is developed, all mechs in the area seen by the mech are then investigated. If they're in the looking direction of the mech, a rectangle calculated from their bounding box will then be drawn around the mech and a little text will tell the distance. When level II is developed, the enemy mechs are also polled for their armour and weaponry information and it will also be shown (in a compact form) in Targeted enemy info panel.
3.2.4 Autoaim
- Performing: When autoaim technology is developed, mech can automatically aim the enemy. Autoaim doesn't change the orientation of the mech (or even the upper body), but just moves the crosshair within a fixed radius.
- Implementation: All enemy mechs in the area seen by the mech are checked. If angle from the manual firing direction to the mech is small enough, crosshair will instantly be moved. If more than one mechs are on sight, closest one (determined by the angle, not the distance) is selected. Current position and speed of the enemy mech are used to calculate correct aiming. Constant speed for enemy mech is assumed, and changing the speed may cause the autoaim to aim faulty. Correct aiming doesn't guarantee the hit from the long distances (see 2.2.3).
3.2.5 Autofire
- Performing: Autofire operation mode is mostly used from the fps mode, but is available in the rts mode as well. It will simply open fire whenever autoaim (see 3.2.4) is succesful.
- Implementation: When autoaiming is succesfully performed, mech will be notified. If autofire mode is on, mech acts like with manual shooting (see 2.2.3).