Author Topic: GLGooey Integration  (Read 6584 times)

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
GLGooey Integration
« on: 14 August 2009, 02:47:41 »
I have glgooey rendering and mouse input is partially working.



Image doesn't seem to load sometimes so here's the link and nor does a direct link. A blog post will surely work.

Test 1
http://hailstone3.truefreehost.com/?p=162

TODO:
- Fix mouse input
- Keyboard input
- Replace menus
- Replace png loader with DevIL
- Refactor Gui class
« Last Edit: 20 August 2009, 00:10:38 by hailstone »
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: GLGooey Integration
« Reply #1 on: 14 August 2009, 03:36:01 »
Hay, It looks great!   :)
Get the Vbros': Packs 1, 2, 3, 4, and 5!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: GLGooey Integration
« Reply #2 on: 14 August 2009, 06:17:59 »
Great!
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: GLGooey Integration
« Reply #3 on: 14 August 2009, 08:47:33 »
Nice!

 ;D

Don't be shy about committing that some time ;)
Glest Advanced Engine - Code Monkey

Timeline | Downloads

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: GLGooey Integration
« Reply #4 on: 14 August 2009, 09:00:32 »
Very nice Hailstone!

How are you planning to intergrate it?
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: GLGooey Integration
« Reply #5 on: 14 August 2009, 11:45:50 »
Oh, and BTW, I would like to know if you have a rough estimate on the completion? If the military gae version will use this, it would be best to wait for it, and I'm curious roughly how long. Judging from your post, progress is good.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: GLGooey Integration
« Reply #6 on: 14 August 2009, 13:11:01 »
Oh, and BTW, I would like to know if you have a rough estimate on the completion? If the military gae version will use this, it would be best to wait for it, and I'm curious roughly how long. Judging from your post, progress is good.

Impossible to say. There will be problems. Some of them may take some time to fix/get around. Besides that this is of course an open source project, Hailstone has university keeping him occupied as well, though he certainly does seem to have made an encouraging start :)
Glest Advanced Engine - Code Monkey

Timeline | Downloads

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: GLGooey Integration
« Reply #7 on: 15 August 2009, 01:50:38 »
At the moment everything is shoved in main_menu.cpp just so I could see if it worked. I want to use Gui class as a partial wrapper for GLGooey (initialisation, cleanup, userinput, etc) but the components will be the GLGooey classes; There are no weird prefixes/suffixes on the classes so it will seem like it's a part of Glest. Currently Gui is being used for the gameplay type gui stuff so for now I'll setup GLGooey in the menu and Gui and treat them separately.

I've found these seem to be the steps for integration:
1. Make sure the library links
2. Get it rendering
3. Get the mouse input working
4. Get the keyboard input working
5. Replace the old components (the biggest task, especially for the fiddly bits like unit HUD)
6. Add new features that weren't possible with the old components

I'm somewhere around 3 and 4.

UPDATE:
I got a comment that they were worried about the appearance in the first screenshot, so I've modified it to make it more Glest like.

Test 2
http://hailstone3.truefreehost.com/?p=162

Here is the xml:
Code: [Select]
<standard>
    <rollOverDesc>
        <background className="BitmapDesc">
           <fileName>data/gui/default/images/button_big_hover.png</fileName>
        </background>
    </rollOverDesc>    
    <pressedDesc />
    <releasedDesc>
        <background className="BitmapDesc">
           <fileName>data/gui/default/images/button_big.png</fileName>
        </background>
    </releasedDesc>
    <rollOverOnDesc />
</standard>

And I've committed the code to the glgooey branch, but I wouldn't recommend changing anything until I have it setup properly.
« Last Edit: 20 August 2009, 00:09:53 by hailstone »
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

gameboy

  • Guest
Re: GLGooey Integration
« Reply #8 on: 17 August 2009, 09:03:49 »
ah very nice... good work hailstone :D

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: GLGooey Integration
« Reply #9 on: 19 August 2009, 09:07:34 »
Hailstone, ive seen that link method a couple of times from you now, and it alway seems to bug out into a random website, my opera even warned me it was a hazadrous homepage.

at the minimum i cant see the picture, and i would so very much like to see that pic :D
WiP Game developer.
I do danish translations.
"i break stuff"

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: GLGooey Integration
« Reply #10 on: 20 August 2009, 00:05:16 »
It must not like being accessed directly. I've made a blog post now, which I'll update with more screenshots. http://hailstone3.truefreehost.com/?p=162
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: GLGooey Integration
« Reply #11 on: 20 August 2009, 14:41:27 »
Thanks, that looks much better now :D, thanks hailstone.
WiP Game developer.
I do danish translations.
"i break stuff"

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: GLGooey Integration
« Reply #12 on: 21 August 2009, 05:03:15 »
Wow, looks great. I like it!

