Archived

This topic is now archived and is closed to further replies.

Keattikorn

Implement "Loading" Screen in Common framework (DX8.0)

Recommended Posts

Now i render some screen and next want to change to another screen that contain many X files object (slow to load) and i want to make a "Loading" screen.How should i do? (Please tell me how or an idea , in Common framework it load object one time in InitDevice Objects() <--that take a long time )

Share this post


Link to post
Share on other sites
1- load your "loading" image in one time init or where you want.
but before the first render.
2- Render your image displaying loading screen (just one flip)

in the next Framemove load all your object and voila...
don''t forget to discard your waiting screen when your ready.

You can implement also a moving bar or an animated loading screen
But I highly suggest that you focuse more on your game and less on candy like that. An unfinished game with superb loading screen doesn''t worth to much.


Dan

Share this post


Link to post
Share on other sites
You need to have a function that will render the loading screen
flip the buffer to display it then give the hand to your loading routine.
For now I have implemented a simple function that display "loading" in a blue screen using font ... later perhaps
I will implement displaying an image but the player don''t buy game for loading screen ? do they ?
Notice DrawFont() is my hown function taking care of the font''s size while screen resolution change and centering also the font.

Here the function

  
void G_ScreenOption::LoadingScreen(void)
{
// Clear the scene

m_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(0,0,100), 1.0f, 0x00000000 );

// Draw scene

if( SUCCEEDED( m_pd3dDevice->BeginScene() ) )
{
//////////////////////////////////

// Draw the text loading

//////////////////////////////////

DrawFont("Loading Menu",350,m_dwTextColor,m_pFont,CENTERED);
m_pd3dDevice->EndScene();
}
// Show the frame on the primary surface.

m_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}


Then in your framemove you can do something like that:
  
void Framemove()
{
switch(GameManagment)
{
case 1: // loading the first scene object

LoadingScreen(); // display the waiting screen

LoadFirstSceneObject(); // your loading routine

GameManagment++;
break;
case 2: // we are doing framevove for the scene 1

// here you can increment

// GameManagment when it''s

// time to load the second

// scene

FirstSceneFramemove();
break;
case 3:
LoadingScreen(); // send the screen

ClearFirstSceneObject(); // eventually

LoadSecondSceneObject(); // your loading routine

GameManagment++;
break;
case 4: // we are doing framevove for the scene 2

FirstSceneFramemove();
break;
}
}

// then in the render screne you will have something like that:

void Render()
{
switch(GameManagment)
{
case 1:
// normally we don''t come here

break;
case 2:
DrawSceneOne();
break;
case 3:
break;
case 4:
DrawSceneTwo();
break;
}
}


I don''t use exactly this method there is a lot of method that you can use it depend mainly what kind of game you write (ie: one scene , multiple scene, in game object loading ect ect).
The tips here is that you need to have some game logic managment and not just one big loop containing all your stuff.
Changing GameManagment value will allow you to have everything you want, option screen, main screen , various scene etc etc

Don''t be afrraid about the call I use four level of calling from
Framemove() Render() before my game do actually something on screen I didn''t saw any performance hit. on the other side
One loop containing all the stuff is a good way to crash your game while as it grow understanding/debugging/adding stuff
will become very difficult. (crashed my first project 4 years ago cause this)

I use also (but don''t recall) a Dx8 command that flush all the texture from video memory so when I''m done with the main screen
I start my scene with a fresh memory.

If you don''t get at all the idea behind this I''m afraid you will need to learn some more before writing a complex game.

Good luck

Dan

Share this post


Link to post
Share on other sites