So I worked on a simple arcade shooter game before. You can literally beat it in less than one minute. All the objects in the game are created in the games' constructor. These objects include objects that appear when the gameplay happens or when certain conditions are met.

The gameplay is as follows:

1) kill 5 ghosts spawn Death

2) kill Death spawns an Alien

3) Alien appears. It moves to a certain distance in the screen and disappears.

4) You win!

So my question is for a rpg where a player encounters a final boss 20 hours into the game, should the final boss necessarily be loaded along with the other objects that appear 5 mins into the game in the game constructor?

I don't see why you would load something that is not going to be used until 20 hours later. That would be a whole heck of a lot of stuff.

Loading every model and texture for every single level at the same time is excessive and you'd be asking for trouble. Running collision response for every single object from beginning to end could also really bog down the machine. Same with physics.

Why not load a model within a few minutes of it's first appearance? Now it's not a burden on the system until it's ready to be used.

Loading a model and its textures will not likely cause anything more than a slight hick-up if you've been cleaning up everything that is no longer being used.

Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds,3 because you know that the testing of your faith produces perseverance.4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.

I have to agree with makr and menyo. Loading content when you need it is good, but the added complexity could be a bit much. It's better to load everything you need at the beginning of the level and if it becomes a bottleneck, then optimize it. If you have 20 hours of content, you'll have to break it up into levels. Load everything when you load a specific level. There are some times in a game where the game-play has natural breaks where you can load things like when you enter a special area, or switch to the world map, or when you enter a town or building. If you find that these load times are too slow, then you can try loading as you go which could mean adding worker threads to load things in the background.

Edited by Squared'D, 15 July 2013 - 07:42 PM.

Learn all about my current projects and watch some of the game development videos that I've made.

I have to agree with makr and menyo. Loading content when you need it is good, but the added complexity could be a bit much. It's better to load everything you need at the beginning of the level and if it becomes a bottleneck, then optimize it. If you have 20 hours of content, you'll have to break it up into levels. Load everything when you load a specific level. There are some times in a game where the game-play has natural breaks where you can load things like when you enter a special area, or switch to the world map, or when you enter a town or building. If you find that these load times are too slow, then you can try loading as you go which could mean adding worker threads to load things in the background.

I have to say something about this and I have been thinking of the response for several days now. Before posting anything! I have weighed the merit of not saying anything and I have consider the issue of starting an argument vs. just leaving things well enough alone.

I do not take insulting people lightly. This being said....

If you consider yourself to be an honest person then you should also consider posting the following notice on all software that which you plan to distribute in the future.

The notice should read as follows.

"This software will probably not work on your computer. Buyer beware!"

The same could be said of anyone who only tests their software on their favorite brand of hardware.

Edited by Josh Petrie, 22 July 2013 - 10:23 AM.

Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds,3 because you know that the testing of your faith produces perseverance.4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.

I have to say something about this and I have been thinking of the response for several days now. Before posting anything! I have weighed the merit of not saying anything and I have consider the issue of starting an argument vs. just leaving things well enough alone.

I do not take insulting people lightly. This being said....

If you consider yourself to be an honest person then you should also consider posting the following notice on all software that which you plan to distribute in the future.The notice should read as follows.

"This software will probably not work on your computer. Buyer beware!"

The same could be said of anyone who only tests their software on their favorite brand of hardware.

their is a difference between pre-mature optimizations, and not testing on your targeted hardware minimums. If you find that your target hardware can't support the game, you have two options. increase the minimum requirements, or profile, and optimize. but that still means you shouldn't per-maturly optimize if it's not a demonstrable problem. also, do not confuse when i say pre-mature optimizations with software design. a bad design is a bad design, and optimizing that design will only help so much. Ideally you would be already approaching the problem in a manner that would not require fixing.

A person should not become so caught up in optimization that they never get anything done because they are continuously caught up in squeezing out yet another 1% performance improvement. But to say that optimization should not even be considered is very questionable. It should not hold a person back but it also should never be completely gone from a person thinking when they are building something.

To say that a person should not optimize is to say that a person should not use VBO's or whatever the DirectX equivalent is. This is also like saying that a person should use an uncompressed format like .bmp. Also it is like saying that a person should not consider sending indices to the GPU. It is also like saying that a person should not work on keeping their model's poly count low. "Who cares about optimization?... let's build dozen's of models with 10,000,000 triangles each into our game!"

If a person ignores these things then their project space will be the size of a blu-ray disk for just one level and the game will likely run at only one or two frames per second on even the fastest machines.

Paying attention to optimization is fundamental. It is like anything else. If you do not consider it and learn it, and put it into practice then you will never understand it or be able to implement it. You cannot get good at something by ignoring it.

Having to re-build the entire infrastructure of a software package after it's been built up for years to accommodate future optimization that was never considered before is a real possibility if this fundamental idea is neglected.

To be honest, I don't care what other people do in this regard. If I some day install some bloated, inefficient software that doesn't run on my machine, I'm just going to erase it and I won't think twice about it. When people ask me about the software I'll tell them it sucks and it wasn't written properly, you have to buy a $4000.00 dollar machine to run it.

Unless that software is a killer-app, very few people will respond differently.

I don't view people around here as my competition, I like to communicate with like minded people and I also like to help people, I don't view this any differently then when I wash dishes or clean tables at the local homeless soup kitchen. I'm not going to argue with anyone about this, there would be no point. Nobody is bound by law to pay attention to optimization but it is a guaranteed fact that you will be making everyone else who does pay attention to optimization look a whole lot better in contrast to you.

It's your name that's going on the product, it yours to do with as you please. How do you want people to view your name?

P.S. Try this experiment, make up a super amazing resume that no game company could possibly ignore but start it off with the following.

"THE NUMBER ONE RULE OF OPTIMIZATION IS: DON"T OPTIMIZE"

Now send it off to a bunch of companies and see if it receives any replies.

Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds,3 because you know that the testing of your faith produces perseverance.4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.

To say that a person should not optimize is to say that a person should not use VBO's or whatever the DirectX equivalent is. This is also like saying that a person should use an uncompressed format like .bmp. Also it is like saying that a person should not consider sending indices to the GPU. It is also like saying that a person should not work on keeping their model's poly count low. "Who cares about optimization?... let's build dozen's of models with 10,000,000 triangles each into our game!"

To me, optimization involves writing significant extra code/doing extra work/going out of the way to make something work more quickly. Your examples don't really fit into that - they're really just alternate ways of doing things, perhaps mildly more complex than other options. Of course when choosing between several options that are roughly equivalent in terms of implementation cost, you should choose the solution that best meets your needs.

Something to remember is that failing to code against the requirements in favor of a quick solution is also a form of pre-mature optimization (optimizing for development time rather than execution time) and can cause you serious problems down the road. The OP indicated a sample gameplay scenario (5 Ghosts, Death, Alien, Win condition) for which it would be appropriate to load everything in at game start and keep it memory resident. But then he asked about an RPG 20 hrs long, for which it definitely would not be appropriate to keep all assets loaded at all times. A 20 hr long RPG is not really the sort of thing you want to keep everything loaded all at once. So telling the OP to "just go ahead and load everything and don't worry about it until you have to" is leading him astray.

To build a 20 hr RPG, if that is your goal, you have to design smart asset management from the start. You don't want to get deep into the project by hard-coding and pre-loading everything, only to realize that you are running out of resources and now you have to retro-actively modify complex systems to support loading and streaming instead.

So, yes, pre-mature optimization is to be avoided, but that also includes hacks done in the name of "faster" development.