BTW, why can it only use PNG for now? Still to impliment the code for other formats? I think only a few formats are needed:

TGA (24,32)
BMP (8,24)
JPG
GIF (8)
PNG (8,24,32)

There's plenty of other formats, but this is all that's needed. JPG is best for non-alpha images, PNG is best for alpha images. GIF MIGHT allow animation, if the engine allows it (?).TGA and BMP are there for support. All bit sizes must be needed. 8 bit PNG can be used to save  file size with 256 colored images, while 24 bit saves size on non-alpha images. 32 bit is the standard, with full alpha and color support.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: GLGooey Integration
« Reply #13 on: 22 August 2009, 07:42:37 »
I'm going to use DevIL which supports lots of formats but I think the GLGooey's wrapper library is using a incompatible version of a file. It should be easy to fix.

Quote
GLGooey currently supports RGB and RGBA images. That means that only values of 24 and 32 are valid for the number of bits per pixel.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: GLGooey Integration
« Reply #14 on: 4 September 2009, 02:44:53 »
I'm going to use DevIL which supports lots of formats but I think the GLGooey's wrapper library is using a incompatible version of a file. It should be easy to fix.

I vote against DevIL. We can already load bmp and tga, glgooey with libpng is working, so we only need to add maybe jpg. I'll get the shared_lib Pixmap classes and glgooey 'talking' at some stage soon.

In the meantime, I've added a glgooey project, it builds glgooey plus all the bits 'n' pieces it comes with into a single 'super' glgooey.lib. Chances are we're going to want to change things in it anyway, so having it in our source tree just makes sense. [nb: I have no intention of sorting this out for linux just yet, it was painful enough on windows, even with drag-and-drop :'(]

I've removed all your include/library references to stuff you have on h: you don't need that any more.  But you may want to double check you don't have a non-super glgooey.lib in any of the lib dirs.

Debug build only for the moment, the new project only has debug and release configs, so there's nothing for a game in Release+SSE2 config to link with. Can I suggest we just drop the current 'release' config from game/shared, and rename 'Release+SSE2' to Release? I doubt we need to build non SSE2 executables any more ...
Glest Advanced Engine - Code Monkey

Timeline | Downloads

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: GLGooey Integration
« Reply #15 on: 4 September 2009, 09:10:11 »
Quote
I vote against DevIL. We can already load bmp and tga, glgooey with libpng is working, so we only need to add maybe jpg. I'll get the shared_lib Pixmap classes and glgooey 'talking' at some stage soon.
I think Omega was after gif but the four you mentioned should be more than enough for now.

I was getting lots of unresolved externals until I added ../shared_lib/include/tinyxml to glgooey project. I'm also using a lua debug lib named "lua5.1_d.lib". It compiles and runs successfully.

Would be good to add glgooey project as dependency of game.

Quote
I doubt we need to build non SSE2 executables any more ...
I wouldn't remove it until we've done a proper release so we can see how many people complain that it doesn't run for them  :P. No reason to update it if we're not going to use it though.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: GLGooey Integration
« Reply #16 on: 4 September 2009, 10:45:36 »
I think Omega was after gif but the four you mentioned should be more than enough for now.
Anything GIF can do, PNG can do better :)

Quote
I was getting lots of unresolved externals until I added ../shared_lib/include/tinyxml to glgooey project. I'm also using a lua debug lib named "lua5.1_d.lib". It compiles and runs successfully.
Sorry, I still had a tinyxml.h in my deps/include which it could see. I don't have the lua debug lib in my deps, I'll dig it up and put in the right place, sorry about that too..

Quote
Would be good to add glgooey project as dependency of game.
Will do...

Quote
I wouldn't remove it until we've done a proper release so we can see how many people complain that it doesn't run for them  :P. No reason to update it if we're not going to use it though.
I haven't been maintaining the 'release' config anyway  :P
I'll remove it and make 'Release+SSE2' into 'Release', it'll only be one (albeit in three projects now) change in the config properties to compile without SSE2 anyway.

Glest Advanced Engine - Code Monkey

Timeline | Downloads

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: GLGooey Integration
« Reply #17 on: 7 September 2009, 17:51:30 »
I know quite a bit about image formats. Yes, PNG can do ALMOST everything better than GIF. But what can it not? Simple: animation. I've always dreamed of animating things in glest by textures, since not everything can be animated otherwise...

