Jump to content

Recommended Posts

EDIT: I Reinstalled Blender, and the skeleton imported properly now. Must have been a setting I tweaked when I used blender awhile back. Point is, it works!

8wAGmHv.jpg

Thank you so much for your help and this tutorial. I think I'm convinced to port to 0AD, now that I can bring in my animations without much hassle.

 

A small question though, since 0AD uses props that you can attach to models and I plan on tweaking me weapons to be attachments: Do the weapons have to be skinned to the joints they shown up on, or are they just placed at 0,0,0 and locked on the joint defined the xml file?

Can props have their own skeletons? For example if I wanted a flowing cape, would the unit have to have a skeleton with the cape or could the cape have it's own separate skeleton?

Edited by The Undying Nephalim

Share this post


Link to post
Share on other sites

No they don't have to be skinned. To see how you have to place your weapon just import one from the game.

Yes you can animate pretty much everything. There are animated capes in 0ad.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, stanislas69 said:

No they don't have to be skinned. To see how you have to place your weapon just import one from the game.

Yes you can animate pretty much everything. There are animated capes in 0ad.

Very awesome, I'm liking this engine more and more. It seems so much more modder friendly than Medieval 2.

I have a string of questions I'd like to ask, just so I can gauge what is and what isn't possible in the engine before I start porting over rosters of units from the TW version of the mod. Any answers are greatly appreciated:

Spoiler

 

1) Is it possible for a ranged attack to spawn a new unit upon impact? Ideally, could it be made to have a random chance of spawning as opposed to 100% of the time? I have some siege weapons that launch units at enemies and over walls, this would be really handy if possible.

2) Is it possible to interact with corpses of dead soldiers in any way? There are a lot of undead in Hyrule, and being able to raise undead from fallen enemies would be great. In addition, units being able to "eat" corpses in order to regenerate health would be great.

3) Is anything like knockback possible in the engine? For example a smaller unit is attacked by a much large unit and they are tossed back a distance or pushed? Triggering animations would be great, but not necessary.

4) Is there anything such as lighting units on fire from flame attacks?

5) Is it possible for an attack to stun a unit and prevent it from moving for a time? Even better, spawning a 3D model or sprite effect on the stunned unit until it wears off?

6) It is possible to attach an animated sprite (such as fire) to a joint like a weapon or shield currently is?

7) Can units and buildings be set to regenerate health at all times or when they are not in combat?

8) Is it possible to give units a second health bar that can regenerate? Think Protoss Shields from Starcraft.

9) Is multi-target (not splash damage) attacks possible? For instance a projectile hits an enemy and then bounces to the nearest enemy, or multiple projectiles that attack multiple targets.

10) Adding new resources seems very possible, but is it possible for specific resources to only show up for specific civs instead of all civs?

11) Can melee attacks be set to have extended reach, such as with pikes?

12) Is it possible to make it so that a unit has a chance to "dodge" attacks or rather avoid taking any damage from an attack? 
Alternatively, is it possible to make it so enemy units also take damage from attacking certain units?

13) Can buildings be set to heal units, either one by one or everything in it's radius?

14) Is it possible for an ability that heals all units over time within a player's territory?

15) It is possible for all of the terrain withing a player's territory to be replaced with new terrain or a decal?

16) Can buildings and units spawn more units on death?

17) Can melee attacks deal aoe or splash damage?

18) Can it be made so that certain wild animals can only be captured by certain civs and not others? Say I want Civ A to be able to capture chickens, but Civ B can't capture chickens.

19) Is it possible to make it so certain units can move over or climb walls? The best example I can think of are the Goblins from BFME2

20) Is it possible for the worker units of a player to be uncontrollable and the AI automatically makes them seek out the nearest resources?

21) Can units explode on death, dealing damage to everything around them?

22) Can a unit gain health from attacking an enemy unit?

23) Can a building be set to immediately spawn 1 or more units just as it finishes being built by a worker?

24) Can a unit generate resources from attacking enemy buildings?

