Jump to content
Sign in to follow this  
MrZig

IAI

Recommended Posts

Hello. I recently started a new project called IAI (Improved Artificial Intelligence). Basically as it is now, it follows groups and and individual AI and when they find enemies, they sidechat it smartly (type of enemy, location) across the airwaves, and the detected enemies get entered into array with the data [unit,Grid,Type].

As an example, an East unit sees an enemy tank at Fj53, so instantly they sidechat "Enemy armor spotted at Fj53", and the enemy gets entered into a dynamic array with the information [WUnit,"Fj53","Armor"]. I have a script that will update the grid location of this unit if he is still detected (knowsabout > 0.1 by any opposing unit) and similarly the unit will be deleted from the array if he know one knows where he is anymore (knowsabout < 0.08).

Currently there is a bug in ArmA where the number a unit knows about the other (say 0.5) will NOT degrade gradually if he can not see it, but will eventually return to 0 abruptly. This kind of makes things a little screwy for obvious reasons.

If anyone has any suggestions, let me know. Currently the only object needed for the map is a server logic, and I hope it to stay that way - also, no addons.

I will upload the current ver within a couple days so you can get used to the code and let me know what improvements you did, or what could use improving, and suggestions etc.

So basically this thread is for ya'll to lemme know what you think.

Share this post


Link to post
Share on other sites

Good work, especially since it's serverside.

I'm sure serveradmins will notice this addon.

Monk.

Share this post


Link to post
Share on other sites

Well it's not multiplayer capatible yet. Well, it is, but clients will not get any radio messages - yet. This will be adressed later on. However things like flanking, artillery etc will be easily calculated and performed by the server, making it fully multiplayer capatible. smile_o.gif

Share this post


Link to post
Share on other sites

Is this the reason behind some odd behavior that units do not sometimes open fire at units that are according to the messages spotted?

Share this post


Link to post
Share on other sites

... I had a hard time understanding what you actually meant with the Improved AI, I only read something about sidechatting enemy positions wink_o.gif)

Looked at ur scripts and see that it's the beginning of loads more ;P

If I come up with sth I will let you know. You might want to take a look at the grouplink2 by keycat or better the grouplink3 by Solus (SLX GL3)

I am also working on some AI stuff, maybe we can work together and create even better stuff wink_o.gif

My idea was to have a collective consconience of the AI that makes choices and initiates group efforts to fulfill their objective. I wanted to mix some powerfull SQF scripting for the "Collective Mind" with the more individual scripting by using FSM.

Just took a look at your Scripts, my personal ideas/views:

- Drop all SQS, simply keep it all in SQF; 1 language, optimized language, loading scripts into memory and releasing file read/locks.

- Use Settings Arrays and not too many variables (More important when there is more features/functionality inside the scripts). First massively introduced in ECP-mod if im not mistaken. So instead of putting all settings in different variables, simply using arrays with settings, and set them with the set command: array set [0, "WEST"]; etc.

- Use logical tabs in coding, it makes reading code so much more easier, especially for others than urself smile_o.gif

- Make a simple check in the start if the server is local:

IAI_isServer=false;if(local server)then{IAI_isServer=true};

then simply check the IAI_isServer throughout your scripts, not that I believe it will save you much, but I guess it's logical to assume that a server check only needs to be done once and from then onwards the boolean can be used to check smile_o.gif

Share this post


Link to post
Share on other sites
Just took a look at your Scripts, my personal ideas/views:

- Drop all SQS, simply keep it all in SQF; 1 language, optimized language, loading scripts into memory and releasing file read/locks.

- Use Settings Arrays and not too many variables (More important when there is more features/functionality inside the scripts). First massively introduced in ECP-mod if im not mistaken. So instead of putting all settings in different variables, simply using arrays with settings, and set them with the set command: array set [0, "WEST"]; etc.

- Use logical tabs in coding, it makes reading code so much more easier, especially for others than urself smile_o.gif

- Make a simple check in the start if the server is local:

IAI_isServer=false;if(local server)then{IAI_isServer=true};

then simply check the IAI_isServer throughout your scripts, not that I believe it will save you much, but I guess it's logical to assume that a server check only needs to be done once and from then onwards the boolean can be used to check smile_o.gif

Sounds good. About your suggestions..

;Sqs

I do not find that a script in a continuous loop needs to be an SQF to be effecient. That is rediculous. SQS works absolutely fine for the scripts I have coded them in, as you will note the really fast and simple checks are all SQF's, yet the infinitely looping ones are SQS. SQF has a limitation to only a certain amount of loops anyway, and I find it more efficient to make it SQS. There will be no performance gains by going to SQF.

;Use arrays and not many vars

Well, if you looked at the scripts so far you'd find most stuff is in arrays and it'll stay that way wink_o.gif

;Logical tabs

I find they make scripts messier and I actually find it easier to see how a script runs by reading the code - not comments. But maybe I'll go through them and add comments for other people.