Not sure if this is related: but can the unit alpha problem be fixed in the GUI? As you may already know, if alpha is placed in a unit's texture, you see straight to the ground, even if there is something behind it.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: GLGooey Integration
« Reply #18 on: 4 October 2009, 22:56:12 »
PNG can do animation but I'm not sure what image libraries support it. http://en.wikipedia.org/wiki/APNG

Has anyone else had a look at GLGooey to see if they like it? I think what GLGooey needs is a way to load everything from a file, like how OpenGLUI did it, then only have small changes (ie lang text) and the events in the code. Also setting a default appearance for a component instead of having to apply the same one each time.

I've updated my blog post with the New Game menu I've been working on. I haven't figured out the layout yet and the keyboard input isn't working. I should test how well other component appearances can be customized; I've only looked at the button appearance so far.

An example component file (should have better names for tags, etc):
Code: [Select]
<components>
  <LoadAppearances><file>defaults.xml</file></LoadAppearances>
  <DefaultAppearences>
     <Button val="DefaultButton">
     <ComboBox val="DefaultComboBox">
  </DefaultAppearences>
  <Button name="new_game" x="0" y="0" width="100" height="50" />
  <ComboBox name="example_combo" x="0" y="0" width="100" height="50" />
  <ComplexLayout>
    <row><col>[a component here]</col></row>
    <row><col>[a component here]</col></row>
  </ComplexLayout>
</components>

Then in the code:
Code: [Select]
btnNewGame = componentsFile.getButton("new_game");
cmbExampleCombo = componentsFile.getComboBox("example_combo");
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: GLGooey Integration
« Reply #19 on: 6 October 2009, 07:08:20 »
Hey guys, sorry for taking so long getting to this topic.

Anything GIF can do, PNG can do better :)

IMHO, more support is good, but png is definately superior.  I don't remember the issues now, but I seem to recall devil as being some kind of dead-end project?  I'm curious what additional SDL libraries may have to offer.  As to animated gifs, perhaps we can add support to the engine for this in another means, aside from animated gifs?  It can be a very nice and cheap mechanism to do a lot of stuff!

Quote
I haven't been maintaining the 'release' config anyway  :P
I'll remove it and make 'Release+SSE2' into 'Release', it'll only be one (albeit in three projects now) change in the config properties to compile without SSE2 anyway.
Yea, I 3rd that notion.  Plus, I believe the way the m$ compiler works is that it does a run-time check to see if your CPU supports it or not and then uses the version of a function that your CPU will support (and don't quote me on that either :) ).  So let's just find out if it blows up on anybody's computers.

Not sure if this is related: but can the unit alpha problem be fixed in the GUI? As you may already know, if alpha is placed in a unit's texture, you see straight to the ground, even if there is something behind it.
*grumbles* I thought somebody found the cause of that and fixed it already. :)  Omega, if there isn't a bug open for it on bugs.codemonger.org, can you pretty please open one? :)  I don't want that problem to get lost.

Hailstone, I haven't followed your work on the GUI much lately and I promise I'll read up on it tomorrow.   How this plays out is going to be very important for GAE's evolution! :)

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: GLGooey Integration
« Reply #20 on: 6 October 2009, 09:25:01 »
I haven't yet actually tried to use it for anything, but I will do soon, as Daniel pointed out, this is a rather important area for the future of GAE.

I did however start playing with the project files again the other day, and I turned off RTTI on the glgooey project, with unpleasant results... I haven't investigated at all yet, so I'm not sure how extensively it's being used, but this makes me very unsure about whether it will be usable 'in game'.

Have you noticed many typeof() or dynamic_cast<> calls ?
Glest Advanced Engine - Code Monkey

Timeline | Downloads

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: GLGooey Integration
« Reply #21 on: 6 October 2009, 10:39:13 »
Quote
Have you noticed many typeof() or dynamic_cast<> calls ?
There's 8 occurrences of dynamic_cast<>. Mainly going from message to another Message type and ListWindow to another List type.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: GLGooey Integration
« Reply #22 on: 6 October 2009, 20:00:51 »
OK, I've got two main topics here, so let me try to split them up with headings :)

