• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Alexander Stopher
      Trying to get ideas here on how I could do this:
      I have created a game for a university coursework assignment using a custom game engine (internal to my university, but it's based on OpenGL).
      The game loads levels and menus from a file, this happens at initialization to increase performance while playing the game. At the moment the game loading time is 4.1s, but the loading time without the levels and menus is 0.961s- that's over 3s. As more levels are added the loading time will become longer and I want to add a loading screen.
      I've tried to add one, but loading the levels and menus is blocking everything else, including rendering the loading screen. This means that the loading screen doesn't appear until the game has loaded and is overridden by the main menu. The game loading is done via its update function and via calling initialization functions of the various game classes, and the loading screen is rendered within the game's render function (the rendering is done on a separate thread, according to the game engine's documentation).
      Any suggestions on how I can show the loading screen without the other loading activity blocking it from being shown?
      I know that I can use threading but am unsure how thread-safe the operation would be to init the game on another thread.
    • By zfvesoljc
      I have a particle system with the following layout:
       system / emitter / particle
      particle is driven by particle data, which contains a range of over lifetime properties, where some can be random between two values or even two curves. to maintain a smooth evaluation between two ranges, i randomize a "lerp offset" on particle init and use that value when evaluating curves. the issue is that i'm using that same offset value for all properties (10ish) and as a result i'm seeing some patterns, which i'd like to remove. The obvious way is to just add more storage for floats, but i'd like to avoid that. The other way is to generate a seed of some sort and a random table, and use that to generate 10 values, ie: start with short/integer, mask it, then renormalize to float 0-1.
      any other ideas?
    • By dgi
      Hey all ,
      For a few days I'm trying to solve some problems with my engine's memory management.Basically what is have is a custom heap with pre allocated memory.Every block has a header and so on.I decided to leave it like that(not cache friendly) because my model is that every block will be large and I will have a pool allocators and stack allocators dealing with those blocks internally. So far so good I figure out how to place my per scene resources . There is one thing that I really don't know how to do and thats dealing with containers.What kind of allocation strategy to use here.
      If I use vector for my scene objects(entities , cameras , particle emitters .. ) I will fragment my custom heap if I do it in a standard way , adding and removing objects will cause a lot of reallocations . If I use a linked list this will not fragment the memory but it's not cache friendly.I guess if a reserve large amount of memory for those vectors it will work but then I will waste a lot memory.I was thinking for some sort of mix between a vector and a linked list , where you have block of memory that can contain lets say 40 items and if you go over that number a new one will be created and re location of the data would not be needed.There would be some cache misses but it will reduce the fragmentation.
      How you guys deal with that ? Do you just reserve a lot data ?
    • By Hermetix
      I am trying to setup the custom wizard for making a 3ds MAX 2018 plug-in (to export a character animation data), but I can't locate the wizard file folder to put the .vsz file in. In the 3ds MAX 2018 docs, it only mentions where the folder is in VS 2015 (VC/vcprojects). It's a VC++ project, but I don't see any folder in VC for the wizard files. I'm using VS 2017 update 15.5.6 Enterprise, and the folders in VC are: Auxiliary, Redist and Tools.
    • By KarimIO
      Hey guys! Three questions about uniform buffers:
      1) Is there a benefit to Vulkan and DirectX's Shader State for the Constant/Uniform Buffer? In these APIs, and NOT in OpenGL, you must set which shader is going to take each buffer. Why is this? For allowing more slots?
      2) I'm building an wrapper over these graphics APIs, and was wondering how to handle passing parameters. In addition, I used my own json format to describe material formats and shader formats. In this, I can describe which shaders get what uniform buffers. I was thinking of moving to support ShaderLab (Unity's shader format) instead, as this would allow people to jump over easily enough and ease up the learning curve. But ShaderLab does not support multiple Uniform Buffers at all, as I can tell, let alone what parameters go where. 
      So to fix this, I was just going to send all Uniform Buffers to all shaders. Is this that big of a problem?
      3) Do you have any references on how to organize material uniform buffers? I may be optimizing too early, but I've seen people say what a toll this can take.
  • Advertisement
  • Advertisement

Recommended Posts


Im using binary files to save and load savegames. But when you list your savegames for the user you want some metadata such as date/time, gameday, difficulty, map name etc so the user more easily can identify which savegame they want to load.

What is the prefered way of doing it?

1. When saving, save metadata first in the file. Then do a function "scanSaveFiles()" before showing the available savefiles for the user. This will read each "header" of each file (reads the first section of the binary file without actually loading that game) and can then show the info to the user.

2. When saving, update a table of savegame-metadata held by the "gameMaster" that holds other stuff like user options, progress etc. However this seems bad since if the user manually moves or modifies the savefiles the table of savegame-metadata will no longer sync with the actual save files.

Or any other smarter way of doing it?

Edited by suliman

Share this post

Link to post
Share on other sites

Yes agree, first option. Also when dealing with save game files, especially binary ones, make sure it has some sort of future proof about it.  I.e. you'll probably want to add things to your save game in future versions of the game (after release), Will your game handle loading old versions of your game save data..

Share this post

Link to post
Share on other sites

Version compatibility is always a topic not just for savegames but also for anything that is serialized/deserialized. A text or property file format could help here so unknown properties will be skipped while new ones will be held empty.

The option to have some kind of header in your save files is currently the best one for your situation because a save file is the main entity you need to maintain, when storing metadata, you need to know if a file has moved, was replaced or renamed what may become a huge management overhead while you just want to "simply show some information".

On the other hand you then will have file access every time you just want to see what your last save files are so the "database" solution has the advantage of keeping disk access as small as possible. Some games prefer this solution when for example the player has made his own character you would like to show as seen here



A middle course solution would be to gather a players save files at startup of the game or as a background task when you are sure your player wont have access to the save game area for a few seconds to generate your meta database at this point from disk until you update it next time

Share this post

Link to post
Share on other sites

I like the 1st method.  It also directly allows your players to move save files either for backup purposes, or to other machines, or in most cases if you let them choose save locations, to something like a Dropbox folder.

I understand wanting to "gather" all the information in a single place...but I think a few milliseconds to do that when you hit the "load" button is fine.  Even a spinning hard drive shouldn't have trouble reading several headers of savegame files really quick, especially if they are binary files(which you are currently discussing).  Even if it were a couple of seconds I think it would be an acceptable amount of time for a player to wait, especially since it let's them easily select the file they want, without having to go search for it, remember what it was called, or anything like that.

Share this post

Link to post
Share on other sites

FILE *stream; fopen() fread(), fwrite() and fclose() are your friends......oh yes fseek() is your friend too

Edited by Snaked

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement