Jump to content

Tech/Structure Tree Visualisation


Recommended Posts

(No, I'm not trying to 're-envision' how techs work in 0ad, don't worry!)

A while ago, Pureon showcased some of the icons the art team had been working on (http://www.wildfiregames.com/forum/index.php?showtopic=17025) and along with a selection of icons, he also displayed a Tech/Structure tree concept:

DEcfcpT.jpg

Ideally this will evolve from a static design concept into an online interactive Structure Tree that updates itself whenever changes are made to 0 A.D.

I liked the idea (as did the commenters in that topic) and so I decided to attempt to implement it - with a little interpretation. After months of on/off development (mostly off than on) and various revisions, I have got it to a point where I'm happy to share it with the community.

Here's a screenshot:

ZVPpiAU.jpg

A live interactable version can be found here: http://s06eye.co.uk/0ad/techtree-v2

And the code is on github here: https://github.com/s0600204/0ad-techtree-v2

Please note that this is no more finished than 0ad is. There are changes to come, efficiency improvements, appearance tweaks and such. But I thought I'd share my progress and get some (hopefully favourable) feedback.

Enjoy!

Update! It is now possible to see this in-game. See this post for details!

Code Updates:

21st October : Tooltip positioning is better.

22nd October : Stats are now loaded from parent templates properly

23rd October : Tooltips now have the same descriptions used in-game; and for units and structures, attack and armour stats are shown where applicable.

3rd December : Three more community mods available for comparison, rewrite much of the data parsing code.

30th March : Big update to mods' simulation data, and modifications to permit aristeia's phase-pair techs

Edited by s0600204
  • Like 17
Link to comment
Share on other sites

Thanks for the work on this (y) A very promising start! Am i correct in assuming that this could at one point be added to the game directly?

Looks great :)

There's one technical glitch - on the lowest row, the tooltips get cropped on small screens.

As a feature idea, display what the technologies do on the tooltips.

Actually the lowest tooltips get cropped on larger screens as well, possibly the size of the area is hardcoded?

I definitely agree with adding what the technologies do on the tooltips, that would make this a lot more useful :)

Link to comment
Share on other sites

Yes, that's very nice, and I agree with the previous comments about adding the effect of the techs.

There is also an inconsistency: the civ center should appear on phase 1 (as it gives you the possibility to go to phase 2) and because you not only show tech, but also production units.

  • Like 1
Link to comment
Share on other sites

Could this maybe be combined with the history screen? It is currently something I never look at (why would I?) and the addition of a tech tree would give some additional usefulness to it.

Wowgetoffyourcellphone: that depends a bit on the mod but there are already some present in the website (though not up-to-date => not really strange)

The addition of a tooltip description and/or stats of the building / unit / tech would be a good addition indeed as others already pointed out.

Link to comment
Share on other sites

Wow. Very nice. Would this work with mods I wondering.

It already does, you can change the mod using the little gray cog.

I like it as well :-) Even without game integration it is nice to have.

Edit: Ninja'd :-/.

The information is read directly from the mods, which are mirrored in his git repository. https://github.com/s0600204/0ad-techtree-v2/tree/master/mods/0ad

Edited by rolf.sievers
Link to comment
Share on other sites

Wow. Thank you all for the feedback and positive comments.

(GunChleoc) ...on the lowest row, the tooltips get cropped on small screens.

(feneur) ...the lowest tooltips get cropped on larger screens as well, possibly the size of the area is hardcoded?

Fixed. The tooltips should now better position themselves.

And the height is not hardcoded. The height of the draw area is dependant on the number of rows - if a fourth phase was added to the game, the code (which starts off with no preconceptions of how many phases there are) automatically adapts and the draw area will get taller. It's a similar principle with the width of the draw area, which changes depending on the widths of the UI boxes for the chosen civ's buildings after the units & techs are added.

(GunChleoc) As a feature idea, display what the technologies do on the tooltips.

(feneur) I definitely agree with adding what the technologies do on the tooltips...

(niektb) The addition of a tooltip description and/or stats of the building / unit / tech would be a good addition indeed as others already pointed out.

They're already on my todo list ;)

(feneur) Am i correct in assuming that this could at one point be added to the game directly?

(niektb) Could this maybe be combined with the history screen?

I agree it would be nice to have this inside 0ad itself, maybe in a way similar to how the civ history screen appears or incorporated with it or something. However there is one big obstacle in the way of doing that at the moment - in order to get the visual aspect of the tree, either the game's GUI engine needs a recode to permit the creation of UI elements from JavaScript, or an SVG/HTML-Canvas-like UI element would need to be added. (And I'm not proficient enough in C++ code to do either).