RTTI
I guess I wouldn't mind using RTTI in GAE, but we'll have to do an audit of all classes to discover which the compiler would generate RTTI info for and make sure it's none of our high-use objects.  I haven't used RTTI in C++ much at all, but my understanding is that it only generates the information (and thus, overhead) for classes that contain at least one virtual function (http://en.wikipedia.org/wiki/Run-time_type_information).  I'm very cozy wtih the general concept of RTTI because I've done so much Java (and every non-static method in Java is virtual).  Currently, we have a lot of enums for object type.  As I understand it, using the typeof() operator is identical in performance.

My only concern with RTTI is bloating objects that don't need it.  If you guys want to discuss this further, let's start a new thread for RTTI, it's certain worthy of it.

GUI
Back to the GUI topic, whatever we come up with, I just want it to be very visually flexible.  We don't need compiz-level effects, but I want it to be able to compete with the GUIs you see in todays games at least.  It should be able to read configuration files (preferrably XML) for layout/format information.  Lastly, the ability to animate components would be nice (i.e., when you're mouse floats over a button it does weird stuff).  I've been thinking out an internal architecture for how we'll implement the connection in GAE between the GUI library, the user interface definition (what you write to "skin" GAE) and the internal GAE data.  This is what I've come up with so far.

First off, in software engineering, one is always weighing various options to determine the best balance, usually in terms of "performance vs something else".  Some stuff in GAE I've aimed to keep the working set small (less code), some less memory usage, some faster execution, etc.  In the case of the GUI, I don't mind moving a bit away from "top performance" (like we want in path-finding, rendering, etc.) and more towards flexibility, maintainability & good design.  So I'm thinking something along the lines of exposing displayable data, actions and events through an abstracted means that allows each to be referred to by their textual names.  Here's a very brief and over-simplified example:

Code: [Select]
class SomeUIClass {
private:
    int mySpecialValue;

public:
    string getValue(const string &name) {
        if(name == "mySpecialValue) {
            return Conversion::toString(mySpecialValue);
        }
        // ... etc
    }

    void setIntValue(const string &name, const string &value) {
        if(name == "mySpecialValue) {
            mySpecialValue = Conversion::strToInt(value);
        }
        // ... etc
    }

    void doAction(const string &name) {
        if(name == "mySpecialAction) {
            mySpecialAction();
            return;
        }
        // ... etc
    }

private:
    void mySpecialAction();    // e.g., "Start Game"
};

Obviously, the implementation would be something much more re-usable and we'll possibly need something for call-backs (I'm not entirely sure how that should work).  Then, we can have an XML with something like this:

Code: [Select]
<my-excellent-ui-screen>
    <label name="mySpecialLabel" text="You have ${mySpecialObject.mySpecialValue} specialness left."/>
    <button name="makeMoreSpecial" action="mySpecialObject.mySpecialAction"/>
</my-excellent-ui-screen>

So maybe Lua would be the best solution for this (the Lua snippets can be contained in the values of XML attributes).  This doesn't *have* to be the same XML or other configuration file that gets fed to the GUI library, but it would be nice if we could use it for both the GUI definition and layout as well as the connection to the internal GAE data, action and (possibly) events (or callbacks).  From what I can tell at this point, we would mostly need callbacks if we need to tell the GUI to re-read values or some such, to prevent the need to call the accessors every rendering frame.  Perhaps the GUI library can cache its values until we send a callback dirtying some fields and then the GUI will re-request the appropriate fields.

EDIT: Oh! One last thing! :)  Whatever we settle on & do, I would like for us to release it with two initial UI skins:
  • A "Classic Glest" skin that looks exactly like Glest 3.2.2
  • Some other Snazzy-looking skin to demonstrate GAE's skin-ability.

I know this has been mentioned before, but ideally, I would eventually like GAE to be usable as any RTS engine, so that starting it with certain parameters changes everything about it (skin, menu configuration, etc.).
« Last Edit: 6 October 2009, 20:09:57 by daniel.santos »

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: GLGooey Integration
« Reply #23 on: 6 October 2009, 22:32:44 »
Have to be quick for now,  but regarding the callbacks... I was looking at GLGooey last night, and it makes use of sigslot,
http://sigslot.sourceforge.net/

Wasn't too sure about it at first, but I read the sales pitch, and I'm sold! This is very cool!
Glest Advanced Engine - Code Monkey

Timeline | Downloads

daniel.santos

  • Guest
Re: GLGooey Integration
« Reply #24 on: 7 October 2009, 00:47:51 »
I read the 1st several paragraphs of the sigslot introduction and I still can't tell what it is! :)  The thing I'm not certain about is how to manage the dirty state of each of these fields, especially for stuff that changes a lot like the Unit's HPs, EPs, etc -- unless we somehow hard-code those as just always dirty.  I really don't want to junk up the getters & setters of the Unit class (and UnitStatsBase, etc.).