Dynamic add scriptsection to module
In my game I want to let players to write their own game types and add new game object type.So I think the most easy way to do this is to call AddScriptSection to dynamic add new script file and then Build to my exist GameModule,let them be in SAME module so the new gametype class can use everything defined in the exist GameModule,The same to the new game objects. But when I trace into the source code of asIScriptModule::Build(),I find out it will first release everything in the module,So I'm wondering if we can dynamic add functions and variables in version 2.18 ,will it be possible to dynamic add script section to module someday? I know I can dynamic build the script to another module:PluginModule,and use some Interface like IWeaponObj,IBodyObj and share them between two modules,But in my GameModule there are lots of game object types not only used in PluginModule but also in GameModule , So I have to include all the object class definition files in both modules.So near half of the script files have to be build twice. If there is a way to dynamic add script section to the same module it will be more easy.
Yes, I'm planning to allow you to build new script sections to already existing modules, but it is more complex than just adding a single function or variable, so it will be a while before that is possible.
However, do you really need to keep the previous game module in your case? Can't you just rebuild everything?
If you don't rebuild everything, how do you plan to make sure there is no trash from previous builds in the module? I'd appreciate your feedback and suggestions for how the library should behave in such scenarios.
However, do you really need to keep the previous game module in your case? Can't you just rebuild everything?
If you don't rebuild everything, how do you plan to make sure there is no trash from previous builds in the module? I'd appreciate your feedback and suggestions for how the library should behave in such scenarios.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Thanks for your reply
I think it will take plenty of time to rebuild everything when player choose their Game mode.There is no need to build everything at game start.
So my plan is to build a BasicModule which only ontain some UI code,like the main menu,game hall,and game room logic.When the player choose which gametype_xxx.as file he want to play,the engine will build a GameModule which contains all the game logic and UI logic.Then the only relation between the two module is a StartGame function with some game parameter.
Every GameModule writen by player should #include all game logic .as files,so they can easily use every thing in their own module ,not need to negotiate with BasicModule.When the player exit from a game room,The engine should release the GameModule and wait for player to choose next gametype_xxx.as
I think it will take plenty of time to rebuild everything when player choose their Game mode.There is no need to build everything at game start.
So my plan is to build a BasicModule which only ontain some UI code,like the main menu,game hall,and game room logic.When the player choose which gametype_xxx.as file he want to play,the engine will build a GameModule which contains all the game logic and UI logic.Then the only relation between the two module is a StartGame function with some game parameter.
Every GameModule writen by player should #include all game logic .as files,so they can easily use every thing in their own module ,not need to negotiate with BasicModule.When the player exit from a game room,The engine should release the GameModule and wait for player to choose next gametype_xxx.as
Sounds like you really don't have much to gain by merging the two modules. You're still recompiling everything in the game module for each game.
Even if/when I provide ways to compile new script sections over existing modules, the compiler would still have to compile all the script code and then compare with the original code, to make sure nothing has changed.
If you're looking to speed up your game loading you really should look into saving the already compiled bytecode, and then load that instead of recompiling the script the next time the game is started.
Regards,
Andreas
Even if/when I provide ways to compile new script sections over existing modules, the compiler would still have to compile all the script code and then compare with the original code, to make sure nothing has changed.
If you're looking to speed up your game loading you really should look into saving the already compiled bytecode, and then load that instead of recompiling the script the next time the game is started.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement