Jump to content
XCOMUFO & Xenocide

Issue #106: Statistics Gui Implementation


reist

Recommended Posts

I'm going to do this, but I want to know something first: what is the difference between a screen and a dialog?

edit: Another question: Were the events and states for statistics just missed/not added, or should it not have them at all?

Edited by reist
Link to comment
Share on other sites

I'm going to do this, but I want to know something first: what is the difference between a screen and a dialog?

Ummm... a screen takes up the whole screen while a dialog is just a window.
Link to comment
Share on other sites

Yep, I'm not asking about conceptual difference. I'm asking about the classes.

For now I'm deriving from UIScreen and ModalDialog, like options, but I want to know if this is the correct way or am I supposed to do something else.

Link to comment
Share on other sites

There's an iconset for statistics and a png file that has all the concept graphics ready to be used, but there is no schema file for it. Is anyone in charge of creating them?
Link to comment
Share on other sites

Yes, everything is in XenoLook...except for one graphic that looks like a part of a drop down - exactly what is needed in the concept. It's kind of like a radio button. Looks like a Button/Left without the square on the right side.

I can't use buttons there - they don't stay lighted up.

screenshot.jpg

Edited by reist
Link to comment
Share on other sites

To put the graph into the window I used a convertion to texture to imageset (it stays dynamic). I used Ogre's Gui example for that (the only one I found of inserting a dynamic image into a window).

Here's a link to crazy eddie's response to a very similar issue:

http://www.cegui.org.uk/modules/newbb/view...=1056&forum=2#3

 

The graph image is behind the globe far enough and small enough not to be seen from the Statistics window no matter the scene's rotation (I hope). It's deleted when closing the window.

 

Three question about what I'm doing:

1. Does anyone know a better way to connect the graph to the window?

2. Is there a way to calculate exactly what area will be seen so that setting up the camera/viewport could be done automatically and not by trying.

3. Is there some way to improve the quality of the lines? The line quality is higher at higher resolutions, but this image is taken at 1024x768 and it still looks pretty bad.

 

I also couldn't use the DynamicLines in the misc directory. The lines just weren't drawn. Line3D from Ogre's code snippets did work and that is what I used.

 

Screenshot_Xenocide.png

(And yes, there are stars from the SkyBox in the graph's background :) )

(edit: New image. The previous was small, but the lines in the graph could not be seen)

Edited by reist
Link to comment
Share on other sites

...I also couldn't use the DynamicLines in the misc directory. The lines just weren't drawn. Line3D from Ogre's code snippets did work and that is what I used.

Scratch that. It was only the different material used in DynamicLines. Now that I added color to the lines via materials, I can use DynamicLines.

Can DynamicLines' constructor be change to receive a material name? The current material name could be the default, so that current code won't change. Otherwise each time someone will want to make another line, they would have to do this:

DynamicLine line;

line.setMaterial(materialName);

Link to comment
Share on other sites

SupSuper, can you make combo's drop list to look like that?

I don't think it's possible, though I'll look into it.

Can you make a radio button to look like that instead? A combo box is not the best thing there - too many differences between it and the dropdown's behaviour.

Link to comment
Share on other sites

SupSuper, can you make combo's drop list to look like that?

I don't think it's possible, though I'll look into it.

Can you make a radio button to look like that instead? A combo box is not the best thing there - too many differences between it and the dropdown's behaviour.

Sure, added XenoLook/Button/StatsRadio. For now it's just a radio-button version of XenoLook/Button/Left, when I have time I'll fix its look :)
Link to comment
Share on other sites

I'm splitting my code into a couple of classes for better control.

I also have four function which don't need anything except for two or three different includes from CEGUI/Ogre.

Because I split the code, the three first functions have to be somewhere else. They're included by a couple of these files.

Where can I put such functions?

 

Here's what the functions do:

Clone a CEGUI widget based on an example in the layout. Only basic cloning, nothing deep like cloning windows with their components. It's really making it easier for me to construct dropdowns, coordinate text and the key map on the fly.

 

Create a single color material. I don't know if it can be used for anything but lines...

There are two functions like this - one takes an Ogre::ColourValue, and the other four floats for rgba.

 

A texture creation function. That's part of what I use to make the graph pane show something from Ogre. I can connect the rest of the functionality together, but it's still all managed by Ogre and CEGUI. No reason to make a full class.

Link to comment
Share on other sites

I think those functions can go into client/misc/ (misc.cpp :D)

I put all but one into a ogreceguiservices.cpp :)

I don't think the widget cloner can go there. It has two include from CEGUI and nothing else. It compiles in a _really_ short time :P

The other file includes uirequisites and is as slow to compile as the rest of the code. What the functions do is also just too different.

 

I posted a patch to the task tracker.

 

This is how the window works:

It always open to the first graph.

 

Both dropdowns apply immediately (without closing). They are semi-transparent so they don't really interfere with seeing what's below.

 

graph names and data sets have a long and short version. Graphs have dropdown name and title, data sets(like countries, regions...) have a short version in case there are to many sets to fit with the long version inside the key map. The long version will be used in the dropdown anyway.

You can see the last screenshot for example of this.

 

The name of elements are the same as the long text version, so you can have only one of each. That means that if two graphs use the same data set (like "US"), there'll really be only one checkbox for both graphs with the same state.

 

Because the state of each line is taken from CEGUI windows and I never destroy them myself, state of graphs is saved when changing graphs or exiting the window.

statistics1.png

