Opened 9 years ago

Closed 6 years ago

#3212 closed enhancement (fixed)

[PATCH] Provide a unit tree like the tech tree is provided

Reported by: Kalle Richter Owned by: s0600204
Priority: Should Have Milestone: Alpha 23
Component: UI & Simulation Keywords: patch
Cc: Patch: Phab:D297

Description

Currently a tree overview of technologies is provided at http://s06eye.co.uk/0ad/techtree-v2. It'd be nice to have such overview for units and links to both at central location.

Attachments (2)

0ad_tech_tree.png (1.2 MB ) - added by Kalle Richter 9 years ago.
Screenshot of ingame tech tree
viewer.patch (19.5 KB ) - added by s0600204 9 years ago.
The requested patch, against r17047

Download all attachments as: .zip

Change History (26)

comment:1 by sanderd17, 9 years ago

You should be able to access units, buildings and tech descriptions by clicking on the different icons.

So it's a plain extension of the structure tree.

Note that the structure tree is also part of the game (under the main screen), and in #3101, the structure tree should be made available in game.

When you are in game, the structure tree and its visualisations could even display which techs are researched, which units unlocked, which effects applied, ...

But I guess one step at a time would be best.

by Kalle Richter, 9 years ago

Attachment: 0ad_tech_tree.png added

Screenshot of ingame tech tree

comment:2 by Kalle Richter, 9 years ago

The tech tree in the main menu doesn't display units (see screenshot). I clicked on different icons, but units are not accessible (maybe you can clearify what different icons you mean exactly).

comment:3 by sanderd17, 9 years ago

Sorry for the misunderstanding.

I meant that it's a future plan to be able to see information of units when clicking on the icons. Not that it already happens now.

comment:4 by s0600204, 9 years ago

sanderd17:

I meant that it's a future plan to be able to see information of units when clicking on the icons.

This the sort of thing you have in mind? (activates with a right-click on certain icons)

It's implemented as a separate page, so it can be used almost anywhere in GUI code with a call of Engine.PushGuiPage("page_viewer.xml", "gaia/fauna_sheep").

Currently usable as a mod from https://github.com/s0600204/0ad-structree-mod/tree/entityDetails

comment:5 by historic_bruno, 9 years ago

That has been desired for years, please submit a patch against SVN for it :)

by s0600204, 9 years ago

Attachment: viewer.patch added

The requested patch, against r17047

comment:6 by s0600204, 9 years ago

Component: Non-game systemsUI & Simulation
Keywords: patch added
Type: taskenhancement

comment:7 by elexis, 9 years ago

Keywords: review added
Milestone: BacklogAlpha 19
Summary: Provide a unit tree like the tech tree is provided[PATCH] Provide a unit tree like the tech tree is provided

comment:8 by Itms, 9 years ago

Milestone: Alpha 19Alpha 20

This looks really awesome but I think it is a too large feature to include it right now. Be assured that we will look into committing that as soon as the release is over!

comment:9 by wraitii, 8 years ago

Patch tested and still working. Beyond the layout itself, which can be refined, we would imo need:

-A small button somewhere when selecting a unit to open it

-keyboard shortcut (to quickly check some data).

It would be the first part of my GUI revamp as written here: http://wildfiregames.com/forum/index.php?showtopic=20190&p=311004

comment:10 by Itms, 8 years ago

Milestone: Alpha 20Alpha 21

Hi! So unfortunately nobody had time to take a look at this since the last release, which is a shame because this feature is great.

I rebased the patch and it works fine. However there is a huge problem, which is that a lot of things are not translated at all, especially the "History" part of templates. I fixed that, but if we commit translators will have a ton of translation work to perform before A20, which is bad.

Also some History parts are empty right now.

So I think we should fill out our History content, and remove altogether the old and now useless History page in the main menu. I set up a git branch here: https://github.com/na-Itms/0ad/tree/encyclopedia If anybody wants to propose pull requests, they're gladly welcome :)

comment:11 by sanderd17, 8 years ago

Most of the useless History tags are now removed in r17988, so they should be mostly ready to translate.

comment:12 by sanderd17, 8 years ago

This is a very nice patch, and still applies cleanly (apart from one line).

