Jump to content

To what extent is 0ad moddable ?


Zerbob
 Share

Recommended Posts

Hello !

I've just discovered 0AD, and it really seems a cool project (better than MegaGlest IMHO). I'll probably enjoy this game very much ; all the features that I missed when I played AOE2 as a little kid seem to be in it. :)

I haven't seen much documentation about modding in 0AD, so someone could give me a few generic explanations and tell me where to find existing mods to study that would be kind. I would like to make a DotA mod for 0AD, so that we get a free way of playing DotA (for those who don't know, DotA is a very popular Warcraft III mod).

This would require a few features quite uncommon in AOE-style RTS games, so I'm asking you (the developpers) whether they're currently available, or will be available, and if they're not, whether you (anyone) would like them or not. I don't know wether I should post this here or in the game development forum. Maybe I'll post about it in the development forum later. Of course it would also require new models, because greek soldiers would look quite odd in DotA, but that is not the question.

  • Some way to emulate an experience and level system, like Warcraft III heroes. This would help any RPG mod (e. g. a hack'n slash solo campaign). 0AD already has a promoting system, but it is quite limited for a RPG.
  • Abilities defined through scripting (or XML). This too would help any RPG mod.
  • Items and inventories. By the way, does the interface support "menus" (you click on an ability, and you get a new set of abilities, like the "buildings" button in AOE2) ?
  • Triggers system through scripting. I'm quite sure this has been or will be implemented.
  • Possibility for a unit to walk on impassable terrain (this is like flying at ground level, and I gather flying units are supported so it shouln't be hard to implement).
  • Some way to turn off the "delete" button (or the formations, or the stances, or any command).
  • Custom keyboard shortcuts for abilities, including user-defined ones. This would also be nice for buildings, in "normal" game. It may already exist, I haven't played much yet.
  • Unit "categories" ("hero", "normal", "machine", building" etc.) accessible from the triggers system. This too is very common., and probably already exists.

I can't think of anything else yet, but there's probably more of it. Another point is (but this should definitely go into the developper forum), is it really so bad for performance to have a realistic 3D line of sight ? You don't have to keep trace of all the buildings, just cliffs, rocks and trees, that is things that are already there at the beginning of the game, static stuff. You only need a 2D map of heights, with impassable objects having infinite height. This would be great for modders (to make DotA but also funny mods with mazes or whatever you can imagine) and for games on small maps. I find it really annoying on acropole-style maps when your town gets razed by catapults but it takes you hours to send your troops there because of the cliff, or worse your enemy is waiting down the path, preventing you from going out. On large maps you could turn it off to make scouting less tedious.

Well, those were both questions and suggestions, thank you for your future answers and comments. If anyone wishes to start this project I'm willing to help him, or even if he wants to implement the missing features (though I'm not a great programmer...). If you think they're not consistent with the project's current objectives I'm ready to accept it, too. :unsure:

Link to comment
Share on other sites

  • Some way to emulate an experience and level system, like Warcraft III heroes. This would help any RPG mod (e. g. a hack'n slash solo campaign). 0AD already has a promoting system, but it is quite limited for a RPG.
  • Abilities defined through scripting (or XML). This too would help any RPG mod.
  • Items and inventories.

An RPG mod would be almost completely tangential to 0AD because the game play would differ so much from an RTS, it wouldn't be easy to say the least. Technically, it would be possible. I guess the renderer, GUI, pathfinder, hardware abstractions, component system, etc., could be reused.

By the way, does the interface support "menus" (you click on an ability, and you get a new set of abilities, like the "buildings" button in AOE2) ?

That's possible, we just haven't designed the in-game GUI that way.

Triggers system through scripting. I'm quite sure this has been or will be implemented.

Someone expressed interest in working on this recently. As far as I know, that is planned for scenarios but will maybe have to wait until we iron out the rest of the gameplay.

Possibility for a unit to walk on impassable terrain (this is like flying at ground level, and I gather flying units are supported so it shouln't be hard to implement).

Impassable terrain can be defined fairly easily in passability classes, depending on what you want to do it may require additional changes to the pathfinder.

Some way to turn off the "delete" button (or the formations, or the stances, or any command)

Sure, most of that stuff is scripted so you could even test changes during a game.

Custom keyboard shortcuts for abilities, including user-defined ones. This would also be nice for buildings, in "normal" game. It may already exist, I haven't played much yet.

We've got a hotkey system.

Unit "categories" ("hero", "normal", "machine", building" etc.) accessible from the triggers system. This too is very common., and probably already exists.

That's already there in the entity templates.

Link to comment
Share on other sites

Thank you for your very quick answer. ^^

An RPG mod would be almost completely tangential to 0AD because the game play would differ so much from an RTS, it wouldn't be easy to say the least. Technically, it would be possible. I guess the renderer, GUI, pathfinder, hardware abstractions, component system, etc., could be reused.

I agree that such things as heroes and abilities would require some coding, though not very much, and don't really fit with 'ancient warfare'. Also it could require to redesign a few things (such as the attack and motion system). Maybe it could be included in future expansion packs (scriptable abilities could be used in an AOM-like mod for example), or otherwise in a fork, but it's too early for that.

I had a look at the XML 'entities' and it looks like basic items (with only passive effects) could be supported by "garrisoning" them in the bearer. You could create relics this way. I think it will only need some javascript, and it would be cool for the gameplay. I'll try and test it.

Triggers system through scripting. I'm quite sure this has been or will be implemented.
Someone expressed interest in working on this recently. As far as I know, that is planned for scenarios but will maybe have to wait until we iron out the rest of the gameplay.

Well I'm ready to help for that. It has to be designed first of course. A GUI like Warcraft III's would be nice, too.

I browsed the source (I had not seen all those javascript and xml files in the mod directory) and it looks like all the rest is possible. As for realistic line of sight, it is a broader question, but I really think it would be cool even for normal aoe-like gaming. I'll maybe open a ticket about it.

Link to comment
Share on other sites

is it really so bad for performance to have a realistic 3D line of sight ?

Performance is hard since you probably need to compute LOS for every moving unit (potentially thousands) every turn (currently every 200ms or so). (Actually you have to do it twice, once to cancel the LOS effect from the previous turn and once to apply the new LOS effect from the current turn). The vision range might be ~20 tiles so its area is ~1000 tiles. So that's like ten million tiles processed per turn, most probably involving L2 cache accesses (which is maybe 10 CPU cycles each time) since the maps are quite large, and it can end up being a sizeable chunk of the total CPU cycles. So you generally want to minimise the amount of per-tile work you have to do, and searching for obstacles is probably too expensive. Precomputing data can make it faster, but storing that efficiently is hard if the visibility data is different for every tile. Maybe there's some clever way to make it work well, but I don't currently know of any :)

An RPG mod would be almost completely tangential to 0AD because the game play would differ so much from an RTS, it wouldn't be easy to say the least.

From what I remember of SWGB, lots of people like doing RPG-like sections in their maps (particularly to add some variety to campaigns), so it'd probably be good to support a simple version of it as a proper part of the game. (Also I've always thought it'd be interesting to do a Diablo-like action RPG in the engine, but that's probably excessive feature creep :P)

I had a look at the XML 'entities' and it looks like basic items (with only passive effects) could be supported by "garrisoning" them in the bearer. You could create relics this way. I think it will only need some javascript, and it would be cool for the gameplay.

It'd probably be better (and maybe easier) to implement a standalone inventory system rather than hacking the garrisoning system to support it - use the GarrisonHolder component as a template to create a new Inventory component or similar, and figure out how to integrate into the GUI (maybe using basically the same code as for displaying garrison status), then remove unneeded functions (ungarrisoning etc) and add whatever's still needed.

Link to comment
Share on other sites

From what I remember of SWGB, lots of people like doing RPG-like sections in their maps (particularly to add some variety to campaigns), so it'd probably be good to support a simple version of it as a proper part of the game. (Also I've always thought it'd be interesting to do a Diablo-like action RPG in the engine, but that's probably excessive feature creep :P)

Ok, I agree it's probably feature creep, but we should definitely add functionality for this in version 2!

Link to comment
Share on other sites

It'd probably be better (and maybe easier) to implement a standalone inventory system rather than hacking the garrisoning system to support it - use the GarrisonHolder component as a template to create a new Inventory component or similar, and figure out how to integrate into the GUI (maybe using basically the same code as for displaying garrison status), then remove unneeded functions (ungarrisoning etc) and add whatever's still needed.

Well I looked, it will probably need an Inventory component, new events (for the item to have an effect), and a new action (namely "pick up"). I'll code something this week.

If this new GUI is adopted, the inventory could be displayed on a panel just to the right of the unit's info panel. In the current one it doesn't really fit ; you can't use the garrisoning code because it uses the stances buttons' space.

Ok, I agree it's probably feature creep, but we should definitely add functionality for this in version 2!

:)

Performance is hard since you probably need to compute LOS for every moving unit (potentially thousands) every turn (currently every 200ms or so). (Actually you have to do it twice, once to cancel the LOS effect from the previous turn and once to apply the new LOS effect from the current turn). The vision range might be ~20 tiles so its area is ~1000 tiles. So that's like ten million tiles processed per turn, most probably involving L2 cache accesses (which is maybe 10 CPU cycles each time) since the maps are quite large, and it can end up being a sizeable chunk of the total CPU cycles. So you generally want to minimise the amount of per-tile work you have to do, and searching for obstacles is probably too expensive. Precomputing data can make it faster, but storing that efficiently is hard if the visibility data is different for every tile. Maybe there's some clever way to make it work well, but I don't currently know of any :)

It works quite smoothly in Warcraft III (though it's not very accurate), but I don't know how. Actually I don't know anything about graphics programming. There must be a trick.

EDIT :

  • Garrisonned units and items can be lined above the unit info panel. And finally, I think the two should be a single component, maybe by having two lists of allowed classes in the template, one for items and one for units.
  • I had a look at Warzone 2100's code, and it seems that they use simple raycasting for visibility, though maybe I didn't understand, the code being quite obfuscated, and mixed with some game-specific stuff (you can detect units you can't see or something like that). It also works quite smoothly in game.

Edited by Zerbob
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...