MoLAoS Posted September 4, 2021 Report Share Posted September 4, 2021 One thing I have in my version of Glest is a requirement system that is very open. You can require resources, items, buildings, units, techs, etc for the production of something. It is implemented as vectors of points or pointers + ints. So I can require an arbitrary number of techs or items. I implement building components as items since Glest derivatives don't have any sort of mesh/model updating like adding a tower to a model. I can set any number of buildings as requirements as well. Can I manage this in the JS files for Pyrogenesis. I read a thread that has posts a few years old saying you can't use more than one upgrade as a requirement, has that changed? Quote Link to comment Share on other sites More sharing options...
happyconcepts Posted September 4, 2021 Report Share Posted September 4, 2021 (edited) Greetings @MoLAoS. I ve been told by management to go away but if it helps you ... Resources defined in /resources.js are used to make buildings and units. But then you need to adjust the UI to show your new resources to the player. This was as of version alpha 23b at least. Edited September 4, 2021 by happyconcepts Tag OP Quote Link to comment Share on other sites More sharing options...
MoLAoS Posted September 4, 2021 Author Report Share Posted September 4, 2021 3 minutes ago, happyconcepts said: Greetings @MoLAoS. I ve been told by management to go away but if it helps you ... Resources defined in /resources.js are used to make buildings and units. But then you need to adjust the UI to show your new resources to the player. This was as of version alpha 23b at least. @happyconcepts This is resources like wood/stone/metal/food or does it handle techs and buildings? Quote Link to comment Share on other sites More sharing options...
happyconcepts Posted September 4, 2021 Report Share Posted September 4, 2021 wood stone metal food are defined in resources.js and apply universally. The techs are in another folder and also support faction-specific technologies too. So in my mod the Dutch have a mercantile tech upgrade whereas the French get a different one. Technologies can be defined as a pair so that the player is able to utilize only one or the other but not both. Buildings are just like units, requiring food metal etc. or whatever else you add to resources. Here look at the files on github.. /simulation/data/ on github Quote Link to comment Share on other sites More sharing options...
happyconcepts Posted September 4, 2021 Report Share Posted September 4, 2021 @MoLAoS hey how can I get involved with glest? Im not an artist but anything else goes Quote Link to comment Share on other sites More sharing options...
happyconcepts Posted September 4, 2021 Report Share Posted September 4, 2021 37 minutes ago, MoLAoS said: you can't use more than one upgrade as a requirement, has that changed? n/c its same afaik. Quote Link to comment Share on other sites More sharing options...
MoLAoS Posted September 4, 2021 Author Report Share Posted September 4, 2021 1 minute ago, happyconcepts said: @MoLAoS hey how can I get involved with glest? Im not an artist but anything else goes Glest, Glest Advanced Engine, and Mandate(my fork) are functionally dead. MegaGlest is still somewhat active, though less so than 0AD. You can google megaglest forums or something to find the discussion. 4 minutes ago, happyconcepts said: wood stone metal food are defined in resources.js and apply universally. The techs are in another folder and also support faction-specific technologies too. So in my mod the Dutch have a mercantile tech upgrade whereas the French get a different one. Technologies can be defined as a pair so that the player is able to utilize only one or the other but not both. Buildings are just like units, requiring food metal etc. or whatever else you add to resources. Here look at the files on github.. /simulation/data/ on github So in the identity.js file there is a line: "<optional>" + "<element name='RequiredTechnology' a:help='Optional name of a technology which must be researched before the entity can be produced.'>" + "<text/>" + "</element>" + "</optional>" + I'd like to require more than one such tech in some cases. I'd also like to require Units or Buildings, and Items if I get them added. Lib-XML2 plus associated c++ code in Mandate allows me to have something like: <unit-requirements> <unit name="some building1"/> <unit name="some building2"/> </unit-requirements> <upgrade-requirements> <upgrade name="some tech1"/> <upgrade name="some tech2"/> <upgrade name="some tech3"/> </upgrade-requirements> <item-requirements> <item name="some item1" value="10"/> <item name="some item2" value="5"/> <item name="some item3" value="2"/> <item name="some item4" value="1"/> </item-requirements> <resource-requirements> <resource name="wealth" amount="2000" plus="0" multiply="0"/> <resource name="population" amount="10" plus="0" multiply="0"/> <resource name="logs" amount="50" plus="0" multiply="0"/> <resource name="stone" amount="50" plus="0" multiply="0"/> </resource-requirements> Quote Link to comment Share on other sites More sharing options...
MoLAoS Posted September 4, 2021 Author Report Share Posted September 4, 2021 (edited) @Freagarach @asterix @wowgetoffyourcellphone Is this a valid structure? "<optional>" + "<element name='Requirements' a:help='Optional name of requirements that must be met before the entity can be produced.'>" + "<element name="Technologies">" + "<attribute name='datatype'>" + "<value>tokens</value>" + "</attribute>" + "</element>" + "<element name="Structures">" + "<attribute name='datatype'>" + "<value>tokens</value>" + "</attribute>" + "</element>" + "<element name="Units">" + "<attribute name='datatype'>" + "<value>tokens</value>" + "</attribute>" + "</element>" + "<element name="Items">" + "<attribute name='datatype'>" + "<value>tokens</value>" + "</attribute>" + "</element>" + "<text/>" + "</element>" + "</optional>" + Then the data in the file would be like: <requirements> <technologies> <technology name="some tech1"/> <technology name="some tech2"/> </technologies> <structures> <structure name="some struct1"/> <structure name="some struct2"/> </structures> <units> <unit name="some struct1"/> <unit name="some struct2"/> </units> <items> <item name="some item1" value="10"/> <item name="some item2" value="5"/> <item name="some item3" value="2"/> <item name="some item4" value="1"/> </items> </requirements> Edited September 4, 2021 by MoLAoS 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted September 4, 2021 Report Share Posted September 4, 2021 Your method is definitely easier for modders (and the wfg team if they ever wanted to add more depth to requirements). Right now, modders have to use tricks with player.xml, auto-researched technologies, etc. to give layering to requirements. Having mentioned it, you should look at the xml files in \binaries\data\mods\public\simulation\templates\special\player\. These files define some player and civ specific requirements as well as building/training limits, among a bunch of other things. Quote Link to comment Share on other sites More sharing options...
MoLAoS Posted September 5, 2021 Author Report Share Posted September 5, 2021 I'm putting together the component files in JS to get this to work. Although obviously items will have to wait till they actually exist. I also came across some interesting code for a 0AD version of another feature I added to GAE in my fork. Does the game already have, probably in mods?, a structure that can move units between 2 points, sort of like Nydus Canals in SC1? There was also a load command that allowed any of a set of structures to dump units from another, like a standard portal network. Since my planned mod is a fantasy one I'd really like to have these options. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted September 5, 2021 Report Share Posted September 5, 2021 12 minutes ago, MoLAoS said: I also came across some interesting code for a 0AD version of another feature I added to GAE in my fork. Does the game already have, probably in mods?, a structure that can move units between 2 points, sort of like Nydus Canals in SC1? There was also a load command that allowed any of a set of structures to dump units from another, like a standard portal network. Since my planned mod is a fantasy one I'd really like to have these options. I am not sure about these specific features, but Hyrule:Conquest adds a lot of fantasy features to the 0 A.D. engine, so you should check that mod out. Quote Link to comment Share on other sites More sharing options...
MoLAoS Posted September 5, 2021 Author Report Share Posted September 5, 2021 4 minutes ago, wowgetoffyourcellphone said: I am not sure about these specific features, but Hyrule:Conquest adds a lot of fantasy features to the 0 A.D. engine, so you should check that mod out. Looked at that thread a bit. Won't be super useful probably unless @The Undying Nephalim comes back. They haven't been active for a month or so. Quote Link to comment Share on other sites More sharing options...
Freagarach Posted September 5, 2021 Report Share Posted September 5, 2021 See also https://code.wildfiregames.com/D1731. 5 hours ago, MoLAoS said: Is this a valid structure? It seems so, and it would indeed be cool if you could try and have this included in the main game (i.e. make a diff on Phabricator). Quote Link to comment Share on other sites More sharing options...
MoLAoS Posted September 5, 2021 Author Report Share Posted September 5, 2021 4 minutes ago, Freagarach said: See also https://code.wildfiregames.com/D1731. It seems so, and it would indeed be cool if you could try and have this included in the main game (i.e. make a diff on Phabricator). I'm going to sleep now but I'm going to try and finish stuff tomorrow for detailed testing. What was the main issue with that diff? Did they not finish or not test or was it GUI stuff? Quote Link to comment Share on other sites More sharing options...
Stan` Posted September 5, 2021 Report Share Posted September 5, 2021 See also http://docs.wildfiregames.com/ Quote Link to comment Share on other sites More sharing options...
MoLAoS Posted September 6, 2021 Author Report Share Posted September 6, 2021 (edited) @Stan`@Freagarach Am I correct that entity_id_t is functioning in place of pointers for passing stuff to the javascript? The JS code is really hard to understand because without defined variables I can't often figure out exactly what info I'm returning from queries. Like say I do the query of the units a player has into an array. Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetEntitiesByPlayer(playerID) Suppose I have the pseudocode of: Requirements: vector<Upgrade*+count> Upgrades; vector<Unit*+count> Structures vector<Unit*+count> Units vector<Item*+count> Items Then I load each one from the JSON: // xml/json nonsense to load the 4 vectors vector<string/count> jsonUpgrades; vector<string/count> jsonStructures; vector<string/count> jsonUnits; vector<string/count> jsonItems; for (int j = 0; j < jsonunits.size; ++j) { for(int i = 0; i < world->faction->units.size; ++i) { Unit *check = world->faction->units[i]; if (jsonUnits.string == check.getName) requirements->addUnit(unit/count); } } //repeat for other requirement types In place of unit pointers in my JS vectors/arrays I'd be using the entity ids? Edited September 6, 2021 by MoLAoS Quote Link to comment Share on other sites More sharing options...
Stan` Posted September 6, 2021 Report Share Posted September 6, 2021 entity_id_t is a C++ type designating an entity of the simulation. It's a unique number used to designate an entity; You can query that entity's components by using Engine.QueryInterface(entity, IID_Component) SYSTEM_ENTITY is a special entity_id_t which points to an entity that works kinda like a singleton 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.