UNIT Class v1

UNIT Class v1

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

UNIT Class v1

Post by krogothe »

This is mostly intended for the beginning AI makers, but hey it provides a decent structure. It is also pretty incomplete and untested (only tried a couple commands, but they should work okay).

What does it do?
It provides most of the commands a unit can perform, and simplifies people's lifes by having one object that does most functions a unit will need. I reccomend you simply make an array/vector of 5000 of them at startup and then assign them IDs and Update() them.

http://www.fileuniverse.com/?p=showitem&ID=2409

I gotta add a couple more commandsand test it some more when i have the time, but should work no probs :)
Please comment/critique, so i can sort it for the next version.
This isnt like the mex class, a fire and forget thing. I want comments on this so if anyones gonna start going off-topic or flaming, please would you kindly go fuck a goat instead.
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Looks interesting. I might suggest a few more status commands though. Maybe something like this:

Code: Select all

bool BeingBuilt();
bool IsAlive();
float Health();
float PercentHealth();
float3 CurrentPosition();
command CurrentCommand();
int Group();
...
etc.
Also, for the sake of C++ pickiness, the UniDef and ID pointers should probably go into the private section and be accessed by functions to prevent them from accidentally being changed.

Otherwise, looks pretty good. I might try using it.
User avatar
Lindir The Green
Posts: 815
Joined: 04 May 2005, 15:09

Post by Lindir The Green »

Thx! This will really help me!

now off to decipher some more of the source code, on my quest to build a working AI...
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

Veylon wrote:Looks interesting. I might suggest a few more status commands though. Maybe something like this:

Code: Select all

bool BeingBuilt();
bool IsAlive();
float Health();
float PercentHealth();
float3 CurrentPosition();
command CurrentCommand();
int Group();
...
etc.
Also, for the sake of C++ pickiness, the UniDef and ID pointers should probably go into the private section and be accessed by functions to prevent them from accidentally being changed.

Otherwise, looks pretty good. I might try using it.
most of these can be called from the callback :), reason why the def is public.
Update() plays the role of IsAlive(), you can use that!
Ill make ID changing a method however and keep the actual int private and also add current position/group/current health methods
Keep them coming!
User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

I know those are in the Callback, I just thought they ought to be in the class as well because of modularity, so that everything related to the unit is available from the unit class.

I think I might try using this system in OTAI 1.10 or 1.11. Good luck with your AI!
User avatar
QMan
Posts: 103
Joined: 17 Feb 2006, 01:10

Post by QMan »

Checking to see if there have been any recent additions to this. I'm going to try using this for my new AI. :)
Post Reply

Return to “AI”