25) Can workers pray or otherwise interact with a building in order to generate resources, like in Age of Mythology?

26) Can a building be set to immediately destroy or knock down all trees within a certain radius of itself?

27) Are there any targetable abilities (I've not noticed any on my playthroughs yet)? For example a unit has a Fireball ability. You click the ability, select a target, and your unit launches a fireball at the target.

28) Sort of tied to the last question, can units be given an ability that allows them to teleport? If so, can it be limited to only the player's territory?

29) Is it possible to decrease enemy units' line of sight when they are in a player's territory? What about slowing down their movement speed, attack rate, or other negative de-buffs?

31) Can a unit be given a small chance to deal an extremely large amount of damage, simulating something such as a Critical Hit?

32) Is it possible to make it so that a unit instantly spawns at a building's rally point, rather than from the building and then they move to the rally point?

33) Can units return a dead unit back to life before the corpse vanishes? Could a unit "repair" a dead unit back to life, such as the Atlantean Automatons from Age of Mythology?

34) Can a unit use a ranged attack while moving?

 

 

Share this post


Link to post
Share on other sites

1)    It’s possible, but it hasn’t been coded I think.
2)    Corpses are by default made unelectable, but I think that might be overridable. Not sure if C++ or simple template editing
3)    Not yet, there are tickets about it but it hasn’t been implemented yet.
4)    It’s doable but not implemented.
5)    Same codable adding a component such as stunnable, which adds a particle effect to the unit, and set their move speed to 0 or trigger a flag that would prevent them for moving.
6)    Yes, just add a particle props, see the blacksmith building for instance.
7)    Yeah, there is a tech that does that, you could auto research it.
8)    It has been done for capturing, so it would have been somewhat an extent of that, then again it’s not natively supported
9)    I’m not sure but I think towers can do that not the bouncing though
10)    Adding new resources is possible, Wowgetoffyourcellphone, and MuteLovestone did it. Restricting it to civs, I don’t know
11)    You can define the range of the attacks
12)    You’d have to add a new component for dodging. Maybe an aura could do the trick but I’m not sure
13)    See current implementation of temple auras
14)    If you set the aura radius to be the size of the territory it could work, but won’t be precise
15)    You can only add decals to buildings (as props), so if it is big enough, it could do what you want.
16)    You need an extra js component to do that.
17)    Not yet, but there is a patch
18)    This would require change to how capturing works but it could be done
19)    This requires changes to the pathfinder, I’m not sure it can be done as is
20)    I’m not sure.
21)    This is planned, not sure the ticket has been issued
22)    Same as being dealt damage when attacking special unit, it has to be in attack.js, or in another component
23)    Tweaking a component could do the trick, and it could be mutualized with the spawn unit on death.
24)    Might work by adding resources to a building, but I’m pretty sure that isn’t that easy
25)    Needs a new component, but it could be done
26)    I think you could set a building to ignore trees obstruction, but I think that requires pathfinder changes.
27)    No I don’t think it’s implemented. There is a patch for multiple attacks somewhere, you could also make your unit upgrade to a new one that casts fireballs and then somehow on the first attack make it upgrade back. Nice way would be to add another type of attack
28)    Would maybe work with a special component, not sure.
29)    Every debuff can be achieved through auras
30)    
31)    Needs change to the attack.js file
32)    Not sure, but I guess that’s related to 28
33)    Could be done but it’s not implemented. Adding repairable to a unit, and making it so it collapses from let say 10% of the health, could work
34)    That’s the purpose of ticket #2577 which I was never able to finish.
 

  • Like 1

Share this post


Link to post
Share on other sites

That's pretty awesome that a majority of these seem possible.

Another question, is it possible to scale the size of a model and animation in an xml file?
Say I have two units that use a Biped skeleton, but on is three times larger. Can I just simply scale up the skeleton in an xml, or will I have to import animations that have been scaled up in blender?
 

8 hours ago, stanislas69 said:

