Hi Spidermack,
i haven't actually tried exporting with no scene and imagine that could crash... will test later..
![Razz :P](./images/smilies/icon_razz.gif)
Deploy .exe in Skyline what are the scenes included by default ?
When you simply export a scene without setting up a game manager, it will export the scene you are currently running. An automatic game manager is created and the scene exported ends up with a tag of main. This allows the New game button to call the scene tag main and load that scene.
Where does the menu comes from ?
Because these are default skyline files, the menu GUI files are located at:
"$(InstallDir)\Bin\Data\GUI\Rocket\assets\SkylineOptionsScreen"However, if you create your own pause menu GUI, then it would be best if you created it inside the
"Asset LIbrary/GUI" folder or your
"$(Project)/GUI" folder.
Then if you look at a custom game manager in the editor, you will notice that the pause menu can be specified in the panel.
When it comes to customizing the pause screen, you could easily take a copy of the pause menu folder and copy to one of the folders specified before, then use the GUI editor inside skyline to customise it or make a new one entirely.
The pause menu is then controlled by a GUI script that is included into the game manager script. But before we talk about the GUI script, we need to talk about the Game Manager script.
The game manager is fully programmable meaning that you can do what you want in any order as the engine and end game loads. For example, if you dont need a pause screen, then you dont have to have one... Its like any other script in skyline.So the default game manager script is called:
DefaultGameManagerScript.lua and this is located at:
"$(InstallDir)\Bin\Data\Scripts".
If you want to write your own custom game manager script, then simply copy or create a new file that is then placed into the asset library or project library.
A game manager script has a few event calls from the engine, everything else is done by yourself.
At bare bones, this is what a game manager script looks like and all these functions are called from within the engine as the end game loads or a level is changed.
- Code: Select all
-- | ======================================================================================
-- |
-- | MAIN GAME MANAGER FUNCTIONS WHICH ARE CALLED AS THE ENGINE IS BOOTING
-- | ( These are required functions for the game manager )
-- |
-- | ======================================================================================
-- Game Script initialisation, called when the game is started.
-- This function is called after the root of the renderer has been created.
-- No resource groups have been loaded yet apart from the game.pak or game.zip or game folder
-- located in the assets. ( This makes no sense to be used in the editor, but only for end game low level specifics. )
function main()
end
-- This function is called directly after the game render window is created,
-- it makes it useful so you can grab the render settings directly after the window is made.
-- This function is only called from end game or editor player. The editor does NOT call this
-- function. Please see the main() function for more information.
function renderWindowCreated()
end
-- This function is called once the main game loading screen has closed and is a good time to
-- open your new game menu if you have one.
function engineStarted()
end
-- | This function is called before all other scripts keydowns that are running in the game.
-- | It makes it useful for booting or displaying a custom pause menu when the escape key
-- | is pressed for instance.
function onKeyDown( key )
end
-- Called at the start of a scene / level load
function levelChanged( newLevelName )
end
-- Called after a scene has been loaded..
function levelLoaded( newLevelName )
end
Everything else in the default game manager script is customisable.
So next if you look at the top of the
DefaultGameManagerScript.lua script, you will see this:
- Code: Select all
-- | Include the Pause menu Script here:
-- | Note: The second argument(optional) is the resource group to look in to pull the script from.
-- | In this case we want it from the Game group as its our default pause screen which is apart of the
-- | required assets for every game.
sky.include("DefaultPauseMenu_GUI.lua", "Game");
This includes the default pause menu GUI controller script that is located at the same location as the default game manager script. All the GUI script does is has the callbacks setup in the GUI RML files and a few functions that are called from the game manager script that helps to initialise, load, save, show , hide etc...
You could write your own pause menu script or if using a copy of the default pause menu, then take a copy of this script and add it to your custom game manager instead...
How to make the menu "new game" point to our main scene ?
In the default game manager, when you give any added scene the scene tag of main in the game manager panel, then that scene will be the default scene to load. This is not required if you write your own game manager though as you can load whatever scene you want. Take a look at the
DefaultGameManagerScript.lua line: 155-159- Code: Select all
-- This is the custom hook from the new game option of the pause menu.
-- The new game will only appear on first boot and then be hidden for the rest of the game.
function startNewGame()
lprint("[Game Manager] Start new game!");
sky.loadSceneByTag("main");
_levelHasBeenLoaded = true;
end
This is simple a callback function that is called from within the GUI script when the new game button is clicked.
DefaultPauseMenu_GUI.lua line: 315 - 319
- Code: Select all
function PauseMenu_StartNewGame()
if startNewGame~=nil then
startNewGame();
end
end
When you press the new game button in the GUI, this function is called which in turn calls through to the game manager function startNewGame() only if that function exists. The if function~=nil, is a lua way of checking whether a function you wish to call exists or not which is why the GUI script is sharable between different game managers.
The rest of the system is mostly the same.
Would some tutorial be needed ?
Some tutorial and documentation will be written once i have time to do so
![Smile :)](./images/smilies/icon_e_smile.gif)
Also clicking on new game the application crashes.
Hmm, this shouldn't happen, do you have a process i can follow to reproduce this?
![Smile :)](./images/smilies/icon_e_smile.gif)
Should the new game checks there is some valid scene ?
Yes and if it doesn't, then i need to fix this.
Hope this clears it up for you a bit
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)