BA 5.4 config for NTAI, slowdowns reduced

BA 5.4 config for NTAI, slowdowns reduced

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

Moderators: hoijui, Moderators

Post Reply
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

BA 5.4 config for NTAI, slowdowns reduced

Post by DJ »

This config will only play as arm and is very simple. It does show a bit of what NTai is capable of though...

For the latest build of NTai see the NTai thread.



Image
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

Now plays as arm or core, have managed to alleviate the slow downs by managing the construction units better and adding base positions for retreating units. Not perfect still but should play a full game quite well
Harbinger
Posts: 82
Joined: 26 Mar 2007, 22:14

Post by Harbinger »

I'm just watching a game of ntai vs ntai and i'm not very impressed. I dont know if it's the ai itself or this config. So far, each team has built 2 factories instead of focussing on 1, then started an air factory and is constantly metal stalling. This is on the map Karst.

Hmm, I've just noticed that it builds nano turrents and then tells them to guard things that are out of range..
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

what starting energy and metal did you give it?
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

ah my fault, i had taken out the energy restriction on the kbot lab and aircraft plant when i renamed all the task lists. I'll upload a new version tonight
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

be aware that while a guard order may be valid when issued, if the unit the nanoturret is guarding moves outside the nanoturrets range it becomes useless.

The immediate solution to something like this would be to implement a simple nanoturret patrol order using the same sort of code as the lua widget that does the same thing.
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

the nano turrets are set to guard the nearest factory, they have a repair nearby unit in their task list as well. This isn't ideal obviously but doesn't seem to cause any performance issues and makes a big difference to the unti production when the nano turret is in the correct place. I'll look at the postining of nano turrets in the code and see if i can't add another tag such as stationary_assist or something
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

I'll look into implementing the patrol order, just struggling getting spring compiled in vs2005 at the mo, i'm a total C++ noob so got learning curve with that as well.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Code: Select all

float3 patrolpos = *xyz you want*;
TCommand t(CMD_PATROL);
t.push(unit_id);// push in the units ID
t.push(patrolpos); // push in the position
boolean result = G->OrderRouter(t,false);// queue for execution(false means any previously queued commands for this unit arent deleted)
That would be the code to set a simple patrol, or at very least something that looks like that.

I would add a simple keyword, and a new task class that issued that order in the initialize function, and registered itself for unitdeath events. Then on RecieveMessage function it would check for the unitdeath and if the unit that the task belongs to has died it would end the task. This way the unit will carry on the patrol indefinately till death. Then you would modify CUnit.cpp so that the LoadTaskList() function loads the task.

The final step is modifying include.h(to add the new keyword to the enum), and CManufacturer(to register the enum, along with its canonical name so it can be printed out in the logs).

To generate the task position of the patrol route (float3 patrolpos) I would use a function in the CMap class or one of the other help classes that generates a random position based upon a distance and an origin point. For the distance I would use the builder distance of the unit.

As a side note, the value returned by result is most likely true but its not a 100% check. If the command passes initial checks itll return true, but that command may then get passed to the engine and an error value gets returned so the order router class will issue a UnitIdle command on that unit.

Using the above you can adapt it to make whatever task you want. You could even implement a custom rule based system for a builder that behaves like AAI or KAI, or a custom attack handler. If your looking to help make general improvements, most of the keywords from the previous task management system were simply copy pasted into one keyword task class, with a big list of if else statements.

Perhaps it would have been best if this were in the NTai thread. When v0.75 is released, I intend to allow NTai to interface with the mod based lua so that config makers cna implement their own task keywords so say there'll be a t_sell command that sells a unit or a superweapon_arty keyword that fires the artillery superweapon, or implements a superweapon AI for an artillery superweapon building, or perhaps a task to make a transporter couple up with artillery and go around as requested by the s44 people.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

And as a side note, putting 'slowdowns reduced' in the thread title isnt going to encourage users to download it.
User avatar
DJ
Posts: 355
Joined: 17 Jan 2007, 13:26

Post by DJ »

And as a side note, putting 'slowdowns reduced' in the thread title isnt going to encourage users to download it.
No I doubt it is, but seeing as they are in that config I thought it was quite relevant.
Post Reply

Return to “AI”