![]() |
|
Loading... |
Tomoso
Member #3,128
January 2003
![]() |
Just a quick question. My images are all packed into a DataFile and are updated onto the buffer as such: // Draw Ship Sprite to Screen draw_sprite(buffer, (BITMAP*)datafile[ship4].dat,m_X,m_Y);
Is that right? Or should the images from the data file be loaded into memory bitmaps say at the start of the level and then loaded that way. I'm not sure if that would be faster. Or even worth it. Lazy Noob - Blog |
Richard Phipps
Member #1,632
November 2001
![]() |
You could have a seperate "loading text" bitmap which you load first and display to the screen. You then could load all the other images, sounds and music files you need while the player is looking at the loading screen. |
miran
Member #2,407
June 2002
|
Quote: I know that may seem like the dumbest question ever, but what would I actually "loading" if I had one. You would be loading images, sounds, music and videos. You could also be precalculating things that aren't stored in files but can be calculated from mathematical models before the main loop so you don't have to calculate them during gameplay. -- |
ixilom
Member #7,167
April 2006
![]() |
Quote: I was just wondering why would I need one for my game? The only reason for having a "loading screen" is when you know for sure its going to take a while to cache images/sounds and precalculate stuff. For a simple game with 20 images or so, its not necesary. Think of games like Half Life, Quake. They need to load/cache hundreds of textures, load map coordinates for planes etc. A Quake map can be 1mb to XX mb big with only x/y/z cordinates that build up the floors,ceilings,walls, details etc. ___________________________________________ |
Tomoso
Member #3,128
January 2003
![]() |
OK, but // Draw Ship Sprite to Screen draw_sprite(buffer, (BITMAP*)datafile[ship4].dat,m_X,m_Y);
or should i load that into another bitmap? Lazy Noob - Blog |
Kitty Cat
Member #2,815
October 2002
![]() |
That is fine. -- |
Johan Halmén
Member #1,550
September 2001
|
load_datafile() loads everything from the datafile to the ram memory, right? And after that you don't gain any speed by loading the bitmaps to other bitmaps, right? I have never done this, but I need it for my next game. I'm thinking of a following kind of structure: DATAFILE *startupscreen, *data; ... startupscreen = load_datafile("data1.dat"); blit((BITMAP*)startupscreen[0].dat, screen, 0, 0, 0, 0, 1024, 768, 1024, 768); unload_datafile(startupscreen); data = load_datafile("data2.dat"); // other stuff, precalculations, lookup tables... ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
Felipe Maia
Member #6,190
September 2005
![]() |
Quote: load_datafile() loads everything from the datafile to the ram memory, right? And after that you don't gain any speed by loading the bitmaps to other bitmaps, right? You won't loose hardly any speed if you doBitmap *first = startupscreen[0].dat; [edit] |
Tomoso
Member #3,128
January 2003
![]() |
OK, thanks, but just slightly changing the topic just a little. Yesterday night I decided to "clean" up my data files. Origonally I had one huge one that had everything. But it was a pain to update it since my PC is rly slow (288mhz;)). DATAFILE* m_pEnemyData = load_datafile("Data/datafile_enemy.dat");
This should only load it once since the class is created only once m_pCurr = new Enemy(x,y,type,direction,m_pEnemyData);
Which is then stored to a pointer within the enemy class itself. Oops that was bit long winded for a simple question but oh wells. Lazy Noob - Blog |
Felipe Maia
Member #6,190
September 2005
![]() |
You're probably doing something wrong. A reference copy is really fast. You shouldn't need to have a copy for every enemy you create, except if they're different (i.e: each enemy has a different datafile). You could have a static class or something like that that will use the datafiles, instead of the objects themselves. This won't make your game faster though, but it will use less memory depending on what you have. |
Tomoso
Member #3,128
January 2003
![]() |
Thanks, instead I loaded all the datafiles within the constructor of the GameEngine class and passed them through to their respected owners as they needed to be drawn. Except now I have some other wierd bug that just crashes my program if the player doesnt create a bullet before the enemy Lazy Noob - Blog |
|