27)    No I don’t think it’s implemented. There is a patch for multiple attacks somewhere, you could also make your unit upgrade to a new one that casts fireballs and then somehow on the first attack make it upgrade back. Nice way would be to add another type of attack

So what you are saying is Unit A switches to Unit B, which has a different attack, and then is forced to somehow switch back to unit A? Maybe a hidden ability that causes the unit to switch back when a timer goes off? I'm not familiar enough with abilities to know if things like auto count down timers work or not.

Share this post


Link to post
Share on other sites

1) Is it possible for a ranged attack to spawn a new unit upon impact? Ideally, could it be made to have a random chance of spawning as opposed to 100% of the time? I have some siege weapons that launch units at enemies and over walls, this would be really handy if possible.


Needs a small amount of code. This is related to the other damage tickets (which by now provide a relatively nice basis for this) #1909 #1910 #1911 #1912, which are being worked on by a contributor, so having a user for a few of those things will help with getting this written.


2) Is it possible to interact with corpses of dead soldiers in any way? There are a lot of undead in Hyrule, and being able to raise undead from fallen enemies would be great. In addition, units being able to "eat" corpses in order to regenerate health would be great.
33) Can units return a dead unit back to life before the corpse vanishes? Could a unit "repair" a dead unit back to life, such as the Atlantean Automatons from Age of Mythology?



2) Corpses are by default made unelectable, but I think that might be overridable. Not sure if C++ or simple template editing
33) Could be done but it’s not implemented. Adding repairable to a unit, and making it so it collapses from let say 10% of the health, could work


Ah, #2951 paying off. You just have to change what a corpse is. Corpses are "corpse|template" template names, which means the special corpse filter (the file named corpse.xml) in templates/special_filter defines what happens with the original template. So to make them selectable just add

<Selectable merge=""/>


to that template.

For repairing/raising them from the dead you could take some inspiration from the foundation template and play with the initial health in addition to some health decay (negative regeneration or something).
For eating this sounds like something that was done at some point in the past, however that code was more of a quick hack to get it working and might need some updates to actually work. Also it has the limitation of preventing those units from gathering at all, possibly more limitations it has been a while.


8) Is it possible to give units a second health bar that can regenerate? Think Protoss Shields from Starcraft.



8) It has been done for capturing, so it would have been somewhat an extent of that, then again it’s not natively supported


Adding another bar is easy. Having some shield should also be somewhat easy if the health component does check if that is present and first does damage to the shield and only afterwards decreases health.


9) Is multi-target (not splash damage) attacks possible? For instance a projectile hits an enemy and then bounces to the nearest enemy, or multiple projectiles that attack multiple targets.


For just firing multiple projectiles that is what buildings and ships do. But the code that does that is somewhat hacky. So currently doable by using workarounds. Projectile bouncing would need code.


10) Adding new resources seems very possible, but is it possible for specific resources to only show up for specific civs instead of all civs?


If showing up for specific civs means just them being able to gather it, then yes, just don't specify any other resources in those ResourceGatherer tags for that civ.


12) Is it possible to make it so that a unit has a chance to "dodge" attacks or rather avoid taking any damage from an attack?
Alternatively, is it possible to make it so enemy units also take damage from attacking certain units?
22) Can a unit gain health from attacking an enemy unit?


If we care just about not taking damage this could be doable by modifying cmpDamageReceiver to just ignore a few attacks randomly.
Or we modify it to also get some information about who is causing the damage, which would allow some more fine grained possibilities, then implement a custom cmpDamageReceiver (eg cmpDodgingArmour or something) and use that for those dodging units.
With that slight modification to the DamageReceiver interface to pass the attacker information along another implementation can just do a few fancy things: attack back (though one would have to directly reduce the health, else two such units fighting with each other might cause strange issues), something vampire style, etc.


14) Is it possible for an ability that heals all units over time within a player's territory?


With a little code, yes.


15) It is possible for all of the terrain withing a player's territory to be replaced with new terrain or a decal?


