Hey mates...
A good long 4 hours sleep, 3 Red Bulls and 2 Pepsi's later... here is the latest episode of the open AI Arena design series... as always, just random thoughts put down on paper (i really should try to get these together in some doc of sorts... just dont really have much time)
ok, now enough of docs and boring c*@p and on to classes and other cool stuff :D
1- Starting & game launcher Interface will mostly be done in Qt (most portable on OS's and quite easy to learn and flexible)... the launcher button will launch an OpenGL window, and the renderer will take on the rest from there...
2- Each game will have three classes:
a- map: has information on the terrain & other dimensional and navigational stats
b- game: has info on turn number, score, number of players, etc
c- mission: has info on objectives and their completions
3- Player has an ARMY class, which represents the God-like control of the troops...
4- for the player units, he can have members of either the building class, or the bot class... each can implement all or one of the interfaces: mover, shooter, repairer, builder, gatherer... so for example:
a- tank factory that can construct tanks and repaier them would be a (Building, Builder, Repairer) while the an ultra-futuristic watch tower that can move would be (Building, Shooter, Mover), etc etc etc
b- bots will also be the same, while inheriting from the bot class, so medics will be (Bot, Mover, Repairer) while the ore-gathering tank will be (Bot, Mover, Gatherer, Shooter) etc etc
5- bot stats will be:
a- Sight: distance that can spot enemies within
b- Cargo: amount of ore/other troops (in case of transport) that unit can hold
c- Accuracy: chance of hitting the target (0 to 1, see later)
d- Speed: steps to move every turn
e- Armour: fairly self-explanatory, but read on later to see how it affects hits
f- Health: when 0, u die... simple
g- Weapons Class: [Optional] current class of weapon bot can carry and use
h- Ammo Count: [Optional] in realistic game modes, ammo can run out
5.1 - bot stats can also be made to increase with use (more shooting => accuracy++, more moving => speed++, etc)
6- Weapons stats will be:
a- Ammo Type: [Optional] to make different weapons use same ammo
b- Fire Delay: how much time bot has to wait before firing again
c- Accuracy: again, chance of hitting target, see later
d- Shot power: how much damage dealt on hit
e- Damage radius: example: bullets have radius = 0, bombs = 5, etc
f- Class: [Optional] to see if bot can carry this weapon... it is calculated from the stats above... the higher the stats, the higher the class, so only more advanced bots can carry it
7- each player must create a spawn point from which, he must first create his first builder bot... and then enjoy from there on...
8- typical player scenario would be to create a number of child classes that inherit from bot and interfaces to define your soldiers... then inherit some buildings and some weapons... then on each Think() tick your Army gets, you call your own AI engine and then return an array of actions of what to do, and whos doing it (2D array of Actions & bots/buildings)... maybe even a very smart dynamic AI that adjusts its bot & building classes on the fly to incorporate new tactics? :D:D
9- building, bot & weapon stats must be limited, so player cannot create super units... like for example, for bots there are 8 stats, each can be from 0 to 10, but a maximum of 30 is allowed in all the stats... and if the player creates a class that violates these rules, game will tell him on game start, and this unit will be discarded from play...
10- Accuracy effect: should incorporate distance of shot, bots accuracy, weapons accuracy and a bit of luck :)
when a bot shoots at another (say BOT1 shoots from [5,12,6] at BOT2 [2,19,-3] )
a- line distance between two points is calculated, lets call it (d)
b- shot offset = (1 - (UnitAccuracy * WeaponAccuracy)) * d, lets call this (off)
c- actual offset = rand, where rand is random generated number, and 0 <= rand <= off... lets call it (accOff)
d- accOff is added to the Shot vector's coords (x,y,z) thus distorting where the shot lands... maybe it still hits the target, maybe it hits nothing and maybe it hits a friendly... this way, it would be better for ill-shooters with bad weapons to shoot from close-up, and good shooters (snipers) would have an advantage shooting from far away
11- Radius Effect: when a shot hits, any bot caught in the effect radius gets affected by shot equal to:
a- line distance between bot and position where shot landed, lets call it (d)
b- shot effect radius, lets call this (r)
c- hit power = ((r - d) / r) * shot power...
so bots at the point of impact would get ((radius - 0)/radius) * shot power, which is total shot power... while those at outer edge will get ((radius-radius)/radius)*shot power, which is 0... anyone outside the blast radius need not be considered
12- when shots do hit bots, effect on bot health will be determined by:
a- if shot power < armour, armour = armour - shot power
b- else, armour = 0 & health = health - (shot - armour)
PS: sorry for the very long mail, thats just a spill of my thoughts & ideas right now... as always, comments highly appreciated
as for when we can meet... well...
:)