s0600204 Posted October 21, 2014 Report Share Posted October 21, 2014 (edited) (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: 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: 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 March 31, 2015 by s0600204 17 Quote Link to comment Share on other sites More sharing options...
GunChleoc Posted October 21, 2014 Report Share Posted October 21, 2014 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. Quote Link to comment Share on other sites More sharing options...
feneur Posted October 21, 2014 Report Share Posted October 21, 2014 Thanks for the work on this 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 Quote Link to comment Share on other sites More sharing options...
agentx Posted October 21, 2014 Report Share Posted October 21, 2014 Great use of SVG, quickens the appetite for an additional layout to compare civs by phase. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted October 21, 2014 Report Share Posted October 21, 2014 Wow. Very nice. Would this work with mods I wondering. Quote Link to comment Share on other sites More sharing options...
mimo Posted October 21, 2014 Report Share Posted October 21, 2014 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. 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted October 21, 2014 Report Share Posted October 21, 2014 Wow. Very nice. Would this work with mods I wondering.I see now that it does do mods. Where does it get the information from? Quote Link to comment Share on other sites More sharing options...
niektb Posted October 21, 2014 Report Share Posted October 21, 2014 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. Quote Link to comment Share on other sites More sharing options...
rolf.sievers Posted October 21, 2014 Report Share Posted October 21, 2014 (edited) 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 October 21, 2014 by rolf.sievers Quote Link to comment Share on other sites More sharing options...
niektb Posted October 21, 2014 Report Share Posted October 21, 2014 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/0adAh, well, it doesn't seem to show custom technologies and custom icons. Quote Link to comment Share on other sites More sharing options...
s0600204 Posted October 21, 2014 Author Report Share Posted October 21, 2014 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 ) 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). Quote Link to comment Share on other sites More sharing options...
Andrettin Posted October 21, 2014 Report Share Posted October 21, 2014 This is a very nice improvement Quote Link to comment Share on other sites More sharing options...
feneur Posted October 21, 2014 Report Share Posted October 21, 2014 the game's GUI engine needs a recode to permit the creation of UI elements from JavaScriptNow 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? Quote Link to comment Share on other sites More sharing options...
s0600204 Posted October 21, 2014 Author Report Share Posted October 21, 2014 @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. Quote Link to comment Share on other sites More sharing options...
Prodigal Son Posted October 21, 2014 Report Share Posted October 21, 2014 It's great, getting it in game as well would be even greater. I just noticed some tooltips have full costs and some partial (like only lumber and time for some units that have other costs as well), perhaps a result on reading from main unit files and missing costs that exist only on templates? 1 Quote Link to comment Share on other sites More sharing options...
s0600204 Posted October 22, 2014 Author Report Share Posted October 22, 2014 @Prodigal Son: I... had not noticed that. But a check of the code indicates you are correct. Well spotted. And fixed. Thank you. Quote Link to comment Share on other sites More sharing options...
GunChleoc Posted October 22, 2014 Report Share Posted October 22, 2014 I just had another idea: How much work would it be to add i18n to this?If it can be done, make sure that there is an explicit menu to choose the language as well, since browsers like to screw up the preferred language setting. Quote Link to comment Share on other sites More sharing options...
feneur Posted October 22, 2014 Report Share Posted October 22, 2014 @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 Quote Link to comment Share on other sites More sharing options...
s0600204 Posted October 22, 2014 Author Report Share Posted October 22, 2014 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. Quote Link to comment Share on other sites More sharing options...
GunChleoc Posted October 22, 2014 Report Share Posted October 22, 2014 (edited) 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 October 22, 2014 by GunChleoc Quote Link to comment Share on other sites More sharing options...
feneur Posted October 22, 2014 Report Share Posted October 22, 2014 ...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 ) 1 Quote Link to comment Share on other sites More sharing options...
s0600204 Posted October 23, 2014 Author Report Share Posted October 23, 2014 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 . Quote Link to comment Share on other sites More sharing options...
Lion.Kanzen Posted November 6, 2014 Report Share Posted November 6, 2014 Can be nice in main 0a.d page Quote Link to comment Share on other sites More sharing options...
s0600204 Posted December 3, 2014 Author Report Share Posted December 3, 2014 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:Amazones by dvangennipDelenda Est by wowgetoffyourcellphone0AD: Ancient Empires by Prodigal SonThe 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. 6 Quote Link to comment Share on other sites More sharing options...
Prodigal Son Posted December 7, 2014 Report Share Posted December 7, 2014 That's great, thanks for adding the mods including mine:) 3 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.