|
 |
| Author |
Message |
|
Krapougnak
|
Posted: 14 Aug, 2012
|
|
Joined: 21 May, 2008 Posts: 706
|
That is pretty awsome ! A pity no more IA modders are around now ... Duly copied and pasted for further investigation. 
|
|
| Top |
|
 |
|
Domino
|
Posted: 14 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
Hi, Krapougnak wrote: That is pretty awsome ! A pity no more IA modders are around now ... Duly copied and pasted for further investigation.  agreed, that is not any AI modders i know of except sprouto whom are releasing or have released a new AI, what this code and examples basicly do IS ALLOW you to create your own AI, all the hard work regarding getting the units actually built is done, all a modder has to do is what i have done in the last post, create platoons for there AI and add the conditions (step 2 in last post) on when to build these units.. platoons can be a single unit as in the example in the last post or a group of units, there is also another thing that is used, which is to form platoons, this is infact what is used to grab the units once built and tells them what to do, i havent posted anything on this yet, as its not important to getting the units built and how frequent the AI builds them, within the form platoons, you add the PLAN, that you want this platoon to do, this is actually the nuts and bolts of the unit/platoon behaviour, behaviours are upgrade, reclaim, enhance, go here, do this, kill this, look for this, all that stuff, its actually easy getting units/platoons to do stuff once they are built, honestly, just using the 3 function tools/tables ive described here is all it takes to create an AI, some level of logic is involved in the actual templates to get a good balance though, quite honestly, this is as good and as easy as it gets, to adding an AI, using 100% of your own platoons, or existing platoons, some asked a few posts back about making hydro's upgrade, this task now is actually very easy to accomplish.
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Lt_hawkeye
|
Posted: 14 Aug, 2012
|
|
Joined: 26 Mar, 2007 Posts: 5075 Location: California, United States
|
|
will your method work along side sorian AI and other AI's? because the stock AI's suck regardless and of us being able to force the AI to make our units.
_________________ {◕ ◡ ◕}
|
|
| Top |
|
 |
|
Sprouto
|
Posted: 14 Aug, 2012
|
|
Joined: 26 Feb, 2007 Posts: 336 Location: Toronto
|
|
Getting the AI to build custom units is not all that hard, but it's been a matter of some difficulty in getting the AI to use them effectively - especially if they have unique abilities. The unit categories have a tremendous impact on how they get formed into combat platoons - and as more units are added to your game - the results can be hard to predict. The accepted method of having a CustomUnits folder, works well, but it's limited because it uses a random % chance to build one of the new units instead of one of the existing unit types - and that - is one of the limitations of both the stock and Sorian AIs - the fairly small number of unit 'types' that are available to the Factory Builder. Just as an example, here are the unit 'types' that the present AI understands with regards to T1 land units;
T1LandAA T1LandDFBot T1LandDFTank T1LandArtillery T1LandScout
As you can see, while this is sufficient for standard T1 units - that doesn't leave much flexibility for unique units. The story is similar for T2 and T3 units - while structures and experimentals are even more constricted in some respects. You'll also notice there is no breakdown for amphibious units - and without it, the AI will sometimes build a huge lump of land units on what could be an almost completely water map. That's ok for races like the Aeon who have a good selection of hover/amphibious units, but not so good for others.
While it's easy enough to create more 'types' - each 'type' has to be created in the LandPlatoonTemplates file - and then a Builder has to be entered in the LandAttackBuilders file to have the factories construct those units under certain conditions (like a water map).
At this point, your AI will build the units, but in a somewhat random fashion if they share the same LandPlatoon template as other units.
|
|
| Top |
|
 |
