Jump to content


Photo

Advanced transport usage...


  • Please log in to reply
18 replies to this topic

#1 Lion

Lion
  • New Members
  • 50 posts

Posted 01 September 2004 - 09:29 PM

Right After learning how to stick things into a tranport i noticed i had to change the attacking behaviour as sometimes the attack flag would be true and the transport would simply run off leaving soldiers on foot!

I then devised a method where a timer would count down and then after that the vehicle would attack....
However, i think i must have screwed up once again!!! The people all load but the humvee does not leave the base!! I suspect it has to do with the timer or the hunt script in some way...

The team consists of a humvee and 5 soldiers
OnCreate it will run "Load transports sequence"
then it will run the "Hunt" script (in the general scripts list)
as well as priorities but that doesnt really count here

Load transports sequence:

*** IF ***
True.
*** THEN ***
Set timer 'LOAD TRANSPORTS' to expire between 18.00 and 25.00 seconds.
Team '<This Team>' executes Script 'Load Transports Sequentially' sequentially

Load transports Sequentially:

*** IF ***
True.
*** THEN ***
Team '<This Team>' change their attitude to Normal
Team '<This Team>' will move towards the nearest 'Base Buildings' within area '[Skirmish]MyOuterPerimeter'
Team '<This Team>' load into transports.

The hunt subroutine:

*** IF ***
Timer 'LOAD TRANSPORTS' has expired.
*** THEN ***
Team '<This Team>' stops executing.
Team '<This Team>' change their attitude to Aggressive
Team '<This Team>' begins hunting.


It Looks fine to me but it JUST WONT WORK... any ideas for fixing this or some alternative i can use?? I want to get my new version uploaded soon and thats the very last thing to be fixed!!


UPDATE: the timer is fine and working, and the hunt routine executes, all the way till the end (told the AI to sell off after being hunting and it did) however it wont seem to actually hunt!!

Edited by Lion, 01 September 2004 - 10:04 PM.


#2 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 01 September 2004 - 10:41 PM

What does <This Team> refer to in the last script you posted? The transport team (that is, the team containing the units that can transport other units) or the team to be transported? Try swapping it either way..


EDIT: Ah right yes now I've read it properly.. Uhm.. what is the initial attitude of the team?
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#3 Lion

Lion
  • New Members
  • 50 posts

Posted 01 September 2004 - 10:46 PM

normal, but as seeing it changes to normal and then back to agressive it should work fine!
im trying everything, at the moment im changing if scripts repeat or not as well as other stuff in the behaviour tab...
tough nut this one!

#4 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 01 September 2004 - 11:13 PM

What's
Team '<This Team>' stops executing.
?
If your test of telling the computer to sell off everything worked, that only tells you that the script completed, not that the team followed the actions in the script. Is it possible that Team '<This Team>' stops executing. causes the team to stop responding to all commands? Then when you tell it to change attitude and hunt, it hears you but ignores your orders as you had previously told it to ignore you :)
Just a thought, try removing that line, or if its critcal that they stop, try telling Team '<This Team>' stops.
Also, I've started getting sick of watching my men surround the CC before they get into the transport, I now tell then to move to the nearest unit/structure of type <Insert infantry to be transported here>. So, for example, MD's in a humvee are told to move toward the neared MD within MyOuterPerimeter. This makes the MDs bunch up near the barracks and makes the humvee (which is a lot faster than the MDs) move to the men. When the humvee arrives, they get in. Speeds up loading by a big margin. :)

Hope that helps.

I've also got a query, it's mainly for Thudo or Mithril - I know you have done this Thudo - to do with getting guys into chinooks. I had done it before, and now its causing problems. How do I stop a chinook from being 'recruited' from the ones already in use instead of being built?
The team I'm trying to work out is quite complex. I want 2 MD's & 4 Rangers to load into a chinook, get ferried to the enemy base & unload at their supply center. Once they unload, I reduce the team's priority by its failure amount (lowering it to zero) & set it to be able to be recruited from. I also raise the priority of 4 other teams by their success rates (each from zero to 1000). The 4 teams are 1 chinook, 2 MDs, 2 rangers & 2 rangers.
The idea is that the guys get ferried over to the enemy base, the chinook unloads them and returns home (possibly for other assignments), the MD's start hunting dozers/tanks/vehicles with laser lock, or attack buildings normally if there are no vehicles. Ranger team 1 hunts, has priorities against infantry of all kind, then buildings. Ranger team 2 tries to capture buildings.
First time I got it working, there was a problem with the disbanding of the intial team, so they didn't each do their own thing, they just stood next to the supp center and shot things that came close. Now though, they won't even get in the chinook, it keeps landing for them to load, then changing it's mind and going back to collecting supplies. After each collection it lands again, then goes back... Most annoying.