...the civ center should appear on phase 1...

The civ centre currrently appears in phase 2 because that is when it can be built. I know, I don't want it there either. I figured someone would mention it. When I get a chance, I'll write in an exception that forces it into phase 1. (And then someone will doubtless complain about that :P)

Ah, well, it doesn't seem to show custom technologies and custom icons.

Which techs/icons are missing? The 0ad wheel is being used as a placeholder by the system - if you see it, it means the image linked by the underlying template doesn't exist or can't be found (by first looking in the art folder of the mod linking it, then each of its dependancies).

Link to comment
Share on other sites

the game's GUI engine needs a recode to permit the creation of UI elements from JavaScript

Now I'm not a programmer, but I would think that it already can do that? Javascript is used in plenty of places in the GUI, so I would certainly think it can do that. Or are you saying that UI elements can't be created on the fly with Javascript?

Link to comment
Share on other sites

@feneur: Either. As I understand it, UI elements and layout are specified in XML files which are parsed by the (c++) engine and used to create what you see. JavaScript can manipulate these elements (change textual content, change image used, set visibility, etc.) but can't call into being a new element that hasn't been specified in the XML file of the currently loaded UI. Or at least that's the impression I got from reading through the (possible slightly out-of-date) documentation on trac and the XML files currently used ingame.
Link to comment
Share on other sites

@feneur: Either. As I understand it, UI elements and layout are specified in XML files which are parsed by the (c++) engine and used to create what you see. JavaScript can manipulate these elements (change textual content, change image used, set visibility, etc.) but can't call into being a new element that hasn't been specified in the XML file of the currently loaded UI. Or at least that's the impression I got from reading through the (possible slightly out-of-date) documentation on trac and the XML files currently used ingame.

Hmm, is there a way to define it, but only display it when the Javascript code calls for it to be displayed? (With the text/graphics replaced via Javascript which you say is certainly possible.) I believe that is basically what trigger scripts do to display custom dialogs (a generic dialog with placeholder text is created in XML, and then the trigger script replaces that information with new text). I would assume that it could work for other GUI elements as well. At least as long as one "source" element can be used several times on the screen at the same time, otherwise it might be a bit too cumbersome if all possible elements have to be hardcoded (i.e. the max number that could possibly appear). If that is the case then I certainly understand if the engine might need to be changed :)

Link to comment
Share on other sites

Hmm, is there a way to define it, but only display it when the Javascript code calls for it to be displayed? (With the text/graphics replaced via Javascript which you say is certainly possible.)

Yes, that is possible...

At least as long as one "source" element can be used several times on the screen at the same time,

...but as far as I know this isn't, although I suspect someone will correct me if I'm wrong...

otehrwise it might be a bit too cumbersome if all possible elements have to be hardcoded (i.e. the max number that could possibly appear).

...precisely.

How much work would it be to add i18n to this?

I'm not sure. I don't know much about how i18n works in-game ordinarily, so I'd have to look into it.

Link to comment
Share on other sites

Can't GUI elements be organized into vectors or something? Positioning would then be done in relation to the previous element. The hard part might be to have a scroll bar when there are more elements than fit the screen.

If it's integrated into the game, i18n will be easy - the coding has been done, and it's probably just a matter of marking strings for translation. A separate web module is where the work would be.

Edited by GunChleoc
Link to comment
Share on other sites

...but as far as I know this isn't, although I suspect someone will correct me if I'm wrong...

Then let's hope someone either corrects you and this works already or someone implements it :) (Or perhaps rather implement JavaScript being able to create GUI elements as that's probably more useful :) )

  • Like 1
Link to comment
Share on other sites

I've made an update: Tooltips now have the same descriptions used in-game; and for units and structures, attack and armour stats are shown where applicable.

I'm not quite happy with how the stats are presented, and I'll probably tweak their appearance, but they are now present.


@GunChleoc: Positioning isn't really the issue (although it would be something of a headache). And unless you're playing on a very high resolution screen there will always be more elements of the tech/structure tree than fit the screen.

And as for i18n, I think you may have answered your own previous question ;). It's been added to my todo list.

@feneur: Indeed :).

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Earlier today I pushed some changes to GitHub and also to the live interactable version. The biggest changes are to how the data is parsed... but that happens in the background and is probably not very interesting so I won't go into detail.

Of greater interest will be that I've added three more mods that you may activate from the drop-down in the top-right:

The latter two change a lot of the same things and are therefore not compatible with each other. Also, you might encounter problems if you have either one of them and any of the smaller mods active at the same time. I won't prevent you from trying, but... I wouldn't advise it.
  • Like 6
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...