|
Domino
|
Posted: 14 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
Hi, Lt_hawkeye wrote: will your method work along side sorian AI and other AI's? because the stock AI's suck regardless and of us being able to force the AI to make our units. yes, my code works 100% along side sorian AI and other ai mods, i dont think you understand what ive done, ive gone straight to the AI base tables, and allowed modders to now define there own units to be built, the conditions when they are built, how many are built ect ect, i give full control (if you want it) to every aspect of your AI controlled unit, this includes the orders or behaviour your unit does once built, you can use preexisting platoons if you desire (current sorian method) OR you can define your own unique platoons ala my last post on the crystals, if you put your custom unit into an existing platoon name, all the units in this platoon are merged, when the AI wants to build this platoon, it will pick a random unit from the platoon to build, ive taken sorians method into account in this also, so if you use the sorian method for adding units, when an AI wants to build a platoon, i check if sorains code return something if it does i add the returned sorian unit to my table, i then select a random unit from my table for this platoon, simple enough, as sprouto said, he basicly described exactly how sorians implimentation works, it does build the units, but it can sometimes do it ineffiently for mod units, because there entered into an existing platoon, so its very very important using that method to put your units into the proper pre existing platoon name, what i give you is 100% full control over every aspect of AI modding, off the back of my examples, you can create your own 100% unique AI, what you have to understand is how the AI works, they basicly work in configurations or blocks, what is built with one AI does not mean every AI will build those type of platoons, this is why i added the global tag mentioned in a previous posts, so you can easly "inject" your new platoon and builders into ever AI, so they will be built and used when using ANY AI, here is how the works. we choose the AI type in the lobby, the game loads and then loads the AI choosen from the lobby, the AI choosen is a table which just contains the buildergroups (step 2 from my last post) and some other info. the buildergroups contains the builders which in turn contains the platoons (step 1 from my last post) and thats it, the builder contains the conditions which defines how frequent the units are built and ofcourse what unit is built. we control what the units do once built with other platoons, set up a little differently, these platoons have a plan param, the plan is basicly the order name, like reclaim, scout, attack, the factionsquads param will contain categories OR a categories.unitid, if you want this plan to only effect a single unit. these plan platoons, are also entered into the AI as a buildergroup table. buildergroups can contain as many builder entries as you want, so we define different builergroups that do different things for different types of unit. every builder table has a priority, this priority defines the order in which these builders are constructed and used. i added support so we can ammend/change the existing platoons, buildergroups and builders tables, so you can change anything in regard to the existing AIs settings. thats basicly it in a nut shell,
_________________ Domino. ______________
|
|
| Top |
|
 |
|
BulletMagnet
|
Posted: 14 Aug, 2012
|
|
Joined: 05 Oct, 2007 Posts: 16426 Location: camping near the biggest power-up
|
|
I don't understand 95% of what you code. This is one of them.
_________________
Nephylim wrote: But, an FA army in an FA environment just looks... right. Does anyone know how to use air transports? I cant get them to pick up troops.
|
|
| Top |
|
 |
|
Domino
|
Posted: 14 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
|
prolly because you have never seen this stuff before.. i do tend to work on complex things.
in the examples ive posted i havent changed any default code, its all default structure.
have a look in AI/platoontemplates, /AIBuilders .lua, you will see exactly what i mean.
_________________ Domino. ______________
|
|
| Top |
|
 |
|
brandon007
|
Posted: 15 Aug, 2012
|
|
Joined: 16 Jan, 2010 Posts: 2908 Location: Draconis VII
|
|
Hang on D, Doesnt the new version of my mod do this kinda stuff?
|
|
| Top |
|
 |
|
Domino
|
Posted: 15 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
|
what kinda stuff?
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Domino
|
Posted: 15 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
Hi, here is another re-run of the crystals, for better building.. i already added the platoon data for the t1,2,3 crystals, here is the buildergroup code. http://pastebin.com/pmKb0rhEso the respective tech engineer will build its tech level cystal at the bases, but only if there isnt 2 already there.. and the econ can support them. it will also build them adjacent to factories, here is a quick video showing built crystals after the game ends. http://youtu.be/eS7dHlDlQCothis is very cool stuff.. it could kick start a whole new era of AI's, if modders take it on board and start doing this stuff them selves, you can taylor the AI to your own liking for percific units to do percific things.
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Domino
|
Posted: 15 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
Hi, and ofcourse the upgrade info required to make the AI upgrade the units to t2 and t3 really only need t1 > t2 and t2 > t3, however in my haste i added all 3, t3 doesnt upgrade http://pastebin.com/DAPxKpZdboom, focus crystals that are built, around the base (but not to many) then they will upgrade when appropriate... 
_________________ Domino. ______________
|
|
| Top |
|
 |
