Friday, April 13, 2012

AI for new Faction? (FA)

[:1]Ello. I have been working on a new Expansion for FA, and it has a new faction. Its all working, except when the New faction ACU is spawned, it just stands there and does nothing...
Anyone got an idea on what to do?|||your gonna have to get sorians, aand read his readme pal on how to add the ai for each of your units..|||I don't think what Domino says is needed. That is only true for new individual units belonging to one of the 4 stock factions, not for a whole new faction.
You're gonna have to edit a bunch of files that contain unit blueprint ID's and add the ones for your faction. It's a whole lot of work but if you do it right the AI playing your faction works nicely. The ACU starts building stuff, engineers roll from the factory, etc.
This is how it's done in Nomads. There is one major problem in Nomads though, after about 3 to 8 minutes (depending on AI, Sorian = 3, regular = 8) the game crashes. I think this is the point where the AI starts upgrading a mex. I don't know any other faction mod that got the AI working so I can't say this is a bug in Nomads or that it's an FA bug.|||Thats the problem though, I dont even know which files to edit, and what I need to change... T_T|||Here's a list of files that I remember changing for the AI. Since the Nomad AI isn't "perfect" (see prev post) I'm not sure this list is complete, but it's a start.
- all files in \lua\AI\PlatoonTemplates
- FactoryBuilderManager.lua in \lua\sim
- aibrainPlans.lua, basetemplates.lua, BuildingTemplates.lua, platoontemplates.lua in \lua
Another tip; use a text editor with a good search function in it that lets you search in files. Then have it search for "seraphim" (not case sensitive). Check each result to see if you need to add something for your own faction. Keep in mind that sometimes factions are not refered to by their name (UEF, Aeon, etc) but by the number as the factions are defined in the factions table, in factions.lua. This means that your faction could be '5', the Seraphim are '4' and the UEF are '1'. You could try to search for references to these numbers aswell...|||By the way, changing the mentioned files might not work well with Sorian and Duncanes AI's. Test whether it works with all custom made AI's disabled. Once you got it working it's time to see if you can get it working with Sorians and Duncanes AI's.|||I made the alterations to the mentioned files. Problem is, When they get used, the game crashes right away X-x I am pretty sure I did the files right, but apparently not X-x|||So start over, test a handful of changes at a time, and watch the log, so you know what's causing problems.|||Sounds like the same problem I'm having with Nomads... If you find a sollution let me know! ;-)
So far I didn't really mind about the AI not working, there are other areas to do first. I'll dig into it later, maybe then I can get it working fully.|||Mithy, in my case there is nothing useful in the log. Even having the game write to a log file gives no result. The next step is to put a lot of LOG()-s throughout the AI system but like I said I haven't done that yet and I won't dig into it any time very soon.|||Poo, I need to find the solution, and get the AI fully functional before I can release =o Wheres Sorian when ya need him? XD|||Hi,
The Problem might not be related to the AI code itself..
we all know that i found the bug that crashed 4dc..
this was caused by AI games... however the error was not in the AI itself..
when human players were playing with 4dc with no ai the game would not crash..
but with an ai the game would crash when units get to t3 level... or just after to be exact.. there was no inidication at all in any logs...
The problem was actually a units script calling a function that doesnt exist..
this is what crashed the game for the AI, as soon as this rogue unit script function call was commented out, no more crashing, its something to check in all your units scripts.. that they are not calling something that doesnt exist.
it may well be another error.. but this is what it was for 4dc.|||Domino|||Hi,
brandon007|||I completely forgot about that issue you had with 4DC. Nice to see you fixed it! It must have been some strange function call if the game didn't throw out an error that says function xyz doesn't exist. Can you elaborate a bit?

No comments:

Post a Comment