I guess one could place actors there that have some decal based on territory. That seems like a somewhat strange approach, however currently there is no (or maybe no nice) way to set the terrain texture.


16) Can buildings and units spawn more units on death?


There's cmpHealth's SpawnEntityOnDeath. That's just for a single unit though.


20) Is it possible for the worker units of a player to be uncontrollable and the AI automatically makes them seek out the nearest resources?


In some way, but it would most likely run into lots of issues and be a bad experience.


24) Can a unit generate resources from attacking enemy buildings?


There is a Loot component that in conjunction with the Looter component does something when an entity is destroyed, though that isn't quite what you asked for.


25) Can workers pray or otherwise interact with a building in order to generate resources, like in Age of Mythology?


Delenda Est might have a hacky way to do something like that. A nice implementation might need some work.


26) Can a building be set to immediately destroy or knock down all trees within a certain radius of itself?


Could be done with a trigger and a range query. So not right now but the code for that (apart from figuring out how to nicely hook that to the rest) should be quite simple.


27) Are there any targetable abilities (I've not noticed any on my playthroughs yet)? For example a unit has a Fireball ability. You click the ability, select a target, and your unit launches a fireball at the target.


One of the early patches that added healing worked like that. So it depends on what abilities you'd want, and if actually having buttons for those is the best way (which it might be if there are a few).


28) Sort of tied to the last question, can units be given an ability that allows them to teleport? If so, can it be limited to only the player's territory?


if (cmpTerritoryManager.GetOwner(pos.x, pos.z) == cmpOwnership.GetOwner())
   cmpPosition.JumpTo(pos.x, pos.z)


Or something along those lines, and with proper checks for conditions that should be handled.


29) Is it possible to decrease enemy units' line of sight when they are in a player's territory? What about slowing down their movement speed, attack rate, or other negative de-buffs?


There currently are no auras based on territory, if that gets added this should be quite easy, for now you might have to make do with range auras on territory roots.


32) Is it possible to make it so that a unit instantly spawns at a building's rally point, rather than from the building and then they move to the rally point?


Should be a roughly 3 line diff, maybe slightly more to make that behaviour changeable based on templates.

  • Like 2

Share this post


Link to post
Share on other sites

Thank you for some more answers! Seems like almost everything I want is possible in some way.

To specify one bit: 

1 hour ago, leper said:

If showing up for specific civs means just them being able to gather it, then yes, just don't specify any other resources in those ResourceGatherer tags for that civ.


I mean showing up in the UI at the top left. Say I want faction A to have a Gold resource but faction B to not have any Gold, I don't want the Gold icon or numbers to show up in the top left. Is this at all possible in the engine?

 

Share this post


Link to post
Share on other sites
4 hours ago, leper said:
Quote


25) Can workers pray or otherwise interact with a building in order to generate resources, like in Age of Mythology?


Delenda Est might have a hacky way to do something like that. A nice implementation might need some work.

Well, in that case, all mods be a little hacky. ;) Although, I will pat myself on the back here and say that the way Glory works by praying at statues is quite ingenious in using the engine how it currently is to make something like that possible. In short, you just make the unit's capacity for that resource 1, and then make that statue a dropsite for that resource only. In practice, it looks instant when the "resource" is dropped off. You don't even see the resource show up as 1 in the UI, it just gets immediately dumped to the dropsite, the statue the unit is already at. So, in this way, praying for Favor at Temples, ala Age of Mythology, is already 100% possible in the game's engine as-is. In fact, all ways possible to gain Favor in Age of Mythology are already possible in 0 A.D.'s engine. I do all 3 for Glory. Praying at statues -- Greek Favor; Killing enemy units -- Norse Favor; Statue trickle -- Egyptian Favor. One could easily make an Age of Myhtology mod for 0 A.D. right now. The only major problems would be some UI stuff and the God Powers.

Edited by wowgetoffyourcellphone
  • Like 4

Share this post


Link to post
Share on other sites

I like the idea of different resources, you can see with Precolumbian faction their gold is the Cacao seed. 

