GuiSys Preview...

A forum about everything related to the Cafu World Editor CaWE: mapping, editing, scripting, making GUIs and fonts, using the BSP, PVS and Light compilers.
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

GuiSys Preview...

Post by Carsten » 2006-06-19, 17:08

Hello all,

this beautiful GUI script...

Code: Select all

windowDef "TestGUI"
{
    scripts
    {
        function TestGUI:OnInit()
            self:set("rect", 30, 30, 580, 420);
            self:set("text", "Hallo!");
            self:set("textScale", 0.8);
            self:set("backMaterial", "Models/Weapons/9mmAR_v/arm");
            self:set("textAlignHor", 0);
        end

        function TestGUI:OnFrame()
            self:set("size.x", 580+10*math.sin(self:get("time")));
        end
    }


    windowDef ButtonToggleHor
    {
        scripts
        {
            function ButtonToggleHor:OnInit()
                self:set("rect", 10, 380, 100, 40);
                self:set("borderWidth", 0.5);
                self:set("text", "Toggle hor.\nalignment");
                self:set("textScale", 0.25);
                self:set("font", "Fonts/Comic");
            end

            function ButtonToggleHor:OnAction()
                local newAlign=TestGUI:get("textAlignHor")+1;
                if (newAlign>2) then newAlign=0; end

                TestGUI:set("textAlignHor", newAlign);
                self:set("textAlignHor", newAlign);

                self:interpolate("rotAngle", 0, 360, 250);
            end
        }
    }


    windowDef ButtonToggleVer
    {
        scripts
        {
            function ButtonToggleVer:OnInit()
                self:set("rect", 140, 380, 100, 40);
                self:set("borderWidth", 0.5);
                self:set("text", "Toggle ver.\nalignment");
                self:set("textScale", 0.25);
            end

            function ButtonToggleVer:OnAction()
                local newAlign=TestGUI:get("textAlignVer")+1;
                if (newAlign>2) then newAlign=0; end

                TestGUI:set("textAlignVer", newAlign);
                ButtonQuit:set("textAlignVer", newAlign);
                self:set("textAlignVer", newAlign);

                self:interpolate("pos.y", 380, 300, 500);
                self:interpolate("pos.y", 300, 380, 500);
            end
        }
    }


    windowDef ButtonQuit
    {
        scripts
        {
            function ButtonQuit:OnInit()
                self:set("rect", 300, 380, 100, 40);
                self:set("text", "Quit");
                self:set("textScale", 0.5);
                self:set("borderWidth", 1.0);
                self:set("textAlignHor", 2);
                self:set("textAlignVer", 2);
                self:set("font", "Fonts/Impact");
            end

            function ButtonQuit:OnMouseEnter()
                self:set("textScale", 0.55);
                self:set("borderColor", 1.0, 0.0, 0.0, 1.0);
            end

            function ButtonQuit:OnMouseLeave()
                self:set("textScale", 0.50);
                self:set("borderColor", 1.0, 1.0, 1.0, 1.0);
            end

            function ButtonQuit:OnAction()
                -- Add a nice shutdown effect.
                TestGUI:set("rotAngle", -10);
                TestGUI:interpolate("pos.y", 30, 30, 300);
                TestGUI:interpolate("pos.y", 30, 610, 700);

                -- Now somehow quit the game.
            end
        }
    }


    windowDef Counter
    {
        scripts
        {
            Counter.count=0;

            function Counter:OnInit()
                self:set("rect", 400, 20, 120, 50);
                self:set("borderWidth", 0.5);
                self:set("text", "Counter\n" .. self.count);
                self:set("textScale", 0.3);
            end

            function Counter:OnAction()
                self.count=self.count+1;
                self:set("text", "Counter\n" .. self.count);
            end
        }
    }


    windowDef FPS
    {
        scripts
        {
            FPS.oldTime=FPS:get("time");

            function FPS:OnInit()
                self:set("rect", 400, 80, 120, 70);
                self:set("borderWidth", 0.5);
                self:set("text", "FPS\n");
                self:set("textScale", 0.4);
                self:set("font", "Fonts/Impact");
            end

            function FPS:OnFrame()
                local newTime=FPS:get("time");
                local deltaTime=newTime-self.oldTime;

                if (deltaTime<0.000000001) then
                    self:set("text", string.format("FPS\nINF\n(%.4f sec)", deltaTime));
                else
                    self:set("text", string.format("FPS\n%.2f\n(%.4f sec)", 1/deltaTime, deltaTime));
                end

                FPS.oldTime=newTime;
            end
        }
    }
}
... produces this GUI: http://images.ca3de-community.de/main.p ... itemId=529