;Server check var

Well seeing as how it simply checks the local server at init.sqs, and loads either server.sqf or client.sqf, I won't really need to do any more server checks since all the code will either be, server or client respectively. wink_o.gif

Edit: Crap in the mission I uploaded, the server execs both files. This bug is already fixed and I'm adding the very simple server-to-client structure. (yay publicvariable string).

I'm looking at making the current release fully multiplayer compatible and also adding markers within a couple days.

Share this post


Link to post
Share on other sites
Just took a look at your Scripts, my personal ideas/views:

- Drop all SQS, simply keep it all in SQF; 1 language, optimized language, loading scripts into memory and releasing file read/locks.

- Use Settings Arrays and not too many variables (More important when there is more features/functionality inside the scripts). First massively introduced in ECP-mod if im not mistaken. So instead of putting all settings in different variables, simply using arrays with settings, and set them with the set command: array set [0, "WEST"]; etc.

- Use logical tabs in coding, it makes reading code so much more easier, especially for others than urself smile_o.gif

- Make a simple check in the start if the server is local:

IAI_isServer=false;if(local server)then{IAI_isServer=true};

then simply check the IAI_isServer throughout your scripts, not that I believe it will save you much, but I guess it's logical to assume that a server check only needs to be done once and from then onwards the boolean can be used to check smile_o.gif

Sounds good. About your suggestions..

;Sqs

I do not find that a script in a continuous loop needs to be an SQF to be effecient. That is rediculous. SQS works absolutely fine for the scripts I have coded them in, as you will note the really fast and simple checks are all SQF's, yet the infinitely looping ones are SQS. SQF has a limitation to only a certain amount of loops anyway, and I find it more efficient to make it SQS. There will be no performance gains by going to SQF.

;Use arrays and not many vars

Well, if you looked at the scripts so far you'd find most stuff is in arrays and it'll stay that way wink_o.gif

;Logical tabs

I find they make scripts messier and I actually find it easier to see how a script runs by reading the code - not comments. But maybe I'll go through them and add comments for other people.

;Server check var

Well seeing as how it simply checks the local server at init.sqs, and loads either server.sqf or client.sqf, I won't really need to do any more server checks since all the code will either be, server or client respectively. wink_o.gif

Edit: Crap in the mission I uploaded, the server execs both files. This bug is already fixed and I'm adding the very simple server-to-client structure. (yay publicvariable string).

I'm looking at making the current release fully multiplayer compatible and also adding markers within a couple days.

;Sqs

For me the most important is uniformity, why write a script in 2 (altough not THAT) different languages?

waitUntil loops are infinite, for etc aswell. Afaik the only loop thats not infinite is a while loop, nobody says you have to use it tounge2.gif

;Arrays

You are right, I didnt look that well and simply shared what came up to mind smile_o.gif

;Logical Tabs

I also rather read code than comments, I also do not see the link between logical tabs and comments so much. Code becomes easier to read, because of logical tabs right?

;Servercheck var

True, I guess im thinking about Missions that probably include 10 more scripts that must check for local or not local server smile_o.gif And then it's simply useless to everywhere do a local server check wink_o.gif

Anyway, I will be following this project closely and hope I can contribute somehow

Share this post


Link to post
Share on other sites
;Sqs

For me the most important is uniformity, why write a script in 2 (altough not THAT) different languages?

waitUntil loops are infinite, for etc aswell. Afaik the only loop thats not infinite is a while loop, nobody says you have to use it tounge2.gif

;Arrays

You are right, I didnt look that well and simply shared what came up to mind smile_o.gif

;Logical Tabs

I also rather read code than comments, I also do not see the link between logical tabs and comments so much. Code becomes easier to read, because of logical tabs right?

;Servercheck var

True, I guess im thinking about Missions that probably include 10 more scripts that must check for local or not local server smile_o.gif And then it's simply useless to everywhere do a local server check wink_o.gif

Anyway, I will be following this project closely and hope I can contribute somehow

Meh, I just find long looping scripts easier to use in sqs myself, if anyone wants to convert it to an infinite looping SQF down the road, do it!

About logical tabs, I suppose I misunderstood you. I thought you meant putting a bunch of

//And this is where _x = 0

//and this is where _x is now _x + 1

etc etc.

Share this post


Link to post
Share on other sites

Could the capability for the AI to predict where a unit will be after seeing it moving be added in?

For Example - Soldier spots APC moving down the road and into a tunnel in a mountain. Can AI know he will likely be heading to the exit on the other side

Or - Soldier sees vehicle moving south. Does he know that if he looses sight of it for a while it is likely to be further south?

Share this post


Link to post
Share on other sites

what wille the AI use to complete their objectives? will they identify keey points of groung, flank and i mean flank enemy positions.

i like the idea of the AI predicting the whereabouts of enemy, thereofore they should be able to set up ambishes and fortify positions..

.. Mabe im just getting ahead of myself.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×