-
Notifications
You must be signed in to change notification settings - Fork 59
The engine basics
Welcome to the OpenVIII wiki!
The OpenVIII engine implementation is following the same scheme as vanilla game does- it works on modules and giant Update() method that determines next step by a switch.
At the beginning the game should initialize basic stuff- in vanilla it does the registry querying, memory initialization. In OpenVIII we init the core HUD graphics, init FFMPEG, DirectMusic and/or fluidsynth WIP. Normally in vanilla the game initialized the audio for example just at the first time a music was played- that produced ~500ms delay- by putting everything into Initialize()
of Game1.cs the user no more has lag in-game. This also includes static based modules. They are ready to read files and begin with the logic as soon as the game starts.
The next step is going into the main loop of Game1.cs:Update()
. The main loop opens MemoryHandler.cs
and from there redirects the Update() - logic method and Draw() - rendering method to wanted module.
ModuleHandler is the most important class as it's the main director of what is happening. It works on variable module
that belongs in Memory.cs
. The first module that is played to player is "Overture module"->MODULE_OVERTURE_DEBUG. Therefore the game main loop for every frame/tick calls (i.e. if for draw()) the Game>ModuleHandler>Overture module draw method
Every module has inner modules (just like vanilla). There modules are:
- FFInitDirector -> this is Game1.cs:Initialize()
- FFOpeningModule/FFDemoModule -> this is MODULE_OVERTURE_DEBUG
- FFMainMenuModule -> this is MODULE_MAINMENU_DEBUG
- FFFieldModule -> MODULE_FIELD_DEBUG
- FFBattleDirector -> MODULE_BATTLE_DEBUG
- FFWorldModule -> MODULE_WORLD_DEBUG
- FFBattleTransitionModule -> NOT YET IMPLEMENTED
- FFMenuModule -> ???
- FFCARDGAME -> NOT YET IMPLEMENTED/ tests in MODULE_CARD_TEST (this contains images of cards shown in game menus, not card game)
The modules can be switched in real-time, so you can play battle module, fight for example 10 seconds with monsters, then get immidiately into cardgame, play cardgame and then get back to battle in the state where you left it. Thanks to that you can switch what you see on the screen and still keep the logic unchanged (because given module file has no Update() and Draw() called, but already have inner module set to 'after basic initialization', so changing the module is actually changing whatModuleHandler:Draw()
andModuleHandler:Update()
is calling (on which file, on what module)
Vanilla reverse engineering wiki: https://wiki.ffrtt.ru/index.php?title=FF8