I know it doesn't look very nice (it's my very first test, after all!), but it demonstrates the Lua-scriptability very well, and it's very interactive already (see script above for details, it has a lot of "toy-interactivity" for my internal tests).
Best regards,
Carsten
User avatar
Thrawn
Posts: 302
Joined: 2004-08-30, 10:38
Location: NRW, Germany
Contact:

Post by Thrawn » 2006-06-19, 17:15

Wow, that is just amazing to see. I checked the script and LUA seems to be a pretty easy scripting language, I read the script and could understand almost every single line without problems, though I'm no real programe nor scripting languages =D

The GUI implementetaion you choosed is just awesome, congrats :)
Image
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Post by Carsten » 2006-06-19, 17:17

:thanks:
Best regards,
Carsten
Sindwiller
Posts: 108
Joined: 2006-04-14, 21:11
Location: Zürich, Switzerland

Post by Sindwiller » 2006-06-19, 17:59

:groupwave1: :groupwave1: :groupwave1: :groupwave1: :groupwave1: :groupwave1: :groupwave1:

It looks sooooo awesome, i would hug you!!!! ;P

Wfr, Sindwiller
Im Working on:
- Some Linux Bash-Scripts for installing stuff. Dont ask further questions, because i can't explain that more simple ^^
n321
Posts: 28
Joined: 2006-05-12, 18:58

Post by n321 » 2006-06-21, 02:22

cool...I see your getting Lua working! and the GUI! This means custom main menu!!!!! I am working on the SP code and am getting closer to finishing...I am not as good of a coder as most! I hope you will get the save/load system set up in that fancy gui system soon! I have yet to get a doom 3 looking anything set up...any tips! Tomarrow I will take a brake from my SP code and put in a DooM 3 map and replace all ca3de weapons and monsters with that of doom 3...If it looks as good as doom 3 I will post screens! My monster code is basic for now...I will soon add to it to use a AI script instead of it being programmed into the engine! I have basic SP entities almost done, like a basic NPC, buttons, turrents, ect. When I am happy with the code I will move on to basic physics, (not Oblivion or even as good a doom 3 but closer to Halo!) I am using a friends home brewed physics system. When I am finished I will add physics specific entities and vehicles!!! I have not looked at ca3des physics but I may keep some of it! :) I have yet to also add doors (and keys) and other fun things.

BeforeI will be able to use ca3de I will need to finish my code,
Have the finished gui system
save/load
and effects like heat/haze, (Full featured ARB shader abilities like DooM 3, If you need a code example of what I need check out q2e .68's code!)

I would like to help with these features if I can!

Great work on the gui!
n321
Posts: 28
Joined: 2006-05-12, 18:58

Post by n321 » 2006-06-21, 16:13

Oh...q2e .68's code is at http://sourceforge.net/projects/q2e...it is a Q2 engine that Iused to use (also had doom 3 features) it has full ARB shader support! What was nice was if someone wanted a custom effect he could just write a new shader and describe it in the MTR! ALL Doom 3 shaders worked with q2e...ok most! :) The DeVs of q2e have a new engine called overdose (basically q2e but with updates ) and the code is released but youll have to go here to get it (full package!) http://www.quake2evolved.com/files/OverDose.zip

Hope the code can inspire whith your development of ca3de! The GL shader programs are very important!...Doom 3 actually uses one to describe how the lights manipulate the textures and normal maps! (so does q2e) I dont know how ca3de does it but it would make the modibility of the eengine better if you went this way!

good luck!
User avatar
Thrawn
Posts: 302
Joined: 2004-08-30, 10:38
Location: NRW, Germany
Contact:

Post by Thrawn » 2006-06-22, 13:13

Hey n321, that are good news! It's always cool to see new faces working with Ca3DE.

As we are very interested in your work, we would like to talk to you :)

Is there any way to contact you, like icq, msn, irc or mail?

Thanks,
Thrawn
Image
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Post by Carsten » 2006-06-29, 17:50

Here is a bit more now:
http://www.ca3d-engine.de/news.php ;)
Best regards,
Carsten
n321
Posts: 28
Joined: 2006-05-12, 18:58

Post by n321 » 2006-06-29, 17:50

Thrawn, I dont IM but Carsten has my email it is ncgproductions@hotmail.com I use this as a public email so my normal mail does not get spam!

I have stopped all work on SP code at the moment and am working on the physics. My friend (who is making the physics engine) is making it for a project for his programming class. He is very good! He is going to use Ca3de to showcas his physics! (he was trying to make a small little graphical engine with irrlicht but it was taking him too long!) He is finishing up his code and I am adding it as he finishes! The code was just going to be basic but he just keeps adding new features I can hardly keep up! it now has full ragdol and cloth simulation capabilities! (tho I am still trying to add it all to ca3de!) He says he is going for a cross between Oblivion and Quake 4! The Phisics engine is made for FPS games but has alot of advanced physics features for physics like oblivion!

