resetting scenes, sio2 resource files, and multiple levels
+2
sio2interactive
geekschmoe
6 posters
resetting scenes, sio2 resource files, and multiple levels
So this is an SIO2 game architecture question.
Let's say I have a game with 1 player (3rd person run around game like tutorial09), 2 levels and 3 types of non-player character objects. One non-player character object is only in level 1, one is only in level 2, and the last is in both levels. What's the proper high level algorithm for doing this with blender/sio2? Would you be copying some objects into multiple resource files (duplication) for simplicity's sake? I'm assuming blender layers could play into this some how, but that seems unlikely considering that everything must be in layer one for the sio2 export script to work correctly.
Can you use multiple *.sio2 files (one for each level maybe) in one application? If so, how do you switch between them?
Can you load up two sio2 resources bundles simultaneously and mix/match objects?
Given just 1 resource bundle, can you reset the state (re-load)? In terms of game architecture, I'm assuming you would also need to clear game state variables, so what's the preferred method of doing this.
Any help is thoroughly appreciated (especially links to wiki/forum/tutorials that I may have missed regarding this topic).
Let's say I have a game with 1 player (3rd person run around game like tutorial09), 2 levels and 3 types of non-player character objects. One non-player character object is only in level 1, one is only in level 2, and the last is in both levels. What's the proper high level algorithm for doing this with blender/sio2? Would you be copying some objects into multiple resource files (duplication) for simplicity's sake? I'm assuming blender layers could play into this some how, but that seems unlikely considering that everything must be in layer one for the sio2 export script to work correctly.
Can you use multiple *.sio2 files (one for each level maybe) in one application? If so, how do you switch between them?
Can you load up two sio2 resources bundles simultaneously and mix/match objects?
Given just 1 resource bundle, can you reset the state (re-load)? In terms of game architecture, I'm assuming you would also need to clear game state variables, so what's the preferred method of doing this.
Any help is thoroughly appreciated (especially links to wiki/forum/tutorials that I may have missed regarding this topic).
geekschmoe- Posts : 14
Join date : 2009-06-22
Re: resetting scenes, sio2 resource files, and multiple levels
I personally use the following structure in all my personal SIO2 project:
game
- player
- hud
- level1
- level2
etc...
All the structure contain an independent SIO2resource and a Init, Free, Render function, like that you can load / unload and access every part of your game using a main handle (similar as the SIO2 structure).
game
- player
- hud
- level1
- level2
etc...
All the structure contain an independent SIO2resource and a Init, Free, Render function, like that you can load / unload and access every part of your game using a main handle (similar as the SIO2 structure).
Re: resetting scenes, sio2 resource files, and multiple levels
In blender, you can create a scene for every level and duplicate (linked or not) objects from the various scenes. That works.
So every scene in blender would have its own .sio2 file corresponding to the level and that you can load / unload in your game using the sio2Resource**** load/unload/free/etc functions...
So every scene in blender would have its own .sio2 file corresponding to the level and that you can load / unload in your game using the sio2Resource**** load/unload/free/etc functions...
Francescu- Posts : 136
Join date : 2009-03-18
Re: resetting scenes, sio2 resource files, and multiple levels
trying to load resources from another .sio2
What I make wrong? may be i chose wrong way? I can load other sources before main scene, but think that it is not good idea =)
- Code:
myResource = sio2ResourceInit();
sio2ResourceCreateDictionary( myResource );
sio2ResourceOpen( myResource, "Gun.sio2", 1 );
i = 0;
while( i != myResource->gi.number_entry )
{
sio2ResourceExtract( myResource, NULL );
++i;
}
- Code:
sio2->_SIO2resource = _SIO2resource;
What I make wrong? may be i chose wrong way? I can load other sources before main scene, but think that it is not good idea =)
alexanderlonsky- Posts : 24
Join date : 2009-06-11
Re: resetting scenes, sio2 resource files, and multiple levels
Just create separate SIO2resource handles... then bind them to the main context (sio2->_SIO2resource) when needed...
You can easily maintain something like:
SIO2resource *level;
SIO2resource *ui;
SIO2resource *player
That's what I personally use... after that is just a question of "load/unload" when needed
You can easily maintain something like:
SIO2resource *level;
SIO2resource *ui;
SIO2resource *player
That's what I personally use... after that is just a question of "load/unload" when needed
Re: resetting scenes, sio2 resource files, and multiple levels
sio2interactive wrote:Just create separate SIO2resource handles... then bind them to the main context (sio2->_SIO2resource) when needed...
that is the problem.. I do not understand may be =)
how to create separate SIO2resource handles?
as i understood I should use -
- Code:
myResource = sio2ResourceInit();
sio2ResourceCreateDictionary( myResource );
sio2ResourceOpen( myResource, "Gun.sio2", 1 );
i = 0;
while( i != myResource->gi.number_entry )
{
sio2ResourceExtract( myResource, NULL );
++i;
}
sio2ResourceClose( myResource );
sio2ResourceResetState();
sio2ResourceBindAllImages(myResource );
sio2ResourceBindAllMaterials( myResource );
sio2ResourceBindAllMatrix( myResource );
sio2ResourceGenId( myResource );
sio2ResourceAdd(myResource, ...)?
but for example sio2ResourceExtract( myResource, NULL ); breaks or rewrites sio2->_SIO2resource.
sorry, I am confused, may be need to sleep more =)
alexanderlonsky- Posts : 24
Join date : 2009-06-11
Re: resetting scenes, sio2 resource files, and multiple levels
SIO2 expect that all type of resource are added inside the global sio2->_SIO2resource... so when you init multiple resource make sure that:
- Code:
// Within your "game" structure
SIO2resource *myResource = NULL;
SIO2resource *player = NULL;
...
...
sio2->_SIO2resource = myResource = sio2ResourceInit();
sio2ResourceCreateDictionary( myResource );
sio2ResourceOpen( myResource, "Gun.sio2", 1 );
...
...
sio2->_SIO2resource = player = sio2ResourceInit();
sio2ResourceCreateDictionary( player );
sio2ResourceOpen( player, "player.sio2", 1 );
...
...
Re: resetting scenes, sio2 resource files, and multiple levels
a-a, understood, thanks. huge my problem - I used sio2->_SIO2resource for rendering that was rewrited.
"do not work more than 8h per day - it is not worth of it "
"do not work more than 8h per day - it is not worth of it "
alexanderlonsky- Posts : 24
Join date : 2009-06-11
render function.
Is there a way to bind all these resource under a singe resource object during init of the game.
or do I need to call, say sio2ResourceRender function twice, Once for main character and once for the level
sio2ResourceRender( m_pMainCharacter,
sio2->_SIO2window,
sio2->_SIO2camera ,
SIO2_RENDER_SOLID_OBJECT | SIO2_RENDER_CLIPPED_OBJECT);
sio2ResourceRender( m_pLevel,
sio2->_SIO2window,
sio2->_SIO2camera ,
SIO2_RENDER_SOLID_OBJECT | SIO2_RENDER_CLIPPED_OBJECT);
or do I need to call, say sio2ResourceRender function twice, Once for main character and once for the level
sio2ResourceRender( m_pMainCharacter,
sio2->_SIO2window,
sio2->_SIO2camera ,
SIO2_RENDER_SOLID_OBJECT | SIO2_RENDER_CLIPPED_OBJECT);
sio2ResourceRender( m_pLevel,
sio2->_SIO2window,
sio2->_SIO2camera ,
SIO2_RENDER_SOLID_OBJECT | SIO2_RENDER_CLIPPED_OBJECT);
evrenbingol- Posts : 7
Join date : 2009-07-12
Re: resetting scenes, sio2 resource files, and multiple levels
Well for the main character I believe that it is always visible... and you have one of them... so basically you do not need to effectuate some clipping and you can simply use the sio2ObjectRender function...
Re: resetting scenes, sio2 resource files, and multiple levels
sio2interactive wrote:I personally use the following structure in all my personal SIO2 project:
game
- player
- hud
- level1
- level2
etc...
All the structure contain an independent SIO2resource and a Init, Free, Render function, like that you can load / unload and access every part of your game using a main handle (similar as the SIO2 structure).
So, you're saying that a good "best practice" to follow would be to add a "games" folder to the project, with player, hud, & level subfolders, then essentially create each one as an SIO2resource with its own Init, Free, and Render functions, then call those based on events in game from the template.mm file? Is that right?
Thanks.
cdicelico- Posts : 8
Join date : 2009-08-06
Re: resetting scenes, sio2 resource files, and multiple levels
no no no... not at all check the source of MeditationGarden to see what I mean... the structure used there is good for ANY type of game.
Re: resetting scenes, sio2 resource files, and multiple levels
Ah, okay, thanks.
cdicelico- Posts : 8
Join date : 2009-08-06
Similar topics
» Using Multiple Resources and sio2 files
» Loading multiple scenes - fastest way?
» Problem using multiple source files
» About resource management in blender that work with SIO2
» .CPP files using the SIO2.h include?
» Loading multiple scenes - fastest way?
» Problem using multiple source files
» About resource management in blender that work with SIO2
» .CPP files using the SIO2.h include?
Permissions in this forum:
You cannot reply to topics in this forum