Wuyeh Posted April 17, 2021 Report Share Posted April 17, 2021 Hello, we are working on a project to simulate fighting between two armies using the 0AD engine. We have a challenge getting started. Specifically, after creating our mod, we don't know what code to add and/or change to achieve our goal. Any tutorials or tips would be helpful. 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted April 17, 2021 Report Share Posted April 17, 2021 Are you looking to add organized "battalion"-style combat? Quote Link to comment Share on other sites More sharing options...
azayrahmad Posted April 18, 2021 Report Share Posted April 18, 2021 Perhaps you want to be more specific on what changes do you want implemented exactly. Generally, you'd probably be interested in https://trac.wildfiregames.com/wiki/Modding_Guide for beginners. https://trac.wildfiregames.com/wiki/Mod_Layout#simulation is probably what you want to be focused on, but you can read it entirely to get a gist on how 0AD code is organized. Quote Link to comment Share on other sites More sharing options...
Auron24015 Posted April 18, 2021 Report Share Posted April 18, 2021 14 hours ago, wowgetoffyourcellphone said: Are you looking to add organized "battalion"-style combat? You can't have a battalion without a cohort! 1 1 Quote Link to comment Share on other sites More sharing options...
Wuyeh Posted April 20, 2021 Author Report Share Posted April 20, 2021 On 17/04/2021 at 10:51 PM, wowgetoffyourcellphone said: Are you looking to add organized "battalion"-style combat? Yes. How can we do this in the Game ? Quote Link to comment Share on other sites More sharing options...
Wuyeh Posted April 20, 2021 Author Report Share Posted April 20, 2021 On 18/04/2021 at 5:48 AM, azayrahmad said: Perhaps you want to be more specific on what changes do you want implemented exactly. Generally, you'd probably be interested in https://trac.wildfiregames.com/wiki/Modding_Guide for beginners. https://trac.wildfiregames.com/wiki/Mod_Layout#simulation is probably what you want to be focused on, but you can read it entirely to get a gist on how 0AD code is organized. We've taken a look at this and able to set up a mod and view it in the Game under "Mod Selection" but we found the simulation part overwhelming. If we want to move units in the game, for instance, where should be looking at and what should we add to the mod we created? Quote Link to comment Share on other sites More sharing options...
Wuyeh Posted April 20, 2021 Author Report Share Posted April 20, 2021 On 18/04/2021 at 1:10 PM, Auron24015 said: You can't have a battalion without a cohort! What is a cohort? Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted April 20, 2021 Report Share Posted April 20, 2021 53 minutes ago, Wuyeh said: What is a cohort? A "cohort" is essentially a battalion or company for Romans. 1 Quote Link to comment Share on other sites More sharing options...
Auron24015 Posted April 20, 2021 Report Share Posted April 20, 2021 (edited) 2 hours ago, Wuyeh said: What is a cohort? Specifically the cohort system was such: (not literally, mistakes are certain) It was a Operation system between Divisions. Say, you would have a 5by5, then 4 more 5by5's north and south in a square. Like so: AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA It was the key to Romes Success. They had 100x supremacy because they were 100% more Organized. Everyone else just shoved all their infantry into one big line and said "charge" or "lock shields" (or point pointy larrissa in Alexanders case) The system is still used today by the great nations. Obviously with different names. The Individual A being an infantry unit, and the AAAAA being the group. The advantage of this system is that when the front line is tired/breaking they can fall back and get some rest and the second line can go forward to replace them. And vice/versa. Edited April 20, 2021 by Auron24015 Quote Link to comment Share on other sites More sharing options...
azayrahmad Posted April 20, 2021 Report Share Posted April 20, 2021 3 hours ago, Wuyeh said: We've taken a look at this and able to set up a mod and view it in the Game under "Mod Selection" but we found the simulation part overwhelming. If we want to move units in the game, for instance, where should be looking at and what should we add to the mod we created? Well, in this game we're supposed to move the units ourselves. But if you mean how to change how AI behaves, you probably want to look at ai/petra inside simulation. When you play single player against computer, you're fighting this Petra ai. Does this answers your question? Quote Link to comment Share on other sites More sharing options...
Grapjas Posted April 20, 2021 Report Share Posted April 20, 2021 Hi @Wuyeh and welcome to the forum, To manually make units do tasks like move and attack (without AI) you might want to look into the UnitAI component. To spawn units you might want to look inside TriggerHelper. 4 hours ago, Wuyeh said: but we found the simulation part overwhelming Thats how it started for the most of us, at least for me . Do you have javascript knowledge? I'm asking so that we know how discriptive we need to be when explaining stuff. Quote Link to comment Share on other sites More sharing options...
Wuyeh Posted April 20, 2021 Author Report Share Posted April 20, 2021 Yes, I have some Javascript experience. Thanks for the quick response by the way. Really appreciate all the support so far. 1 Quote Link to comment Share on other sites More sharing options...
Stan` Posted April 20, 2021 Report Share Posted April 20, 2021 You can look at https://code.wildfiregames.com/D2175 too Quote Link to comment Share on other sites More sharing options...
Wuyeh Posted April 21, 2021 Author Report Share Posted April 21, 2021 Where in the 0AD engine code can we move a soldier/civilian from one point to another? Quote Link to comment Share on other sites More sharing options...
Stan` Posted April 21, 2021 Report Share Posted April 21, 2021 16 minutes ago, Wuyeh said: Where in the 0AD engine code can we move a soldier/civilian from one point to another? Commands.js / Unit_action.js? Quote Link to comment Share on other sites More sharing options...
Grapjas Posted April 21, 2021 Report Share Posted April 21, 2021 (edited) 1 hour ago, Wuyeh said: Where in the 0AD engine code can we move a soldier/civilian from one point to another? You could use this function from Triggerhelper to get the entity ID of the unit you would want to move. Make that entity the system entity like so: let cmpUnitAI = Engine.QueryInterface(putEntityIDHere, IID_UnitAI); Check line 5294 of UnitAI.js. You can call that function like so: cmpUnitAI.Walk(x, z, queued, pushFront); If you want to move multiple id's you would have to use loops and if statements. You can also learn alot from other maps, 2 maps are prime examples that spawn and move armies by code which are Danubius and Jebel Barkal (more experienced modders, feel free to correct me) Edited April 21, 2021 by Grapjas Quote Link to comment Share on other sites More sharing options...
Wuyeh Posted April 21, 2021 Author Report Share Posted April 21, 2021 Thanks for the responses! I am checking these out. 1 Quote Link to comment Share on other sites More sharing options...
Grapjas Posted April 21, 2021 Report Share Posted April 21, 2021 1 minute ago, Wuyeh said: Thanks for the responses! I am checking these out. Please check my edit of the previous post. 1 Quote Link to comment Share on other sites More sharing options...
Wuyeh Posted April 24, 2021 Author Report Share Posted April 24, 2021 Thanks for the responses! I appreciate all the support. My issue is now resolved. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.