Hot answers tagged

45

Simple answer: the game is divided into chunks, while you move around chunks are constantly being loaded behind your back before you can see them and thrown away when you leave the area. To every simple answer is a complex solution that weighs innumerable trade-offs in implementation... but you get the idea. For games where you think you can see tens or ...


44

Log an error and gracefully exit. Ideally, display a human readable error on screen as well. There should be a core pipeline of hard coded functionality that operates without these data files. It's the same pipeline that loads the data files in the first place. It should be capable of detecting when these core data files are corrupt or otherwise faulty and ...


29

The answer is yes, this could be done, in most cases, at least to some extent. The reasons it isn't done are many: It requires time and money to do it right. The amount of bugs that pass testing will be higher Load times are accepted by the users. There can be other reasons for load times, such as balancing server load. Generic solutions that can be ...


18

You need to be "Reticulating Splines"


13

The typical things to pre-load is anything that you're going to need in realtime. Save for concepts like clipmaps and megatextures (where the idea is to load the parts you need, and iteratively update it as you move around in the world), you're going to want to keep everything you need for your level/area/whatever in memory rather than on disk. IO is ...


12

Previous answer pretty much nails it all. Also worth mentioning is Dungeon Siege I. Here's a paper from one of the developer which actually goes over some of the architecture needed to make it work and common pitfalls: http://www.floatingorigin.com/mirror/continuous-world.htm I'd say it's a must read if you actually want to implement something like that.


12

Byte56 mentioned one option. There is at least one other: Assume default values and display a Warning. Depending on the nature of your data, it might be perfectly acceptable to assume some default values and warn the user that "since file xxx failed to load, we are using a generic yyy object."


11

Welcome to OpenGL, where the fast things come for free and the easy things are made hard. If you thought that sample was long and complicated, "just for loading a texture", then you've seen nothing yet. Wait until you have to load DDS textures, process HDR textures, support cubemaps, render to a texture, etc. Loading a texture in OpenGL consists of two ...


10

DrawableGameComponent's come with a certain amount of overhead - aside from the memory, every time you add a component to the collection it must be resorted (because components have a DrawOrder). You don't want to be constantly adding and removing components. For this reason, you don't want Bullet to be a DrawableGameComponent. Instead, you should make ...


10

If your menus have a ton of assets, those assets take time to load. You also have no idea what order people will navigate your menu. They could click options -> back -> credits, or credits -> back -> start game in rapid succession. So there's no reasonable streaming strategy. In an open world game, you know the player won't move faster than some certain ...


9

Basically, I'd say that during the "Loading" process the game tries to load and precompute all operations that cannot be done in runtime. For example, retrieving images (to be used as textures) for the hard drive is usually a slow process. On the "Loading" step these images can be copied to RAM memory, which is muuuuch faster access storage, enabling ...


9

Assimp seems to be a good choice and I will be testing this with my next project. It supports a huge array of formats including supporting bones and animations. Not just for model loading, but for changing from format to format, computing vertex and face normals, splitting meshes, and triangulating polygons. It is available under the BSD license.


9

There are a few problems to solve here. The first is how to load and unload tiles. The ContentManager by default will not let you unload specific pieces of content. A custom implementation of this, however, will: public class ExclusiveContentManager : ContentManager { public ExclusiveContentManager(IServiceProvider serviceProvider, string ...


8

For now, since calculating the paths mid-game is unnoticeable, that is the ideal approach. If / when it gets to the point where gameplay is interrupted by the calculations, then switch it over to per-calculating the paths before the level is loaded. Longer initial loading times are forgivable, but random FPS fluctuations during play generally aren't.


8

I would avoid using reflection for something like this, and use a language-agnostic tagged blob format, or something like this (just one possible method for entity serialization): Have an ISaveable interface with a method that produces an Entity given a hunk of save data, and produces a hunk of save data given an Entity. public interface ISaveable { ...


7

First of all: how you do it doesn't really matter. Just do the very simplest thing that could possibly work. My current favourite way is with static methods in each class (ie: bullet, ship), like this: static Texture2D myTexture, myOtherTexture; // Call me from Game.LoadContent: public static void LoadContent(ContentManager content) { content.Load /* ...etc ...


7

I dont know how technically Sonic 2 bonus stages are done, they could be computed by the cpu/special custom chip (and thus realtime) or totally precalculated and stored inside cartridge (like a very low resolution movie). If you are using same color range, resolution and low framerate as sonic example you give, you should be able to get really lower than ...


7

The general approach is called hysteresis: instead of immediately changing when you cross a border, you change only after you are some distance past the border. For the simplest example, suppose you want to draw a warning on the screen if you are too close to something. The straightforward code is: if distance < 20: draw warning But if you're ...


7

It depends on whether this happens during development or release. During development, you will have all kinds missing things, errors, and fuck-ups, constantly, all the time, and you may even want to "hot" load assets on demand or replace an asset while the game is running. You might edit scripts with the game running to test an AI performs better, or ...


6

BerickCook has expressed the idea correctly. Leave the calculations where they are if they work properly now. If you can do the calculation before and you are sure you will not need them mid-game, then do it before. Else do it after loading. If the calculation during the game is unnoticeable you could do it there. If at some point the complexity evolves and ...


6

Serialization would be the way to go, and as for the status-checking, you could have logic in the deserializtion method to do so.


6

I've studied the DOOM source code a bit. I'll tell you how it's done in there. D_DoomMain contains all of the open/save/load functions, as well as a slew of other things. As it says at the beginning of the file, // DESCRIPTION: // DOOM main program (D_DoomMain) and game loop (D_DoomLoop), // plus functions to determine game mode (shareware, ...


6

Minecraft is a 3D game with a game world that is extremely large in size (practically infinite). Instead of 3D terrain derived from meshes, the terrain is represented by 3D Cubes. The world is procedurally generated and stored in small chunks, similar to what you described in your first potential solution. While playing Minecraft, chunks near the player ...


5

The simplest texture manager has one function: GetTexture. GetTexture checks its cache for a texture. If the texture isn't cached, it loads the texture. Then it returns the texture. Kapow! Done! That is sufficient for most small-scale indie games I've seen. You just don't have enough content for this to ever be a problem. One downside is that this can ...


5

I don't know how this feature would be implemented in your specific development environment, but the solution to the problem you describe is masking. Basically, apply a mask to the progress bar in the shape of your letters and then the stretched rectangle won't be rendered outside the mask.


5

It's been a while since I used C#, but I think you can structure your class something like this: public static class Tile { public static enum TileType { Air, Stone } public static bool IsSolid(TileType tile) { switch(tile) { case Air: return false; case Stone: ...


5

Premature optimization is the root of much evil. If your goal is loading-time prediction, I would say leave the OS file-caching in place. It's probably general, but well-written, so I would say that you shouldn't disable it unless: You have a very good reason to do so, and You can measurably prove that disabling it is beneficial in your case. ...


5

if( (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ), "GL_ARB_texture_non_power_of_two" ) ) ) //############ it points here ############// You are creating an OpenGL 3.2 context. glGetString(GL_EXTENSIONS) returns NULL because it has been deprecated in 3.0 and removed in 3.1. It was replaced by glGetStringi(GL_EXTENSIONS, i). See ...


5

What you're doing is multi-part loading assets, which is extremely common and a very sensible approach. You cannot avoid the 'pause' or black screen though, because the assets have to come down the wire at some point, right? So all you can do is make this process as attractive and seamless as possible. Either a nice preloader, or maybe showing the next part ...



Only top voted, non community-wiki answers of a minimum length are eligible