Hot answers tagged

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 ...


32

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 ...


26

First of all, you should measure where exactly the bottleneck is so you don't waste time improving things which are already good enough. The bottleneck could be any of these: Reading the XML file from the hard drive Your XML parser parsing it Your code which interprets the output of the XML parser and converts it into your internal data structures The ...


20

When you load an scene with SceneManager.LoadSceneAsync() there are actually two things happening: The gameObjects of the scene are loaded into memory. Then the whole scene is enabled. All Awake() and Start() callbacks will be called for the objects in the scene. The second step, enabling the scene, is what actually freezes unity, because unity is running ...


16

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 ...


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

I see you solved your own problem. However, I would like to explain what are you looking at, and what to look for in an error log like the one you received, in case you get a similar error in the future. There are many type of error logs, and this one is quite low level. It is difficult to understand what the problem is with a large game with such an error ...


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

I just did some tests, and I found that the constructor for objects in the first scene actually gets called while the splash screen is still displayed. Here are some timings I measured with a static Stopwatch: Constructed 0 s Awake 2.118 s OnEnable 2.12 s Start 2.744 s First Update 2.919 s So, it looks like we can trigger a script ...


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 { ...


8

Was it necessary for a game developer (in Android, game consoles, online, or in desktop) to display the loading screen to cover unfinished rendered game environment and to prevent from other users thinking that this game is either lagging or freeze. Yes, loading screens are used to hide resource loading and it's somehow a more entertaining way to tell ...


7

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 ...


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

Despite it being used for virtually everything, and despite it being used even in high-volume, low-latency applications, XML is an abysmal format for almost everything, but in particular for applications that have timely constraints, including games (except maybe for storing the game's settings). Even for live data, a simple binary tagged format which ...


6

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 ...


6

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 ...


6

It depends on whether this happens during development or release. During development, you will have all kinds missing things, errors, and mess-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, ...


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

A big factor in the feasibility of such a solution is the predictability of what needs loading. If the player loads entirely new levels with no way of anticipating what they will choose, a completely seamless solution is just not possible. For example, when the player may select any level in the game to play from, or if they have freedom to teleport to ...


5

There are a number of factors to approaching this problem, although you are on the right track. Single Load The first approach, as you've already tried, is to load it all at once. This puts all your load time and file I/O up front. As you've already noticed, as a map size grows, your initial load time can become annoying to the user. This also creates an ...


4

The toString() part on its own doesn't seem so bad. I think one way of handling the re-loading of the objects would be through use of Reflection. // an example of a forName argument: "java.util.Map" Class loadedObjectClass = Class.forName(xml.getElementValue("clazzName")); Object loadedObject = loadedObjectClass.newInstance(); I'll also note some people ...


4

Scott Bilas of Gas Powered Games wrote a good document about how they implemented a continuous world in dungeon siege. Paper: The Continuous World of Dungeon Siege Slides: The Continuous World of Dungeon Siege


4

You could add a version number to your savegame file format itself. The savegame loader loads the savegame file as plain data, checks the version number which it expects in a specific position and then passes the data to the correct loading/upgrading strategy for parsing. This, of course, means that you are no longer able to change your savegame format in a ...


3

Your process is generally the right idea for a basic, generic multi player game without any specific design goals. However, there is a lot of stuff you should keep in mind that the client/server does not need to be doing. I'm going to list your steps again and annotate them. Client sends "iwanttologinwithcharacterx" Yes, this is an obviously needed step. ...


3

A quick google on the subject turned up this: Object Creation with Multithreading (Windows) It is for DX11 and not DX9, but the basic gist is that, DX is only under certain conditions thread safe. DX behaves "radically" different in windowed and full screen modes. (In windowed mode DX sort of wait on WM_PAINT, but in full screen it renders away.) This ...


3

After some searching, I came across the concept of EAGL Sharegroups. It seems as though iOS designers really thought things through, because EAGLShareGroup is exactly what I need here. Docs say EAGL Sharegroups are useful "When you want your application to be able to create new OpenGL ES objects on a thread other than the main thread for the renderer. In ...


3

Yes, this can be solved with multithreading. Either explicitly by creating a new thread which reads and interprets a file, or implicitly by using an asynchronous file access API which calls a callback function when a file finished loading. The biggest problem with loading assets on demand is what to do when an asset is needed immediately, but it hasn't ...


3

I'd highly recommend looking at the following guide: http://www.spikie.be/blog/page/Building-a-main-menu-and-loading-screens-in-XNA.aspx I had a look at it yesterday, and pulled out the loading screen code for a project I was working on, think it might be of help to you.


3

A few things to consider : What happens after your fake loading screen is over in the case some user has a machine slower than yours? (Which will happen) Making a loading screen has never been a rule (i do not know if there is "rules" in video game making) but a good practice to prevent users with slower machines to see objects pop on the screen. If after ...


3

When building your game, Unity will not include all the scenes by default. Ensure that your scene is included and checked in the build window. The build settings window appears after selecting build and displays the currently selected scenes to be built. You can also find it by selecting File->Build Settings. You may need to add the scenes yourself and then ...


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