These new problems could stem from me trying to have the chinook initially as a seperate team, and merging it onto the team with the 6 infantry, instead of creating it with the initial team.
Thudo how did you do it? I remember reading about you trying something like this, what did you do?
Anyone else with suggestions would also be appreciated.

Cheers,
Lord Akkrand

#5 Lion

Lion
  • New Members
  • 50 posts

Posted 01 September 2004 - 11:20 PM

Finally got it fixed...
Like just about all the bugs i encounter and that take me hours to solve it was stupidly simple... the problem was that the hunting script didnt deactivate so every frame it kept telling the team to hunt, overloading it and making it stand there stupidly... Extremely hard to find out that was the problem, but once discovered ridiculous to solve...
well Your problem might just be something like that! try changing the teams's mood and check if scripts deactivate...

about the moving to the MDs, well what can i say? great minds think alike! (we thought out single auroras were better than groups at same times as well!)... I did the exact same thing as you did... but it kinda failed as my base layout doesnt help them much....
i aslo move to *somewhere else* for china hackers and AA units like avengers :)

Edited by Lion, 02 September 2004 - 12:17 AM.


#6 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 02 September 2004 - 02:05 AM

Also another simple thing I wondered if anyone knew of, or had worked out a way to determine how far away something was.
I'd like to be able to tell how close, for instance, the nearest <object> was to a given team.
Or be able to tell, when a team is hunting, what they were currently attacking - as I could use this to work out what the closest thing was.