Mayas gathering cacao instead of iron. Or collecting gold.

  • Like 1

Share this post


Link to post
Share on other sites

Another question, how does one change the background images on the main menu? This is the closest I got to figuring it out, "sprite": "background-hellenes1-1" in a json file.

 

1 hour ago, wowgetoffyourcellphone said:

Killing enemy units -- Norse Favor

So it would be possible for units to gain resources from attacking buildings, but only when the building is destroyed?

Share this post


Link to post
Share on other sites
1 hour ago, Lion.Kanzen said:

I like the idea of different resources, you can see with Precolumbian faction their gold is the Cacao seed. 

Mayas gathering cacao instead of iron. Or collecting gold.

Or gather obsidian in place of metal?

Share this post


Link to post
Share on other sites
24 minutes ago, The Undying Nephalim said:

So it would be possible for units to gain resources from attacking buildings, but only when the building is destroyed?

Right now, only when it dies. Though, there may be some promise with the way XP is gained, which is damage inflicted each strike divided into the XP available for the target structure -- or target unit. XP is quite different from a standard resource though, so @elexis or @leper will have to tell you how hard it is to mod.

Share this post


Link to post
Share on other sites
Just now, wowgetoffyourcellphone said:

Or gather obsidian in place of metal?

Yes. Is complicated jade is important for them.

indian (Mauryans )  can gathering diamonds?

Share this post


Link to post
Share on other sites
17 hours ago, The Undying Nephalim said:

I mean showing up in the UI at the top left. Say I want faction A to have a Gold resource but faction B to not have any Gold, I don't want the Gold icon or numbers to show up in the top left. Is this at all possible in the engine?

That's some gui coding that should be relatively easy to do. Currently it isn't supported, but that is because so far nobody wanted different resources there. It might also need a few checks in the engine related to tributing resources, and possibly looting things. @s0600204 might be interested in improving the resource modding support even more.

14 hours ago, wowgetoffyourcellphone said:

Well, in that case, all mods be a little hacky. ;)

But hacky solutions do have a tendency to break, I guess I don't need to tell you that. So striving for proper code does help with reducing the maintenance work going forward.

  • Like 5

Share this post


Link to post
Share on other sites

It seems in skirmish mode that game tries to replace the starting units I have defined with pre-set ones (4 workers, 4 soldiers, etc) 

Is there any way to disable this? I want my factions to start with specific units  that I define in their json files, and not be forced to use civ_support_female_citizen naming conventions. My factions are going to have radically different styles of workers, so being forced to use the civ_support_female_citizen convention will not do.

All my stuff shows up just fine in Atlas, just seems like Skirmish mode force-replaces the stuff I want factions to start with.

Share this post


Link to post
Share on other sites

The starting entities are just used in random maps. Skirmish maps use preplaced skirmish entities that get replaced by civ specific units. The generic replacements (including {civ} handling which replaces that with the civ code) is done in the skirmish templates (simulation/templates/skirmish/), and different replacements are specified in the civ.json files under SkirmishReplacements.

So I assume you might want to provide a different version of the skirmish templates (in case you want to be incompatible with the 0ad civs right now), or provide lots of replacements in the civ.json files. Assuming you don't want to follow the naming convention the game uses (which I guess is a sensible choice).

Share this post


Link to post
Share on other sites
36 minutes ago, leper said:

The starting entities are just used in random maps. Skirmish maps use preplaced skirmish entities that get replaced by civ specific units. The generic replacements (including {civ} handling which replaces that with the civ code) is done in the skirmish templates (simulation/templates/skirmish/), and different replacements are specified in the civ.json files under SkirmishReplacements.

So I assume you might want to provide a different version of the skirmish templates (in case you want to be incompatible with the 0ad civs right now), or provide lots of replacements in the civ.json files. Assuming you don't want to follow the naming convention the game uses (which I guess is a sensible choice).

