Jump to content
Sign in to follow this  
H4mster

Walrus AI mod (Steam Only for now)

Recommended Posts

This is a continuation of a discussion from another thread, test results were positive and there is a video (go fullscreen) to show results, its by no means a fix, but does help, to test I set up the walrus to do a route, saved the game, and ran each test from the save so they are all the same, I then sped up the video so it wouldn't bore people too much, so that's 3 tests put into one video all starting at the same time.

Top left is value 0, tidy formation most of the time, not perfect but a improvement, this is the value in the mod.

Top right is value 0.9, this is default, walrus do not stay in formation.

Bottom left is value 10, even worse than default, very messy.

Download http://www24.zippyshare.com/v/73677849/file.html

unpack and copy the scripts and physics folders to "C:\Program Files (x86)\Steam\steamapps\common\Carrier Command Gaea Mission\"

Press K during game to bring up mod information, this will help you verify its installed.

Added Carrier AI mod because it was never released as a file and works really well.

Credits to Tontow for suggesting a low value, and Thygrr for making his modding tool, also Disorder and Deanolium.

Edited by H4mster

Share this post


Link to post
Share on other sites

I'm familiar with that particular island map, and that's an impressive result. Going to give it a try, nice job :D

Share this post


Link to post
Share on other sites

I created a .pak file for me, but I'm not sure if it works.

Guys, will I have to make a directory structure: scripts\ai\walrusvehfight.h and then drag the scripts folder onto thygrrrs package.bat? Or do I start at ai folder level?

Because: I've packed scripts\ai\walrusvehfight.h - then put it as the next number (patch03.pak) into my CC folder, started a new game for testing, and sent all walrusses to a command center, and they went pretty crazy again.

Share this post


Link to post
Share on other sites

Just ran a test of this script pack on the same island you used H4mster (Medusa). Went from the bottom to the top of that climb with hardly a hitch. And for the real test, when they reached the base at the top, I told them all to 'dock' and let them figure it out. It was nearly a flawless return, aside from one walrus that slid off a cliff and insisted on trying to climb back up to its waypoint. Big improvement here, good work!

Share this post


Link to post
Share on other sites

My concern is, if value 0 is suitable for all maps or only that map enviroment (island). Did anyone else tested this on another islands with much different enviroment ?

Share this post


Link to post
Share on other sites

I think the reason they have that code, the meh good enough code, is because the walrus could not find the exact point at the last dot. Notice on the 0 screen how the last walrus did not stop moveing?

So what we need to do is find the destanation dot and see how close you are, if you are closer than a few meters then use a value of 0.9 . IE: your there, your close enough, stop moveing and wasting fuel.

This is proof that 0.9 is too much room for error, but....

I wonder what 0.1 would do to it? Or even 0.01 ?

Share this post


Link to post
Share on other sites

OK I think I have it working for the sprocket version and I tested from a fixed savegame. I must say the walrusses went very straight to the target, without going crazy. Whereas without the patch, they went crazy pretty often. Looks very good and effective so far!

Share this post


Link to post
Share on other sites
I think the reason they have that code, the meh good enough code, is because the walrus could not find the exact point at the last dot. Notice on the 0 screen how the last walrus did not stop moveing?

So what we need to do is find the destanation dot and see how close you are, if you are closer than a few meters then use a value of 0.9 . IE: your there, your close enough, stop moveing and wasting fuel.

This is proof that 0.9 is too much room for error, but....

I wonder what 0.1 would do to it? Or even 0.01 ?

Very good point, some testing to do, hopefully we can fix the walrus more, I'm not a great coder, more luck than skill, but the good coders here can maybe take it further.

Also if anyone wants to pack this mod for the retail versions then be my guest, drop in the link and I'll add it to the first post, maybe foxhound can add the retail mod to carriercommandaholic site too.

Share this post


Link to post
Share on other sites

For Retail/Sprocket.

I packed the folder: WalrusAi\scripts\ai\walrusvehfight.h - I hope this is correct. Result was WalrusAi.pak

I used the first File upload service I found without need to sign up...

http://www.filepup.net/files/12gtPI1350921904.html

People rename the file to the next patch0<n>.pak according to their last patch*.pak... ascending.

Share this post


Link to post
Share on other sites