Just seeing if anyone else knew, I often spend 1/2 hr poring over the different conditions/actions available in WB, not sure if it has fried my brain since I can never remember if such a thing exists or if I just want it to exist. :(

Cheers,
Lord Akkrand

#7 Lion

Lion
  • New Members
  • 50 posts

Posted 02 September 2004 - 02:54 AM

Well you might be able to improvise a way using the priority system.
give things priorities and when they come close enough to whatever you set to hunt youll know it was at distance X

X = priority x priority decay specified at AIData.ini , in units

Youre a clever man so im sure you can work out something out of that formula :grin:

#8 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 02 September 2004 - 03:15 AM

Hmmm... like if I set all their priorities to 1, for example?
That would be useful, but only if when there is nothing around the unit goes idle, otherwise I still don't have a 'trigger'.

Thanks, I'd forgotten about priority decay... :)

EDIT: Jesus I just noticed exactly what you said there ("specified at AIData.ini"). I didn't know the priority decay was something that could be changed! I've just looked and found it, 100 units for every priority... have you done a lot of testing with this? If I reduce that to 1, and increase all the priorities I already have defined by 100fold (might take a while :grin: ), that makes the priority system 100 times more precise, if necessary... I wonder if this will choke the CPU?
I assume you've lowered this value during your tweaking of Airforce Gen, did you notice a slowdown effect?

Cheers,
Lord Akkrand

Edited by Akkrand, 02 September 2004 - 05:15 AM.


#9 Lion

Lion
  • New Members
  • 50 posts

Posted 02 September 2004 - 03:11 PM

No i haven’t touched it yet, i am doing it in a couple of days as planne din my AI schedule of things to do (had it in plans for months now).. im still figuring out what makes the AI run slow...
so far teams seem to be the greatest barrier to AI performance, and id take a guess its path finding... USA generals have about twice the performance of china generals and round about half as many units in a given time...
the priority system will most probably enter the calculation as well, as it works more with more units (it has to figure out what are the distances to more units). However i imagine it works like this:
every x ms (specified in the AIData.ini) the AI will measure the distance to ALL units/structures/objects in the map. then it will use its priorities to check if they are in range and then pick a target with the highest score
a simple algorithm could be used for that job:
if target distance > max priority x decay then remove from possible targets
however i bet the EA ai doesn’t get the max prio and just does it for every single prio (taking up about 12 times more cpu power wooo)
once it has a target list it goes after the one with the highest score:
priorityxdecay - distance

i think then doing more accurate priorities will not result in any slowdown, or very little if so as the high cpu intensice thing would be measuring all target distances (xyz coords of unit - xyz coords of target) for every single unit once every 2 frames (for my AI anyways)

Just about all AI scripters in this forum from this post do seem to think scripts you pick in worldbuilder are cpu intensive, but they forget we are in the GHZ era and these extremely simple algorithms are solved quickly and easily compared to complex calculations like path finding and target selection.

i raised every single non vital script delay between executions (90% of them) to one second instead of a frame, so that would give me a great difference in performance right? after its like its checking 26 times less scripts! Well WRONG, i barely noticed any performance change, surely under 50%, at first, and then completely unnoticeable in mid late game...

now this is all speculation and guess, so you’ve been warned!
It might be the AI wont consider targets outside its prio range (but it obviously must as it needs to se how far the unit is before ignoring it)

so as computers should do big maths just as fast as small maths (two extra digits should be no problem to the 64 bit engines out there) there should be just about NO performance hit if im right...
you could try that out and tell me!

my plans are to just half or maybe a quarter of the decay. its sure accurate enough for me!
The hard job is having faster target update without killing the CPU, as its so necessary for say Air-to-air combat (migs only get his like on my AI's half of the map, when it should be on their half)

hope this helps but i wont take responsibility if you do what you said and it goes slow or goes out of control and tries to take over the world, even though im 99% positive on this (and i dont exaggerate, yes im completely sure but no proof)

You have been warned

Leon

Edited by Lion, 02 September 2004 - 03:14 PM.


#10 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 02 September 2004 - 03:40 PM

I did a bit of research into this field earlier on..

I deactivated the "Attack wave" folder and noticed a 100% increase in performance. Now, lets visualize this:

1. Attack teams wait for the launch attack flag to go to true.

2. Launch attack flag goes to TRUE - ALL attack teams in queue will be set to attack - most likely using the method and formula lion posted above.

3. Because of 2., probably the most CPU consuming tasks are performed at the same frame.

Now, what would happen if you implement a mechanism that somehow spreads this massive assault onto more frames? Could it be that this single frame computation is causing a lot of the lag?
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#11 Lion

Lion
  • New Members
  • 50 posts

Posted 02 September 2004 - 04:38 PM

I did a bit of research into this field earlier on..

I deactivated the "Attack wave" folder and noticed a 100% increase in performance. Now, lets visualize this:

1. Attack teams wait for the launch attack flag to go to true.

2. Launch attack flag goes to TRUE - ALL attack teams in queue will be set to attack - most likely using the method and formula lion posted above.

3. Because of 2., probably the most CPU consuming tasks are performed at the same frame.

Now, what would happen if you implement a mechanism that somehow spreads this massive assault onto more frames? Could it be that this single frame computation is causing a lot of the lag?

<{POST_SNAPBACK}>


well once the AI is set to attack (hunt) its searching for targets all of the time so id guess the performance would still be low if the attack was distributed onto many frames. If it was all in one frame the game would freeze for a while whenever an attack was launched and then resume with normal performance... A single frame lag would be just that, a freeze.
I think it has to do with the number of AI units in the game(when i hack the AOD maps for 2x more enemies on hard the lag becomes unbearable with 200+ units at the same time later on

The extra performance is understandable as units wont be hunting/searching for targets anymore

the attack wave system was crap, unreliable, predictable, vulnerable to gen powers, had units getting owned en-route and overall boring.. that was the reason i got it out as soon as i could from my AFG

Edited by Lion, 02 September 2004 - 04:39 PM.


#12 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 02 September 2004 - 06:51 PM

the attack wave system was crap, unreliable, predictable, vulnerable to gen powers, had units getting owned en-route and overall boring.. that was the reason i got it out as soon as i could from my AFG


Wait wait wait... you've got a new attack system? Splendid it sounds! Can you tell me more about it... well actually I could import your SkirmishScripts.scb and look at it myself + write a tut..
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#13 Lion

Lion
  • New Members
  • 50 posts

Posted 02 September 2004 - 07:10 PM

There are millions of ways it can be done...
You can create timers to randomize attack wave times, you can trigger conditions (once force counter reaches a value it will attack), you can just skip the flag that initiates attack and have units attack when ready, you can send in a combined assault of generals powers and then trigger the attack flag like (or trigger attack first so gen powers hit right when forces arrive).. you can make a random attack path chooser for every team etc etc etc
i could be here all night.. attacking is by far one of the areas that allow most variation, setting it to work with predefined timers on predefined locations is one of the most stupid things ever... i KNOW that the EA's AI is going to attack every 40 seconds so i count that and send in a carpet bombing to hit on the 39th second right in front of his comm center and down he goes...

no one keeps millions of people at base like that lol its too vulnerable
Im changing the attack procedures on all generals im going to edit (so far AFG done)

Edited by Lion, 02 September 2004 - 07:13 PM.


#14 Akkrand

Akkrand
  • New Members
  • 61 posts
  • Location:Melbourne, Australia

Posted 03 September 2004 - 12:04 AM

Yes I have been thinking about doing something along these lines. I still do have the attack waves, but their timers are randomized by +-10% or so.
I've also changed my Dynamic Paths thing again so it chooses the best path, but there is also a flag for 'second best'. When a team that is going to attack in the wave is created, it adds 1 to a counter. If the number of teams goes over a certain number, they get split between the two entrances, otherwise they all go with the best option.
I'm not sure if this will work well or not, it sure prevents the teams from bunching up as much and becoming Aurora Alpha/Commanche RP targets, but against a human I've always thought that hitting them in 2 places at once forces them to split their attention, making it harder to micromanange the battle. Of course, they may be so absorbed by whichever hits first that they don't notice the other group hitting someplace else.
Of course, if their defences are up to the task, it is of little value. And i may set a simple flag, if Player <This Player's Enemy> is not <Local Player> (and hence another computer player), to not bother; another computer won't get distracted, attack force better in strength against a comp.

Back to the other discussion (cpu power), I will try lowering the priority multiplier, and to make the test plain obvious for me (and make it easier to do the maths in the priority lists) I'm gonna set it from 100 to 1, and multiply all the priorities by 100.
Also, I've got into the habit of disabling/enabling scripts when they're not in/in use, to save CPU... haven't noticed any gains whatsoever, and that's with disabling entire swathes of the base building scripts, CT scripts, build condition scripts, upgrade scripts, etc.

Whew. Long post. Guess I don't want to start working... its 10am, the boss will pop around soon... gtg :(

Cheers,
Lord Akkrand

#15 Lion

Lion
  • New Members
  • 50 posts

Posted 03 September 2004 - 01:18 AM

Disabling normal WB scripts will save bug all cpu power (the reason why im not bothered about their number or check rate anymore)...
Worry about the number of units, these DO take a lot of cpu power to work...
So the obvious thing to do it have lots of cripts making the units smarter and less units as each unit will kick butt harder!
And to play agaisnt humans, it depends what kind of humans... im designing my AI with pros in mind (such as myself.. well i aint THAT good like tactical, zeo or kurvio but damn i kick butt in quickmatches!) so that the AI will play like one or play well AGAINST one...
Unfortunately most people arent very good players so i have to consider they will use lots of base defenses and superweapons for example (making me build stealth planes and artillery).
Id reccomend you to use as many scripts as you want as they wont take too much cpu, units will however, so make them smart!


PS: i just had a party and i cant say im sober, if i said something innapropriate ill fix it tomorrow! (dont think im a drunkard :grin:)

Edited by Lion, 03 September 2004 - 01:21 AM.


#16 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 03 September 2004 - 08:32 AM

lol nope it was all within reasonable limits :grin:

I've noticed that the ZH AI lags CONSIDERABLY more than the vanilla gen AI.
I don't think this is due to the presence of more units - I've had a game in vanilla gen without lag where me and someone else killed around 10,000 (!) units altogether.

Maybe a good bit of the lag is due to some of the scripts that the teams constantly evaluate? But we ruled that out already...hmm.. there must be a logical reason why vanilla gen is faster than ZH !

Maybe they have edited the vanilla gen AI internal AI engine for ZH and made the hunt command more intensive. That's my best bet.
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#17 Lion

Lion
  • New Members
  • 50 posts

Posted 03 September 2004 - 11:18 AM

Well as i said, all that stuff is pure speculation...
Since normal scripts that run every frame dont seem to take up much CPU id guess team ones wouldnt either...
I know for a fact that maps liek twilight flame not only screw pathfinding up, but its the laggiest map ive ever played with an AI on...
About that game you killed 10,000 units (lol is that even possible? there aint enough resources for the AI to harvest/produce in a reasonable timeframe), it should be ok if there arent many units ALIVE at the same time, once theyre dead they take just about no cpu time...

China gens seem to lag the most to me

#18 Mithril

Mithril

    496

  • Hosted
  • 1,386 posts
  • Location:UK
  • Projects:Heh! You're not going to ask me that question.

Posted 03 September 2004 - 01:05 PM

About that game you killed 10,000 units (lol is that even possible? there aint enough resources for the AI to harvest/produce in a reasonable timeframe),

<{POST_SNAPBACK}>


Yup that's possible, each of us killed about 5000+- units, should have a screenshot of that game on my other HD which is faaar away..(the distance from the UK to the holy roman realm).

The answer is that we cheated a bit - we gave the AI lots of money (INI modification - the black market got $1000 instead of $20, the hackers $1000 too, etc.)


It looks like we are able to isolate that the majority of the lag in ZH is caused by the vast number of units\teams and their commands, specifically path finding. We are not really able to change that.. we could set every team's attitude to sleep and just let them drive around the map (the AutoAcquireEnemiesWhenIdle = Yes should make them attack) but this would be ineffective as hell, and they wouldn''t attack structures. This would allow us to check if this is the actual cause of the lag, however.
Command & Conquer: Red Alert - ReGeneration

"Not the faintest clue =\"

-ComradeJ

#19 Lion

Lion
  • New Members
  • 50 posts

Posted 03 September 2004 - 03:17 PM

Ahh hacking the hackers explains it :grin:
we can just change the pathfinding distance and behaviour, set it to 1 unit and make units do enemy checks every 10 seconds instead of every 34 ms... it would be a definite answer on what causes lag...
Setting that would take like 20 seconds but Im working on some other stuff ATM, when i get the time ill reduce both pathfinding and enemy checks and see if they are the things causing lag...




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users