I'm guessing this is the section in the civ json file?

    "SkirmishReplacements":
    {
        "units/hylian/hylian_citizen" : "units/hylian/hylian_citizen",
        "skirmish/units/default_cavalry" : "units/rome_cavalry_spearman_b",
        "skirmish/units/default_infantry_melee_b": "units/rome_infantry_swordsman_b",
        "skirmish/structures/default_house_10" : "structures/{civ}_house"
    },

Does Count work here like in other areas of the json file? Or if I wanted more of the same unit I'd just make copies like so:

    "SkirmishReplacements":
    {
        "units/hylian/hylian_citizen" : "units/hylian/hylian_citizen",
        "skirmish/units/default_cavalry" : "units/rome_cavalry_spearman_b",
        "skirmish/units/default_infantry_melee_b": "units/rome_infantry_swordsman_b",
        "skirmish/units/default_infantry_melee_b": "units/rome_infantry_swordsman_b",
        "skirmish/units/default_infantry_melee_b": "units/rome_infantry_swordsman_b",
        "skirmish/structures/default_house_10" : "structures/{civ}_house"
    },

 

Edited by The Undying Nephalim

Share this post


Link to post
Share on other sites

Yes, that's the section.

No, count does not work there, same as your proposal. This is an object or well set, so multiple definitions of the same key ("skirmish/units/default_infantry_melee_b") are either invalid or at the very least pointless since just one of them applies (depending on the parser the first or the last one).

If you want more units you will have to add other skirmish entities to the maps, and then just replace them with nothing for the civs that don't get extra units. Or we have to find a way to spawn units when a unit is spawned (I seem to recall someone running into issues with that and there is some ticket I wanted to look into related to that).

Share this post


Link to post
Share on other sites

However for reasons of sanity I guess you don't want

"units/hylian/hylian_citizen" : "units/hylian/hylian_citizen",


there, but rather something like

"skirmish/units/default_citizen" : "units/hylian/hylian_citizen",


where you'd need to create that skirmish/units/default_citizen template. Or keep the skirmish entities that currently exist and just replace them with what you want (might not work perfectly given what quantities you want though).

Share this post


Link to post
Share on other sites
16 minutes ago, leper said:


there, but rather something like


"skirmish/units/default_citizen" : "units/hylian/hylian_citizen",

 

It ended up being default_support_female_citizen, but yup it works! That's actually a pretty nice workaround for spawning faction specific units without having to place them on skirmish maps in Atlas.

Share this post


Link to post
Share on other sites
8 hours ago, The Undying Nephalim said:

Well I figure out how to get the main menu animations to work, check it out:

https://www.dropbox.com/s/n4b4r6wggoxg4u7/HyruleConquestMenu2.mp4?dl=0

Looking good!

BTW from the video it looks you are using alpha21 (~6 months old). I'd suggest using the latest SVN code, see https://trac.wildfiregames.com/wiki/BuildInstructions , so that you can always be synced with the latest improvements.

  • Like 4

Share this post


Link to post
Share on other sites

Another question I had asked but didn't get an answer to, is it possible to scale the size of a model and animation in an xml file?
Say I have two units that use a Biped skeleton, but one is three times larger. Can I just simply scale up the skeleton in an xml, or will I have to import animations that have been scaled up in blender?

8 hours ago, fabio said:

Looking good!

BTW from the video it looks you are using alpha21 (~6 months old). I'd suggest using the latest SVN code, see https://trac.wildfiregames.com/wiki/BuildInstructions , so that you can always be synced with the latest improvements.

Thanks I might look into that. For now I might stick with stables builds.

Share this post


Link to post
Share on other sites

Well some bad news, I downloaded the new version of 0AD and it pretty much broke all the work I've done. My main menu is frozen with tons of errors. I'm also locked out and cant disable the mod or exit the game, I have to end the process:

Spoiler

orFiqyu.jpg

I had gotten a new faction to work and everything, but it looks like the new version of 0AD has really messed around with some templates:

A9cYlxn.jpg

Edited by The Undying Nephalim

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×