I am also planning a sneek mode into the game code if I can (have not looked into it much yet) Like Oblivion where you go into sneek mode and the curser changes to tell you how hidden you are. Then I will work on sneek attack moves (like tail whipping from behind!) It will also work great for espianoge levels where you need to sneek into a facility undetected. Give the player a silenced gun and let them try to sneek by the guards, it the guards are alerted all hell brakes loose and a giant groop of guards come running! anyway just an idea that I am looking into!

I am having some problems because I am not a good programmer so the only way my friends physics will be properly implemented would be if he finishes his code and helps me. I have the basic parts of his code working but not any of the cool stuff! I cant seem to figure out how to get an advanced npc to work like doom3...I am also having issues with advanced cutsceens like doom 3! But I will keep pushing!

I have also been playing with my modeling progie again and I cant seem to get the normal mapping consept down! I have been learning to model high poly models for 2 years now and I made my SCAR as a class final. It looks great! (I think i posted it on the other thred) I have been trying to make a Low poly version for an ingame model and then to make a normal map! My low poly is never close enough to highpoly model so when the normal map is ingam it looks retarded! Also my low poly modes are to high poly! (I have never modeled a full model for video games...just altered a few...I have modeled for movies tho!)
If anyone has skill in this area and is interested in using my SCAR model in a game I will trade help for full rights to the finished model! All i want is a completed version. so...if anyone wants to hel with that and then give some pointers so that I can learn to do it myself! I would be very grateful!

anyways Ill stop hijacking this thread...Carsten hows the gui system comming this week!?
scott
Posts: 173
Joined: 2004-08-23, 09:11

Post by scott » 2006-06-30, 15:09

Nice work with the GUI system Carsten. :) How far can we go with the LUA? could you use it to add new entiies or code your game loop?
User avatar
Thrawn
Posts: 302
Joined: 2004-08-30, 10:38
Location: NRW, Germany
Contact:

Post by Thrawn » 2006-06-30, 15:30

n321,

the implementation of the physics engine sounds very cool. Good luck on that and I hope you can convince him to help you.

About the models: Ever tried box modelling? With this technique it is very easy to keep the polycount low! I'm right now in vacations but when I return in 2 weeks we surely can talk about things in detail, als I am of course willing to help you were I can.
Image
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Post by Carsten » 2006-06-30, 16:31

Hi Scott,
scott wrote:How far can we go with the LUA? could you use it to add new entiies or code your game loop?
Well, technically speaking, a set of carefully selected C++ engine interfaces is exposed to and via Lua. I will clarify the details in the documentation in the Wiki soon.
In advance, I think that you can go pretty (or say, reasonably) far. Again, the upcoming examples and documentation will clarify the details.
Entity scripting with Lua will be implemented in a subsequent step, the next update will only introduce the GuiSys, Lua scripting in general, and GUI scripting with Lua in specific. When I add entity scripting in a subsequent release, yes, you will be able to do anything with entities, including creating new ones.
You will not (maybe never) be able to code the game loop in Lua, because this is a feature that makes no sense at all to expose in a script. All features and flexibility will be provided by other means, if required.
Best regards,
Carsten
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Post by Carsten » 2006-07-02, 18:08

I would like to add another answer to Scotts question:

I was just about to re-write the Ca3DE in-game console based on the new GUI System, when I found that the command history and the TAB command completion features can be implemented by means of the related Lua script alone! Neither the engine nor the GUI system will know anything about that these features exist at all, it's all implemented in Lua.

You may think that this is a very boring and unimportant result, and that such results are not worth all the effort it takes to make an engine scriptable, but believe me, this is a very nice prime example for good code design and flexibility, and a very good demonstration of the power of the GUI scripting.
These subtle results are very worthwhile, and I'm very happy that things turn out so well.
Best regards,
Carsten
User avatar
Stephen
Posts: 75
Joined: 2006-05-01, 06:34
Location: Australia
Contact:

Post by Stephen » 2006-07-24, 14:38

Awesome! When will we see a release featuring this? It looks like great fun to play with! I hope you make something a bit better looking for the next release though...

Lua isn't compiled, is it?

-Stephen
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Post by Carsten » 2006-07-24, 15:46

Stephen wrote:Awesome! When will we see a release featuring this?
Hi Stephen, I'm currently working as fast as possible on this and a few other things (CaWE bug fixes, first replacements of the TechDemo textures etc.). I hope to be able to release an updated SDK with all the latest stuff within 1-2 weeks...
It looks like great fun to play with! I hope you make something a bit better looking for the next release though...
Yes... ;)
Lua isn't compiled, is it?
Yep, it isn't.
Best regards,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest