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


20

An idea is to use the Visitor design pattern. You need a Renderer implementation that knows how to render props. Every object can call the renderer instance to handle the render job. In a few lines of pseudocode: class Renderer { public: void render( const ObjectA & obj ); void render( const ObjectB & obj ); }; class ObjectA{ public: ...


13

You could save all the data both locally on your player's computer, and sync it automatically to Steam Cloud, which indeed allows you to store stats/user preferences/progress/etc.. online. Steam Cloud API : header: ISteamRemoteStorage.h Game settings, savegames, and other user-specific bits can be replicated to the Steam Cloud to provide the ...


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


8

Im late to the party here but I spent A-LOT of time researching this. First why I don't use the following: XML: Excessively verbose. Tons of redundancy. Repeating field names? GROSS JSON: I think JSON is great for a UI layout but for a database, hell no. It will have the same problems as XML, redundancy, and deep nesting. GROSS. SQL: This is a great ...


6

When we implemented our networking engine we exploited a number of compression techniques: First we write all of our snapshot bit-wise: bools are only 1 bit instead of 1 byte (or more depending on compiler). We wrote a bitstream class that reads and writes data to a stream. This saves a fair bit of data all alone when packing flags down. For an example of ...


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

You'll want to use a List. Probably a List<InventoryItem> or similar. The documentation for List<T> is here. Here is a set of answers on how to serialize a list to XML (you didn't say how you were saving your XML - this link gives you some options). An XML file can store the list of items "inline", so it might end up something like: <...


5

Do you need to have every single chunk (presuming you're using chunks) in memory at once? Some will be occluded - particularly underground - or behind mountains etc. Lots will probably be just air/empty and so could be marked with a flag. Also you could use a LOD octree or similar structure to try keep the detail currently visible inversely related to the ...


5

For statistics you can use ISteamUserStats, which is a part of the Steamworks offering. This interface allows you to define (from the Steamworks developer site) a set of tracked statistics with various properties, and can even auto-grant Steam achievements based on the stat values. The interface supports multiple types of numerical data (integer, floating ...


4

I know you've already accepted Zhen's answer but I'd like to put another out there just in case it helps anyone else. To reiterate the problem, the OP wants the ability to keep the rendering code separate from the logic and data. My solution is to use a different class all together to render the component, which is separate from the Renderer and the logic ...


4

Build a rendering-command system. A high-level object, which has access to both the OpenGLRenderer and the scenegraph/gameobjects, will iterate the scene graph or gameobjects and build a batch of RenderCmds, which will then be submitted to the OpenGLRenderer which will draw each in turn, and thereby containing all OpenGL related code therein. There are more ...


4

The standard approach for engines like Ken Silverman's VoxLap and it's successor Ace of Spades, is to use RLE compression and several other bit-level tricks to both store and access the data. This sort of 1D compression tends to be highly efficient and considerably easier to use than octrees. I believe Silverman's engine achieved a voxel resolution of ...


4

The overall problem by using any text-based solution is that they are highly unreliable and naive implementations are often prone to data integrity issues. This is where david's suggestion to use a database becomes important. Databases offer you the ability to write entries to a table without worries about concurrent operations from other connections. ...


4

You probably do want to communicate to this information to the client so that they are able to view it. You can treat the client as a dummy terminal though with sparkly representation and have a "neutral" server as the authority. Lets consider League of Legends in this context. At the beginning of the game, each client connects to Riots servers. Every ...


4

I don't think placing game related files in My Documents/My Games/ annoys users, it's pretty much standard to put it there so why don't you do it? Each user can have it's own save games, skins and mods this way and it's easy accessible/mod-able. However, for larger assets you do want to consider to share them amongst user accounts. I think you have two ...


4

You need to transfer the asset metadata as well as the asset files themselves. The metadata files might be invisible depending on your settings. On the old computer, go to Edit>Project Settings>Editor in Unity and set Version Control to Visible Meta Files. You should now see .meta files appear next to all the assets in your Assets folder. Copy those ...


3

It depends where the bottle neck is. If you IO bound (the game is always waiting on network IO) then yes compressing will help. If your game is CPU or memory bound then it will just run slower. You should compress before encrypting because cipher text is less compressible as a result of trying to remove patterns that could be used to reverse engineer the ...


3

If you do tangent space normal mapping, as practically every game does nowdays, you should also store tangent space (binormal and tangent in addition to normal). For skinned characters you also need to store multiple (usually 4) bone indices and weights. In addition there can be multiple UV coordinates, some texture blending weights, color data, spherical ...


3

Having just one generic "Map" class and have each instance of this class load its layout, objects, scripts etc. from an external file is the usual way to do it. Usually a WYSIWYG map editor is used to create and edit these map files. This map editor can be integrated into your game or be a stand-alone program. In the latter case you can often safe lots of ...


3

It completely depends on whether you can make assumptions about what's common for all renderable entities or not. In my engine, all objects are rendered the same way, so the just need to provide vbos, textures and transformations. Then the renderer fetches all of them, thus no OpenGL functions calls are needed in the different objects at all.


3

Probably the cleanest way of doing this is just to explicitly store your entities as classes: class Entity { Room location; bool isDead; ... etc. } And just store a flat list of all your entities in the world. List<Entity> entities; You can also store, for each room, a list of entities that are currently in the room: class Room { ...


3

You don't use cookies. Take a look at localstorage. It is intended for storing small bits if data, that is too big for a cookie. Here is more info: http://www.html5rocks.com/en/tutorials/offline/storage/


3

Many games get bought on the internet. Stuff like the Call of Duty Infinite Warfare and Modern Warfare bundle simply won't fit on a CD (They take up together around 200Gb), or the new version of GTA 5 (that was 60 GB), which did have a physical version, but it required 7 DVDs to fit, which is unacceptable if you're playing. That said, there are ways to ...


3

It's not an approach worth to use. For a normal player it may not be a big deal but some people may try looking into the game files to find various information. Even if you download the content at run-time, there are various ways that the cheater can inject code into your game and read or write the memory. In order to prevent this, is it possible to ...


2

Theres two basic ways to do this: The Magic Bag Containers themselves have fixed sizes, but there's no limit to your ability to put "bags" inside other "bags". Thus the only practical limit on your inventory is your ability to get more "Bags" This has the advantage that containers have fixed capacity (which might be easier to implement), and that you can "...


2

I'm not sure exactly what you want to do but you can always export it from 3ds max in ascii format instead of binary and open it later in a text editor (notepad).


2

Definitely put rendering code and game logic in different classes. Composition (as teodron suggested) is probably the best way to do this; each Entity in the game world will have its own Renderable -- or perhaps a set of them. You might still have multiple subclasses of Renderable, for example to handle skeletal animation, particle emitters, and complex ...


2

This provided some simple XOR encryption: #include <iostream> using namespace std; string encryptDecrypt(string toEncrypt) { char key[3] = {'K', 'C', 'Q'}; //Any chars will work string output = toEncrypt; for (int i = 0; i < toEncrypt.size(); i++) output[i] = toEncrypt[i] ^ key[i % (sizeof(key) / sizeof(char))]; return ...


2

This advice isn't really specific to rendering but should help come up with a system that keeps things largely separate. Firstly try and keep the 'GameObject' data separate from the position information. It's worth noting that simple XYZ positional information might not be so simple. If you are using a physics engine then you position data could be stored ...


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