Jump to content

VeTaL

Members
  • Posts

    1,272
  • Joined

  • Last visited

Everything posted by VeTaL

  1. //And I am doing 1/2 the panel width to the left. Pretty strange - it souldn't be like on your pictures... Try to simplify calculations and comment out second step (moveing panel up)
  2. //Maybe get the width of the AABB bounding box showing on-screen and adjust pixels appropriately? Looking like its too long.. Rick, maybe you sould just take the origin of model (if it is in center in 3d), move up (in 3d) and move (in 2d) panel half-of-its-width left?
  3. VeTaL

    River Editor

    http://www.leadwerks.com/werkspace/topic/3684-river-nodes/ Here i found old version.
  4. Some time ago i found water nodes in Jenklyn Heights project, but looking like it dont works properly in last versions. River.rar Maybe someone can fix it?
  5. Quite interesting, what was the source of this trouble.
  6. According to this thread and franck's request, i decided to upload my small working example of Cegui, which is done by this tutorial. First, you should download Binary version of cegui CEGUI-SDK-0.7.5-vc8.zip (you'll need SP1 for msvs 2008) or CEGUI-SDK-0.7.5-vc10.zip Consilder Cegui is installed in z:\CEGUI\cegui\include folder, and Leadwerks is in Z:\Leadwerks Engine SDK\CPP If not, open project's settings "Property -> C/C++ -> General -> Additional include directories" and change this string "Z:\Leadwerks Engine SDK\CPP;z:\CEGUI\cegui\include" so it will show pathes to your sources. Also change "Property -> Linker -> General-> Additional library directories" from "Z:\CEGUI\lib\" to your path to libs. Looking like thats all - it should works nice: Example (with sources, project for msvs 08, cegui datafiles and exe-file):
  7. That has a sence. This also has a sence, but States are already designed to do this job Just alternative way. Yes i can, but i like "interface" more Also agree. But, as i said, i have RenderState and sometimes i need RenderEvent (which is inherited from another interface). But i'll remove them from this example to be more clear
  8. Anyway, thanks I'll look into WPF - i'm think about it for some month
  9. 2 Rick: you should also look at http://addonstudio.codeplex.com/
  10. Big thanks to TheoLogic: i always knew that writing articles for others hepls myself a lot Yep, fixed. States classes are created one time per launch, but anyway, mistake took a place. Well, you can add one more state-rememberer to "_previousStateReturns = _stateReturns;" But generally, this is designed for MainMenu -> Options button -> OptionsMenu -> Save button -> MainMenu -> Start game button Generally, this system was designed exact for that. You just add new SplashState and FadeState. Or you can add private variable, which will be set to 0 while state Activation, and runs it from 0 to 100 in Update. And menu is unactive if this variable (consider fading) is less than 100. They are wellcomed Yep, why not? It was designed to type "GameStatesEnum." and get the list of all states Typos: usually i use underscore prefix only for private fields. Not sure i understand you right. In real project, i have functions *State - they are inherited from IGameStates *Event - they are inherited from IGameObject But that's another story
  11. As i collected some basic information and even tried to cathegorize it in one place (via LeaFAQ), i decided to contribute something from my own experience. This time it should be an article (i dont know now, how long this post will be) about menu state machine. Additionaly, there would be some information about interfases and inheritance. I didnt wrote atricles for a long time. Last time it was in about 2006, about 3DGameStudio, in Russian language (some states dated 2006-2007 are mine ...Nostalgy... ). Healthy critic is wellcome (even about grammar mistakes), as this is my first article in English. The main idea was taken from Irrlicht forum, when i made a game prototype for Gameloft content. So, lets rock! 1. We have inerface - the abstract class, that can't be instanced. Our game states we will be inherited from this interface. // IGameStates.h interface IGameStates { public: string name; virtual void Activate()=0; virtual void Deactivate()=0; virtual int Update(float deltaTime)=0; virtual void Render(float deltaTime)=0; virtual ~IGameStates() {}; private: }; gameStateName; is optional, for debug reasons. Note that function is written like "Activate()=0", that means that functions must be defined in child class or you'll get an error. 1.1 Also, we should have enumeration of all our game states. Commented code will show some possible usage of this system. // IGameStates.h extern enum GameStatesEnum { //LogoState = 0, //SplashState, //LoadingState, MenuState = 0, GameState, ChatState }; [!!!]We will call states(integer) as MenuState, and states(classes) as StateMenu, so please, be carefull. 2. Next, we will make new class, which will describe game state. First one will be main menu, here we should define those interface functions // StateMenu.h class StateMenu : public IGameStates { public: StateMenu(void); virtual ~StateMenu(void); // IGameStates virtual void Activate(); virtual void Deactivate(); virtual int Update(float deltaTime); virtual void Render(float deltaTime); *** } 2.1. Activate() describes activation of certain state (of cource, you can add Initialize() and call this only first time to load all resourses). In my case it will be // StateMenu.cpp void StateMenu::Activate() { _isLoginChatPressed = false; _isLoginGamePressed = false; _isQuitPressed = false; **** } DeactivateState(), obviously, describes deactivation of that state. Theese both functions will be called each time when game state would be changed to MenuState. 2.2. UpdateState() is one of the most interesting parts. As you may notice, it returns int. [!!!] The main feature: in the main loop we will call this update function and we will check result. If state is the same (user didnt do anything), it should returns its own state. If not - it whould returns next state. I'll explain this little later, while describing main loop. // StateMenu.cpp int StateMenu::Update(float deltaTime) { SingletonOisManager.Update(); if (_isLoginChatPressed) { return ChatState; } if (_isLoginGamePressed) { return GameState; } if (_isQuitPressed) { SingletonGameManager.SetQuit(true); } return MenuState; } So, if player set one of this flags to "true", Update function will return ID of new state. RenderState() is just a simple render of menu of 3d world. //StateMenu.cpp void StateMenu::Render(float deltaTime) { SingletonGuiManager.Render(deltaTime); Flip(1); // 1 = 60, 0 = unlimited } 3. StateGame is the same, but it renders whole world, instead of Gui. StateChat is UI for testing network. 4. In the header of our GameManager class (class, which contains main loop) we should make a container for all states. // GameManager.h IGameStates* _activeState; vector <IGameStates*> _listOfStates; int _stateReturns; int _previousStateReturns; Note, that vector holds IGameStates*, the parent of StateGame, StateChat, StateMenu and so on. 5.1 In the body of our GameManager class, we should create and store all our states to vector // GameManager.cpp _listOfStates.push_back(new StateMenu()); _listOfStates.push_back(new StateGame()); _listOfStates.push_back(new StateChat()); Now, we should select, which state will be the first. [!!!] Note, this is perfect for development: if you wish to work on your menu, you just set first state to load from. If you want to work on your game, you set game state. If you want to show it to your girlfriend (including splashscreen), you set splashscreen first, the next will be menu, and so on . After that, we should activate selected state and run it for the first time. // GameManager.cpp _activeState = _listOfStates.at(0); _activeState->Activate(); _stateReturns = _activeState->Update(0); // if you'll set here 0, you'll get StateMenu, if 1 - ypu'll get StateGame and so on _previousStateReturns = _stateReturns; 5.2 Main loop Its simple. Really // GameManager.cpp // Main loop float CurrentTime = AppTime(); _deltaTime = (CurrentTime - _elapsedTime) * 0.001f; //1 _elapsedTime = CurrentTime; _stateReturns = _activeState->Update(_deltaTime); //2 _activeState->Render(_deltaTime); //3 if (_stateReturns != _previousStateReturns) { // 4 _previousStateReturns = _stateReturns; _activeState->Deactivate(); // 5 _activeState = _listOfStates.at(_stateReturns); // 6 _activeState->Activate(); // 7 } At first (1), we're counting deltatime. Next (2), we run UpdateState() and save results. Result can be the same state or new one. Then (3) we Render current state. Last step: we check (4) the result of UpdateState() with current state. If they are equal - its okay. If they are not equal, we should Deactivate current state(5), set new state (6) and activate it(7)! The loop is over, and it waits for new state changes. PS: if you'll ask me, how i set _isLoginChatPressed in StateMenu::UpdateState(), i'll answer that i'm also using event system, where each entity can be subscripted for a sertain event and be rised in time. This is large article, probably i'll make another one. Also, i'm using imgui, which is perfect for debugging, as its code-driven UI. void StateMenu::RenderGuiEvent( float gameLoopTime ) { imguiBeginScrollArea("Main Menu", 400, 250, 200, 200, &_debugScroll); _isLoginChatPressed = imguiButton("Login to chat",true); _isLoginGamePressed = imguiButton("Login to play",true); _isQuitPressed = imguiButton("Quit",true); imguiEndScrollArea(); } PPS: GameManager contains "Manager" on its end because its singleton. PPPS: "We will call states(integer) as MenuState, and states(classes) as StateMenu, so be carefull." This can disappoint for the first time, but believe me, its really simple.
  12. Just looked through forum and searched through scripts in LE SDK - didnt find anything usefull. But i rememver that soft particles are already implented.. or i'm wrong?
  13. Thanks for answer, added to LeaFAQ
  14. Its book from 2002-2003, it was printed almost 10 years ago Some steps in this direction should be done obviously. PS: just wanted to remark that distance culling is not enough, as for me
  15. http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter06.html
  16. Yeah, no one important bug... Catch one more simple bug (which is really unimportant)
  17. looking like this is good for instanced models? This reminds me
  18. //But if you post a Facebook and Twitter update and someone reposts it, it will still contain your referral ID. Nice!
  19. //If that person eventually makes a purchase on Leadwerks.com, you will receive 10% of the sale price of anything they buy. And what about person, who was invited by person, who was invited by me?
  20. I think Aily is talked about standard window like in Ogre. Just for launch + of cource, possibility to change render on fly
  21. http://insidious.pt/#amplify
  22. // reapidly growing function list which are already added to the dll: is this DLL avaivable?
  23. Hope, you'll fix all known bugs before releasing evaluation kit
×
×
  • Create New...