Hey what about cc files in my game folder? Do i need to make the mod into a .pak or .cc? Sorry was a bit confused in getting mods to work in general.

I tried repacking the whole data02.cc into a file with the same name and I think I broke something as the barque would no longer dock with me. I will retry a pak file and see if it works.

Share this post


Link to post
Share on other sites

I added the Carrier AI mod because that was just text you c&p, it works really well when fighting the enemy carrier.

Also added credits, if you press K during game some info will display in red in the centre of the screen, this will help to see if installation worked.

Download from first post.

Tontow, I tried 0.001, 0.01 and 0.1, no noticeable difference, I'm now looking for stuff to turn the walrus faster.

Share this post


Link to post
Share on other sites

I made some adjustments to material traction (friction settings) and to carrier aggressiveness, I'm not sure of the Walrus responsiveness over various terrain yet but I increased and decreased a few friction values (gravel is up, slime and lava down). I hope it's working but needs further testing.

Here is a copy of the mod so far.

http://www20.zippyshare.com/v/72554065/file.html

Perhaps we should combine all general tweaks into a mini mod

Finally H4mster, Don't forget the dot setting is in all 4 of the walrusxfight files. I think it actually stands for "direction of target" all the dot stuff is to do with distance to target and orientation.

Edited by disorder

Share this post


Link to post
Share on other sites
I made some adjustments to material traction (friction settings) and to carrier aggressiveness, I'm not sure of the Walrus responsiveness over various terrain yet but I increased and decreased a few friction values (gravel is up, slime and lava down). I hope it's working but needs further testing.

Here is a copy of the mod so far.

http://www20.zippyshare.com/v/72554065/file.html

Perhaps we should combine all general tweaks into a mini mod

Finally H4mster, Don't forget the dot setting is in all 4 of the walrusxfight files. I think it actually stands for "direction of target" all the dot stuff is to do with distance to target and orientation.

Ok thx, I never thought of looking elsewhere, extra grip should help loads.

It so difficult to tell if the tweeks have any effect, so I'll do some more multiscreen video tests, its the only I can think of.

Share this post


Link to post
Share on other sites

I turned to grip up to 10 for everything, if you go forward + steer + boost you tip over there is so much grip, they turn much better.

Added all the stuff and tested (see video), download from 1st post, remarked and credited everyone, dont forget to press K to see credits/test mod is installed.

Share this post


Link to post
Share on other sites

Looks great - will try it later at home.. question though - does the walrus handle exactly the same way on all terrain? I understand it's bad as it is now in pathfinding and this may be our quick fix until the official patch, but am hoping this mod will keep the "feel" of driving over different terrain.

Share this post


Link to post
Share on other sites

Lol that's funny. Was that super high friction setting in the xml?

I still think the change you made to dot < 0 is not working for general pathfinding. You have to see that the game uses a random algorithm that gets nearest based on current direction (based on vectors and orientation) so no two tests will be the same.

If you want to get definitive results you really have to run the 2 tests multiple times and on 2 seperate PCs. Then average all the times for all 4 units to stop at the target.

Edited by disorder

Share this post


Link to post
Share on other sites
Lol that's funny. Was that super high friction setting in the xml?

I still think the change you made to dot < 0 is not working for general pathfinding. You have to see that the game uses a random algorithm that gets nearest based on current direction (based on vectors and orientation) so no two tests will be the same.

If you want to get definitive results you really have to run the 2 tests multiple times and on 2 seperate PCs. Then average all the times for all 4 units to stop at the target.

Yeah I just ramped everything in the materials file to 10, its fun to flip the walrus.

The dot > 0 just makes the walrus more accurate when turning, the extra grip helps them turn faster, they left the stock AI standing but they still get stuck in confined spaces, until BI do their proper patch it gives us something to mess around with and learn while waiting for carriertools, walrus racing should be a new sport.

Just need horsepower tweak, 200mph walrus next :p

OTT (Over the Top) is nothing compared to H4mster Hax.

Edited by H4mster

Share this post


Link to post
Share on other sites
I think it actually stands for "direction of target" all the dot stuff is to do with distance to target and orientation.

I rather think it means that they've overloaded the "*" operator for the two normalized vectors to produce a "DOT product". If the two are normalized, then the result should be between -1 and 1. 0.9 would refer to 25 degrees (if I'm right).