|
kirahirasai
|
Posted: 15 Aug, 2012
|
|
Joined: 30 Dec, 2010 Posts: 49 Location: Germany
|
First: Incredible work, Domino. That makes it a lot easier to add your own platoons, without altering the original platoon file by merging. I had a look on the ai files and it´s quite easy to understand, when you know, what is going on behind the scenes. Basicly we have the builders, the template of units (platoon) and the behaviour code, which is a checklist for the ai, what it should do. I think we could improve the way the AI works greatly, but I think we have to create new functions (checkboxes). Soo good luck with the further development of the code 
_________________ the signature is currently not available...
|
|
| Top |
|
 |
|
Domino
|
Posted: 15 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
Hi, kirahirasai wrote: First: Incredible work, Domino. That makes it a lot easier to add your own platoons, without altering the original platoon file by merging. I had a look on the ai files and it´s quite easy to understand, when you know, what is going on behind the scenes. Basicly we have the builders, the template of units (platoon) and the behaviour code, which is a checklist for the ai, what it should do. I think we could improve the way the AI works greatly, but I think we have to create new functions (checkboxes). Soo good luck with the further development of the code  Indeed, im glad you looked and understand how its all put together, when its laid out like i have done in previous posts it becomes very easy to understand the structure of what is needed, it becomes very easy to make these AI units do things, once i knew what i was doing making these crystals buildable and upgradable by the AI took maybe 10 mins to get it all working, there are plenty of existing builder templates to pick and choose and learn from.. adding 3rd party conditions looks very easy, sorian added many new ones for his AI's, the good thing about this is that, its all sim code, so once you break down the platoon into units, you can call unit functions from the units scripts ect with in the AI code, like they do with enhance, upgrade, turn on intel ect, this means, we can make these AI's even smarter, with help of DMS and its global unit tables, which contain tons of info regarding the unit in question which will help alot with custom conditions. quite honestly this will change the whole game IF modders start making there own AI builders and make the AI do some cool things with there units.
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Sprouto
|
Posted: 15 Aug, 2012
|
|
Joined: 26 Feb, 2007 Posts: 336 Location: Toronto
|
|
It's always satisfying to see your own work in action - no matter if it's a new unit, a new map or a new behaviour with the AI. The trick with making a smarter AI is not really the units, or the platoons and what they do - but in making the AI 'map smart' and 'situation smart' - and then applying those smarts to what the AI builds and does.
Perhaps the most progressive change in the AI code was Sorians' Strategy Manager code (which was sadly turned off in later releases) which attempted to control the AI's choice of unit and platoon building based upon certain overall conditions.
|
|
| Top |
|
 |
|
Domino
|
Posted: 15 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
Hi, forgot to say also a VERY important part of all this new AI stuff, its all configured from your mods folders, you no longer need to pack any AI code into an scd, just put it all in /mods/your mods name/lua/AI/folderand ofcourse a hook of platoon.lua and AIBehaviours.lua for new behaviours ect. 
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Domino
|
Posted: 15 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
|
code is 99% done, it 100% works with sorian AI with no incompatabilities at all..
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Lexxy
|
Posted: 18 Aug, 2012
|
|
Joined: 13 May, 2007 Posts: 5
|
|
Hi Domino,
First of all, great work.
Just wanted to let you know that I also join those who are eager to see the screen scrolling issue resolved so I can run 4DC. Sadly have had to switch this off for now after upgrading from an old version.
Will be watching this thread for your updates!
Once again, great job here. Thank you for your efforts.
-Lexxy.
|
|
| Top |
|
 |
|
RAZORLIGHT
|
Posted: 19 Aug, 2012
|
|
Joined: 15 May, 2007 Posts: 178 Location: Bavaria, Germany
|
scrolling still dont work 
|
|
| Top |
|
 |
|
brandon007
|
Posted: 19 Aug, 2012
|
|
Joined: 16 Jan, 2010 Posts: 2908 Location: Draconis VII
|
For crying out loud people. He has the fix. He will release it when its ready. 
|
|
| Top |
|
 |
|
Krapougnak
|
Posted: 19 Aug, 2012
|
|
Joined: 21 May, 2008 Posts: 706
|
|
Hi, bug report
the stealth and cloak enhancement of the Cybran ACU and SACU aren't working, once you enhance them they just don't work. Nothing in the log.
On the other hand the scout gets cloak and stealth when he is supposed to be cloaked only.
|
|
| Top |
|
 |
