Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Fri Apr 19, 2024 2:27 am
All times are UTC + 0
Multiple refineries and the AI problem
Moderators: Global Moderators, Tiberian Sun Moderators
Post new topic   Reply to topic Page 1 of 1 [2 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Tue Feb 02, 2010 5:00 pm    Post subject:  Multiple refineries and the AI problem Reply with quote  Mark this post and the followings unread

OK so I've got working seperate harvesters for each side now, and the AI builds them correctly ( see the later posts in this thread: http://www.ppmsite.com/forum/viewtopic.php?t=26162 ).

But I've got another problem with making seperate refineries for each side, so that the FreeUnit key will give the correct harvester for each side. From what I've been able to gather, the AI will look for the first building in BuildRefinery= list that the side he is playing owns. For example an AI playing Nod will correctly look for the Nod owned refinery included in the list. However some time into the game, some AI players seem to force themselves to build the very 1st entry in the list, regardless wether they are listed as owners of it and if they already have the normal amount of refineries they are supposed to build (1 for easy AI, 2 for normal, 3 for hard). After they have done this, they will force themselves to build the unit specified in the HarvesterUnit= list (not really a list, it only reads a single value?).

I've been trying to come up with solutions to get rid of this. One of them was to simply make the first entry in BuildRefinery= a building that is owned by civilians, has the keys AIBuildThis=no, BuildLimit=0, Techlevel=-1, prerequisite=CABHUT. Simply every possible key that SHOULD stop the AI from building it. Turns out they still do sometimes build it. And worse yet, for some reason the Nod AI will get really bugged when it builds this refinery, as he starts building other random civilian buildings. I'm not sure why just the Nod AI, and if this is caused by something else in my mod.

Another solution I thought could be giving BuildRefinery= list only one building, owned by all the sides. Then make this building simply invisible, size 0x0, and give it IsLimpetMine=true key so it won't count for base/unit checks when you are losing. Then create 3 new refinery buildings for each side, each being a copy of each other (give them Techlevel=-1 so humans can't build them). The AI will build these instead of the normal refineries. However this solution has the already known problem of harvesters always preferring the refinery stated first in their Dock= list. And it makes a mess of the Dock list anyway, so I wouldn't really want to do this if there was any other solution. Is it possible to make the AI build more than 1 instance of a new building? That would make this solution work since you wouldn't have to make so many copies of the same building.

And lastly you could use the same trick as above, making the first entry in BuildRefinery= owned by all sides, make it 0x0 etc. Then give it AIBuildThis=no, Techlevel=-1 and prerequisite=CABHUT, and put the "real" refineries into the list after this "fake" one. But from my earlier tests if the side the AI is playing is listed as an owner of this "fake" refinery, they will not build more than 1 "real" refinery. Maybe they are trying to build the first entry owned by the side they are playing, and are unable to do so since it has AIBuildThis=no. Anyway I'm still experimenting with this.

As for the AI sometimes building the "default" harvester listed in HarvesterUnit= , I simply got rid of this by making the default harvester into a vehicle that is really not a harvester at all and costs 10 credits. The AI might build one of them, but it is completely harmless. Looks weird in the AI base yeah, but harmless. Any other solutions for this?

Anyway sorry for the long and probably confusing post, but has anyone else got multiple refineries working? From the tutorials I read about this I didn't see people having problems with it? Was it due to lack of testing it thoroughly or is my mod causing this problem somehow?

Back to top
View user's profile Send private message
SuperJoe
Commander


Joined: 03 Sep 2009

PostPosted: Thu Feb 04, 2010 10:27 am    Post subject: Reply with quote  Mark this post and the followings unread

Alright, I got around this problem in a way that is enough for me, but not good enough if you want to have really seperate refineries for all the sides.

As far as I can tell, putting in more than 1 value into BuildRefinery= is asking for trouble. I tried everything I could think off and the AI would always go to a point where it either cheated by building something it wasn't supposed to, didn't build what it was supposed to, or simply stopped building structures / units altogether. Multiple values do seem to work for a while, but at some point SOME of the AI players go crazy and want to build the 1st thing on the list. Ever since I put more than 1 value in the list I had random crashes with the Nod AI, and now that I only have 1 value in it the crashes have stopped. If someone has tried to get multiple values working here I'd be interested to hear what came out of it.

Anyway what I did to get past AI getting access to harvester it's not supposed to was to create a new refinery that only the AI can build. The refinery does not come with a free harvester, but it only costs 1000. I put only this refinery to the BuildRefinery= list. All the sides are listed as the owner of it. As for the "normal" refineries that each side get, I put in the key AIBuildThis=yes. Now the AI will build a mix of both the AI only refineries and the real refineries (1+1 for easy AI, 2+1 for medium, 3+1 for hard). I tested it quite alot, destroying all the refineries from the AI. It would always build them back correctly, and there weren't any weird problems.

The only thing with this is the AI will not get harvesters very early into the match (since they only get one of them from the single real refinery) unless you tweak a few other keys. I'll explain these below. All this assumes that you have different harvesters for each side of course, and the proper AI triggers and scripts to make them work (see the link in the previous post).

Code:

UseMinDefenseRule=no


This should be set as No, so the AI will build extra harvesters as soon as it has a warfactory. Otherwise it will try to build defensive teams first.

Code:

MinimumAIDefensiveTeams=1,1,1 ; was 4,3,2


These should be put low for the same reason as above, so the AI will prefer to build up harvesters right away at the beginning of the match and replace them as soon as possible when they are lost.

Not a fix for multiple different refineries, but a working solution for side specific harvesters with shared refineries.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.1477s ][ Queries: 11 (0.0085s) ][ Debug on ]