Some remarks on the functionality:

  • For the icons that currently don't have an action (big selection icon, and the icons in the structure tree), it would be better to show the screen on a left click IMO
  • It would be good to show the icons can be clicked by having some "highlight" overlay when hoovering the icon (similar to what you see when hovering the civ icon to open the structree)
  • The tooltips in the structree could be made a bit smaller (remove some stats from it), while the encyclopedia could show a lot more stats
  • It should be possible to go from one encyclopedia page to another by following different links (a unit can promote to another unit, a unit can build a structure, a structure can produce a unit, ...)

However, the functionality is already good enough to commit it now IMO.

Some comments on the code:

  • getEntityStats doesn't return stats, but a formatted string. So the name could be a bit better, like "getEntityStatsTooltip" or "formatEntityStats".
  • Instead of testing for typeof g_Lists !== "undefined", it's easier in JS to test for g_Lists. An array gets converted to a truth value (even if it's empty), and undefined is a false value.

The rest looks very nice.

comment:13 by s0600204, 8 years ago

This is a very nice patch

Thank you

For the icons that currently don't have an action (big selection icon, and the icons in the structure tree), it would be better to show the screen on a left click IMO

Hmm... but having it on a right-click for everything is more consistent

The tooltips in the structree could be made a bit smaller (remove some stats from it), while the encyclopedia could show a lot more stats

Personally disagree, as that makes it harder to players compare stats, but meh.

Instead of testing for typeof g_Lists !== "undefined", it's easier in JS to test for g_Lists. An array gets converted to a truth value (even if it's empty), and undefined is a false value.

I'm afraid I'm going to have to disagree with this, for the following reason:

var a = { "b": "foo" }
if (a)				// true
if (a.b)			// true
if (a.b === undefined)		// false
if (a.c)			// false
if (a.c === undefined)		// true

if (d)				// error: "d not defined"
if (d === undefined)		// error: "d not defined"
if (typeof d === "undefined")	// true

var e = undefined;		// explicitly set as undefined
if (e)				// false
if (e === undefined)		// true

However, the functionality is already good enough to commit it now IMO.

As the viewer reuses and slightly modifies code belonging to the structree, it is affected by #3747 and #3801. I'd like to get those resolved before getting this committed because resolving merge conflicts and sorting out regression is *so* fun.

And thanks for the review!

comment:14 by sanderd17, 8 years ago

Any progress on this? AFAICS, #3747 and #3801 can be solved by just displaying the autoresearched techs somewhere, so shouldn't block the unit tree.

But the code of the unit tree would need some further cleaning up (like using a function that uses unititialized global variables is a bit ugly IMO).

comment:15 by Itms, 8 years ago

Keywords: rfc added; review removed

Move tickets from the review queue to the rfc one.

comment:16 by elexis, 8 years ago

Milestone: Alpha 21Alpha 22

Feature freeze in 2 days.

comment:17 by elexis, 7 years ago

Milestone: Alpha 22Work In Progress

Moving to the new WIP milestone.

comment:18 by fatherbushido, 7 years ago

It would be nice if we could include that one too.

Version 0, edited 7 years ago by fatherbushido (next)

comment:19 by Imarok, 7 years ago

Any news here? (The tickets needed for this are fixed now)

comment:20 by elexis, 7 years ago

Phab:D295 is a prerequirement if I see this correctly.

comment:21 by s0600204, 7 years ago

For those tracking progress of the off-topic entityDetails/templateDetails page -> Phab:D297

For those who are looking forward to an actual unit-tree/unit-tables page... one possibility...

comment:22 by s0600204, 7 years ago

In 19960:

Purge all History strings from entity templates.

This is so when we mark them for translation (as we will do soon) our wonderful translators are not inundated with a couple hundred new strings, many of which will need to be changed
in some way.

Patch by: fatherbushido
Change agreed upon by: elexis
Prep work for: D297
Refs: #3212

comment:23 by elexis, 7 years ago

Keywords: rfc removed
Milestone: Work In ProgressAlpha 23
Patch: Phab:D297

comment:24 by s0600204, 6 years ago

Owner: set to s0600204
Resolution: fixed
Status: newclosed

In 21310:

Implement an in-game Template Details Viewer

Right-click on icons of units, structures, technologies, flora, fauna, etc. and view additional details.

Reviewed By: elexis
Fixes: #3212
Differential Revision: https://code.wildfiregames.com/D297

Note: See TracTickets for help on using tickets.