|
Checkmate
|
Posted: 19 Aug, 2012
|
|
Joined: 02 Aug, 2012 Posts: 13
|
Krapougnak wrote: Hi, bug report
the stealth and cloak enhancement of the Cybran ACU and SACU aren't working, once you enhance them they just don't work. Nothing in the log.
On the other hand the scout gets cloak and stealth when he is supposed to be cloaked only. I actually noticed this too when using 4DC I believe, and I thought that it was caused by the leech and virus fields. I tried ejecting the enhancement for the SCU's but the button in the UI still remained.
|
|
| Top |
|
 |
|
Domino
|
Posted: 21 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
Hi, ive not released an update yet, it will come soon, indeed scrolling is fixed, both edge scrolling and arrow scrolling now works in any split, although edge scrolling (mouse to edge of screen) will only work if in full screen (single view mode) arrow keys will scroll any view the mouse is currently in, i also incorperated the speed sliders params into the speed, so it works as normal, you can adjust the scroll speed via the options menu like normal. just fixed the cybran problems with cloak and stealth, this was an absolute biatch to find, i just didnt understand why only these units were not enabling those intels. turns out it was a simple error in DMS intle systems, a while back i added cloakstealth to one of the 4dc units, this custom intel type is actually called cloaksteath, in the intel code when an intel is disabled a variable is set on the unit, its either 1 or 0, when i did the cloakstealth code, i hard coded the switching off of the intels and forgot to remove this param.. so instead of having, Code: local AlsoDisable = self:GetIntelTypeParams(intel).disableintels or {} for intelType, param in AlsoDisable do if param then if not IsPowerOut then oldUnit.DisableUnitIntel(self, intelType) end self:SetUnitSubTableParam('Trash', 'PowerOutIntels', intelType, nil, false, false) end end i actually had, Code: local AlsoDisable = self:GetIntelTypeParams('CloakStealth').disableintels or {} for intelType, param in AlsoDisable do if param then if not IsPowerOut then oldUnit.DisableUnitIntel(self, intelType) end self:SetUnitSubTableParam('Trash', 'PowerOutIntels', intelType, nil, false, false) end end this in effect when ANY intel was disable it also disable the CloakStealth intels, which in turn pushed the unit param from 1 to 2 to 3 ect, for cloak and stealth intels, intels are only ENABLED if the param is 0 and DISABLED if the param is 1, because i was resetting them disabled the number increased by 1 for each intel the unit disabled, obvioulsy the units in question disable cloak and stealth onstopbeingbuilt so there numbers ended up increasing because they had cloak stealth set to disable at this time. suffice to say it is now fixed and works as normal. sorry about that. like i say, im just basicly, checking this AI code i recently added, and going over other things, before i release... i want all this stuff working 100% before i release anything. i guess i could put up the betas today, ya ill do that.. thx for the reports. 
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Domino
|
Posted: 21 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
|
Updated the OP with the beta version.
this version contains all the fixed mentioned so far and a few other things.
be sure to check it out.
questions?
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Domino
|
Posted: 21 Aug, 2012
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
Hi, This is just an example mod, http://www.mediafire.com/?jb4b19bvpt7n670it basicly demonstrates that its now possible with DMS, to create your own AI, which are useable from mod folders and not scd's in the mod is a fully working standard AI, the mod will show up in the mod manager and the AI in the lobby, from this you can assertain that its possible to create your own platoons, buildergroups and create an AI out of these 2 tables.. if your an AI modder or interested in playing the AI this would go along way in helping you learn how to achieve AI related things, if you want the AI to build your units or build more of them, or apply a specail behaviour to a unit, DMS will help you do all of this, i just made it a little easier to do anything AI related. there is a small incompatility with sorians Lobby mod, in that if the mod is deselected and you then return to the lobby to start a new game the AI is still available in the game slots as a playable AI, a full game restart is needed to remove the AI from the slots, however if sorians lobby mod isnt in your game data folder, when the mod is not used the AI's are no longer chooseable, if you choose an AI when the AI mod is unloaded, it will still work.. its something and nothing so dont worry about it.. i just thought id make you aware of this problem, its not a script error, its an incompatability because of the way sorian hooked the lobby code,
_________________ Domino. ______________
|
|
| Top |
|
 |
|
Krapougnak
|
Posted: 21 Aug, 2012
|
|
Joined: 21 May, 2008 Posts: 706
|
Thanks... twice. 
|
|
| Top |
|
 |
 |
 |
|