How to load the game data?

BlitzMax Forums/BlitzMax Programming/How to load the game data?

tagoror(Posted 2010) [#1]
Hello,

I would like to know your opinion about how to load the graphics, music, etc into the game.

What do you recommend, load everything at first or between each level?

Regards,

Javier


Htbaa(Posted 2010) [#2]
It depends on how much data you need per level, or even per scene. If your game is small and fits easily inside memory then sure, go ahead. The player will have to wait a bit before everything is loaded, but after that every level transition should be possible without delay.

However, if you need a lot of data per level (or scene) then this is not the best method.


ImaginaryHuman(Posted 2010) [#3]
One suggestion I have is to load stuff without ever giving away to the player that you're doing so. It doesn't matter when. Spread it out if you have to. But make sure they are not kept waiting. Progress bars are awful. The word `loading` on the screen is awful. The player has no interest in nor desire to know about loading of files. It breaks the experience of the game. Always do it secretly in the background, in the dead-time while a title screen is showing, little bits at a time as your title screen fades out, whatever you can to do it smoothly and unnoticeably.


Mahan(Posted 2010) [#4]
Bruceys serialization mod + threading should do the trick, with the added bonus that you can exit XML-files with a good editor for Types (classes) you haven't written an editor for (yet).

(Haven't tried this threaded but it should work without any problems.)


byo(Posted 2010) [#5]
Hmmm... in my opinion progress bars and loading screen are recommended. You load every level data at once (make sure it doesn't take too long... test your game with an old computer).

Having a loading screen is consistent. The player of your games will be very annoyed if the game crashes while he's playing a level because it can't find a resource or it's corrupted... and he hasn't saved the game for a while. Trust me. It's something you really don't want to deal with. ;)


Russell(Posted 2010) [#6]
Do some tests to see how much time it takes to load the level data. If it's only a few seconds, then don't display anything to the user. If it's a large amount of data (say some gigantic fully textured RPG), then it could be longer and should maybe have a progress bar, etc.

Russell


ImaginaryHuman(Posted 2010) [#7]
I disagree. A loading screen is only needed for the delay caused by single-threadedly loading data and forcing the user to wait. That is not good.

I also don't see why you'd need a loading screen for `corrupted or missing resources` - why would your game EVER have missing resources, and if it's corrupted then no amount of loading screen is going to make it work, right?

This goes back to the days of floppy disk loading. Remember the game Swiv on the Amiga? Loaded one very long level as the game was being played, spooled from a slow floppy disk. The user never had to wait to play the next level. Remember the popular Shadow of the Beast on the Amiga? The user had to stop and wait for seconds while the next part loaded - quite annoying.

Forcing the user to wait for data to load is offputting. They don't `expect` it. The only reason it happens a lot is because of poor design and lack of consideration for the user on the part of many developers. It's a matter of customer service. Don't keep them waiting. If you have a loading screen and you're making the user wait to play then something's gone wrong.


Mahan(Posted 2010) [#8]

The player of your games will be very annoyed if the game crashes while he's playing a level because it can't find a resource or it's corrupted...



Hmm, but if you do error handling in the main thread, you could do it in another thread as well. The only difference is that you might have to signal the main thread about an eventual error condition, so that it can be rendered correctly on the user screen?


ImaginaryHuman(Posted 2010) [#9]
I have rarely if ever played a game that `cant find a file`. You make sure all the files are in the right place before you distribute the game and there isn't going to be much reason why they'd be missing.


Yeshu777(Posted 2010) [#10]
On starting the game/progam you could simply do a file & size (checksum) check without loading the files themselves.

If any anomolies are found, suggest a re-install.


byo(Posted 2010) [#11]
I see what you mean but it's hardly what happens in the mainstream game industry. It may not happen with the average indie game but sometimes you'll want to develop an open structure like allowing mods, expansion packs and even update patches. So corrupted or missing resources happen more that you can imagine.

I don't see a problem with loading screens. And the games history tells me I'm thinking coherently at least. Just look at an EA or Atari game. So do you really think that many successful titles like The Sims, Battlefield 1942, Age of Empires, Neverwinter Nights, Rollercoaster Tycoon, Still Life, etc. (and they all have loading screens between levels) are simply badly designed? They have a reason to code the games the way they do.

Now, of course, if you're trying to make a simple freeware puzzle game then you may be right. But no user will ever complain about a data loading screen. They'll only complain if it takes too long.

Just my two cents.


ImaginaryHuman(Posted 2010) [#12]
Ok so if it happens you deal with it more gracefully, it's just this whole idea of `you have to have a loading screen` is just copy-cat behavior and not thought out.

If files get lost or corrupted, gracefully and gently do something about it, or notify the user in a suitable way, but that shouldn't be `normal` behavior.

And just because many many people do something doesn't mean it's the best way.


byo(Posted 2010) [#13]
Ok, to each their own. :)

Its one way to go of course but if you have lots of resource (3d models, high resolution images, a variety of sound effects and a database filled with the game information) while loading the resource the game may feel choopy.

And I hate when there's an unexplained lag in a game specially in a single player game. The framerate must flow smoothly because mostly every gamer has a good video card these days.


zambani(Posted 2010) [#14]
I may also add that loading a new level in the background while the current level is playing will require space for both in memory at the same time. Some games can't fit two levels in memory at once. The other thing is unless the game is a basic puzzle and has a linear gameplay, you may have no way of knowing which level(path) the gamer will choose next. Without knowing this, it's impossible to preload or background load a level.