http://en.wikipedia.org/wiki/Dot_product

Share this post


Link to post
Share on other sites
I rather think it means that they've overloaded the "*" operator for the two normalized vectors to produce a "DOT product". If the two are normalized, then the result should be between -1 and 1. 0.9 would refer to 25 degrees (if I'm right).

http://en.wikipedia.org/wiki/Dot_product

Um yeah it could well be that. Since I've only done limited programming and not even in this language. I've never done 3d vector calculating stuff it was a bit confusing, but a good learning experience.

Since walrusvehfight is the only thing being adjusted in the mod, this is only 1 part of the walrus AI when it is attacking a vehicle. I don't understand how this can lead to better driving since it only triggers in a battle and not from point A to B

Check out the new tweaked mod, I left them as loose files for now. The grip feels just right and you can even climb rocks with it.

DOWNLOAD http://www11.zippyshare.com/v/16204399/file.html

carrier_2012_10_24_10_53_36_217.png

carrier_2012_10_24_10_58_03_120.png

As you can see I climbed a volcano.. just a normal day at the office :D

Edited by disorder

Share this post


Link to post
Share on other sites
Um yeah it could well be that. Since I've only done limited programming and not even in this language. I've never done 3d vector calculating stuff it was a bit confusing, but a good learning experience.

Since walrusvehfight is the only thing being adjusted in the mod, this is only 1 part of the walrus AI when it is attacking a vehicle. I don't understand how this can lead to better driving since it only triggers in a battle and not from point A to B

Check out the new tweaked mod, I left them as loose files for now. The grip feels just right and you can even climb rocks with it.

DOWNLOAD http://www11.zippyshare.com/v/16204399/file.html

http://s14.postimage.org/sahbcavhr/carrier_2012_10_24_10_53_36_217.png

http://s7.postimage.org/bafibkweh/carrier_2012_10_24_10_58_03_120.png

As you can see I climbed a volcano.. just a normal day at the office :D

I'll replace the daft one I made with yours, and run a test on another island, this time 2 tests with and without the mod.

Walrus sightseeing mountain tours :)

Edited by H4mster

Share this post


Link to post
Share on other sites

I've run a test: I put in a 'return' at the beginning of that whole function. Like so:-

vector GetMovementTarget()
{
	Object enemy = GetTarget();

	ret = ZeroVec;
	return ret;

Basically, it means that if that function (which has been changed in the mod) is called *at all*, then the walrus will be set to stand still. I've run a few tests, and sure enough, the walrii all come to a screeching halt the moment you target an enemy walrus. All other times, they carry on regardless.

So, I'm afraid to say, that modifying this function only seems to affect the paths when fighting another enemy walrus.

I also modified the WalrusStaticSeq.GetMovementTarget() in the same way, and sure enough, the moment you target an enemy building... The walrus stops dead. So, the ai pathing is going to have to be modified elsewhere, sorry.

Share this post


Link to post
Share on other sites

Maybe the code is ran though once when a island loads and initialises and that value sticks elsewhere, it does seem to have an effect but its not big enough to call a fix.

Share this post


Link to post
Share on other sites

Well done.

This makes me wonder.. does it cost BIS a lot of money to publish a patch? It seems that if there's a relatively simple fix to the AI issues, they could push it in a small patch in a timely manner. If they're waiting for other fixes to be finished to push a larger patch, is it a financial issue or a development process within the company that's driving the decision?

Share this post


Link to post
Share on other sites
Maybe the code is ran though once when a island loads and initialises and that value sticks elsewhere, it does seem to have an effect but its not big enough to call a fix.

I wish that were true, but two things suggest otherwise:

1. The game crashes *on load* when you make a typo in a script, suggesting that the code is evaluated when the game initially starts.

2. I've been able to modify the AI of the walrii during a fight by saving the game in a fight, exiting CCGM and then re-loading CCGM (no island transition needed).

There's a simple test, though. Replace the function body with this:-

             vector GetMovementTarget()
{
	ret = ZeroVec;
	return ret;
}

Which just returns "do nothing" every time. Then, re-run the tests. It would be interesting to see if they stand still when not in a vehicle fight.

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  

×