statistics2.png

statistics3.png

statistics5.png

statistics6.png

Link to comment
Share on other sites

I don't know much about this stuff, but...

 

Can you use AA with DynamicLines? There appear to be quite big holes in them sometimes...

Link to comment
Share on other sites

The holes are because it's a texture. No aliasing possible. The graph itself (hidden out of sight) is being anti-aliased and looks great.

For textures it's either that or making the lines pretty thick and broken.

If any programmer knows a better way to capture a scene onto a cegui window than texturizing it, that'll be great.

Link to comment
Share on other sites

is the art you have intere just placeholder until you get the functionality in because it has only passing resemblance to the concept I gave you folks.
Link to comment
Share on other sites

It is functionality mostly. To make it beautiful go nag SupSuper :).

 

(After I check and commit the patch, that is :)).

 

Edit:

Commited.

 

Edit2:

While we at that :rolleyes:,.. we need a second kind of frame window (without reserved space for scroll bar). I think it is possible to make two kinds of windows with different imagesets (helI, there are at least a dozen buttons :)).

Edited by UnFleshed One
Link to comment
Share on other sites

It is functionality mostly. To make it beautiful go nag SupSuper :).

 

(After I check and commit the patch, that is :)).

 

Edit:

Commited.

 

Edit2:

While we at that :rolleyes:,.. we need a second kind of frame window (without reserved space for scroll bar). I think it is possible to make two kinds of windows with different imagesets (helI, there are at least a dozen buttons :)).

I'll work on all that after I get over a nasty hit on the head. Got 8 stitches so the doc recommends I take it easy for a while, don't want to pop my stitches from over-working :P
Link to comment
Share on other sites

SupSuper,

Maybe doctor meant don't go unload cargo trains? :P

Shush, let me enjoy my break from school :P

 

Anyways, created a XenoLook/FrameWindow/NoScroll so you can quit bugging me about it ;)

Also, how am I supposed to tidy up the Statistics panel look? I wanted to add proper backgrounds to the graph and key, but whatever goes behind them "disappears". Like holes in the window.

Link to comment
Share on other sites

...

Anyways, created a XenoLook/FrameWindow/NoScroll so you can quit bugging me about it ;)

Also, how am I supposed to tidy up the Statistics panel look? I wanted to add proper backgrounds to the graph and key, but whatever goes behind them "disappears". Like holes in the window.

Well, for the keys, change Statistics/ColorMap to DefaultWindow and remove the background options.

The graph is more of a problem. There's no background there, just a view rendered into a rectangle. If you want something to go behind the graph, it'll have to be loaded in code and drawn behind the graph. It's possible to give the graph an alpha value, but I don't think it's a good idea.

 

By the way, I'm going through Ogre's docs and forums. If I can't find anything to make the lines look better, I'll post a question on Ogre's forums about it.

 

Edit: More space in the new window! AND no need to worry about what % of the window the scroll starts at :D

Edited by reist
Link to comment
Share on other sites

I'm not sure myself :). And I think it should be done on programming level. The question is, can ogre combine two bitmaps assuming one color transparent.

 

On the other hand, to think about that, it has to be loaded in code as well...

If it's anything 2d or 3d, Ogre can. The problem is finding out how.

Link to comment
Share on other sites

  • 2 months later...

Currently in statistics view there is something like leading point. I mean first point which is added to graph is not inlcuded in x axis. (check the picture)

 

Don't know if this is a problem or is it suppose to be like that, what do You think? For me is not any problem at all, just pull out one more value from history, so this is rather stylistic question :)

 

Beetle

screenshot_0005106_003946391.jpg

Link to comment
Share on other sites

That's because I've used line3d to draw the graph. I don't think it works for single dots. You need at least two.

This way there'll always be a need for a "before" point. At the start of the game, we can just put 0 there. The moment a month/day/whatever passes, the lines will start showing.

Edited by reist
Link to comment
Share on other sites

Only OpenGL.

 

Also, Statistics graph is scaled wrong in OGL.

 

I can fix the earth by doing

rttViewport->setOverlaysEnabled(false);

and

rttViewport->setOverlaysEnabled(true);

in publishImpl() and unpublishImpl(). (vewport is the one that is used to make a texture for graph).

 

But the graph itself is still scaled wrong, so that's not a solution...

 

I updated drivers yesterday, and everything is still the same. Does anybody with GeForce FX 5200 sees the same thing?

Edited by UnFleshed One
Link to comment
Share on other sites

Has it always been like that or when did it start, Did you change anything when it did (Video drivers etc) what version of forceware drivers are you running. I would say to reinstall directx but as its open gl That seems weird. Is it just that build of xenocide? Or the other have always done this to you?
Link to comment
Share on other sites

I noticed it just recently, so the build is one of the latest (it was current when I filed the bug :)).

 

It seems it wasn't there when statistics was first implemented. (I did the testing and commiting, and that's pretty noticable aftereffect, even for me :)).

 

Updated drivers a couple of days ago, so that's current too.

 

I haven't buld xenocide for a while, so I'm not sure when it started...

 

and also that's a second bug only I have. So I guess that's my system (which wasn't reinstalled, as all windows must, for quite a while).

 

Edit:

Yeah, that was my problem only. I guess when I tried to update dependencies (unsuccessfully) I didn't quite manage to revert them back :). With branches merged and dependencies updated all went away.

Edited by UnFleshed One
Link to comment
Share on other sites

×
×
  • Create New...