eugene.litvinov Posted February 28, 2011 Share Posted February 28, 2011 It's not clear part of developing process for me ). This logic have several different patterns, and it will be interesting to know, what pattern who used. For example, before in development process I try to save ability to pass from editor mode to game mode and back for game designers. I used next logic: int update() { if (engine.console.getActivity()) return 1; Timeline::update(); if (engine.editor.isLoaded()) { if (Source::editor != NULL) Source::editor.update(); else { Source::editor = new Source::Editor(); Source::editor.init(); if (Source::game != NULL) { Source::game.shutdown(); delete Source::game; } } } else { if (Source::game != NULL) Source::game.update(); else { Source::game = new Source::Game(); Source::game.init(); if (Source::editor != NULL) { Source::editor.shutdown(); delete Source::editor; } } } return 1; } So when user load editor, game logic shutdowns, and editor logic initializes. This is not very easy, cause I need remove all created objects, remove all callbacks and gui elements for avoid errors. And in game mode we have standard unigine settings dialog, that calculated in systemUpdate() call - that is not good. When we could see OilRush source code I was surprised, cause it use another pattern: int update() { #ifdef EDITOR systemUpdate(); #endif update_error_exit(); return 1; } So editor/game mode defined on preprocessing step. This is not very convenient for game designers, cause they must close unigine, change source code (add/remove define line) and execute unigine again - for change editor/game mode. But this convenient for developer: not necessity remove all callbacks and objects, and we not use system Init/Update/Shutdown functions so we have not standard settings dialog and can use own game's menu. Question: In OilRush checks define EDITOR both in unigine.cpp and waterwar.cpp, this files not binded (included each other), so user must write #define EDITOR in both this files to enable editor mode, or you have some technique to do this through bat-launcher or something else? How it could be automatized and could be more transparent and easy for designers? Thanks. Link to comment
frustum Posted March 1, 2011 Share Posted March 1, 2011 Question: In OilRush checks define EDITOR both in unigine.cpp and waterwar.cpp, this files not binded (included each other), so user must write #define EDITOR in both this files to enable editor mode, or you have some technique to do this through bat-launcher or something else? How it could be automatized and could be more transparent and easy for designers? Thanks. There is "-extern_define" command line option to specify extern preprocessor defines to all scripts. We use several python based launchers in OilRush: -extern_define FAST_START_GAME,DEBUG_LOG,PROFILE,FSG_LEVEL_8 -extern_define EDITOR Link to comment
eugene.litvinov Posted March 1, 2011 Author Share Posted March 1, 2011 Thanks, it's useful! Link to comment
Recommended Posts