Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Jan 2009
Offline Last Active Sep 29 2015 05:53 AM

Posts I've Made

In Topic: How can I save/flush the offline data to disk and start it from there next ti...

14 September 2015 - 07:26 AM

Optimisation not withstanding, maybe it's just a process issue. Can't you automatically run your generation process automatically during the night?

In Topic: Pass anything as constructor without varargs

31 July 2015 - 08:08 AM

You can do this natively in c++ using rtti.

There is an operator called typeid (it's an operator that looks like a function call, like sizeof).

It returns a type_info object. It implements a "before" function that defines an ordering, so you can make a wrapper class to use it as a map index with an overloaded < operator.

C++11 directly provides such a wrapper class, called type_index, that can be constructed from a type_info and can also be used as a key in unordered_map and unordered_set, as there is a specialization of std::hash for it.

typeid can be given a type directly as in typeid( int ) or an expression. If the expression is an object instance with a vtable (such as an interface class), the type will be determined at runtime (by reading a pointer in a special slot of the vtable, so there's virtually no memory overhead). In other cases it is resolved at compilation, just giving a poiner to the appropriate type_info object directly.

Note that it is a common belief that rtti is evil and costly and should be disabled in games. I never understood the rationale for it, in particular in cases where people then go out of their way to reimplement a similar but unwieldy type identification system by hand.

In Topic: Easy source control for educational uses?

30 June 2015 - 03:20 PM

I've always wanted an excuse for using Fossil smile.png


Besides having a cool name, it is designed to be self-contained and simple to use, while still being powerful enough to be called a full featured versioning system.

A comparison between Fossil and Git here: http://www.fossil-scm.org/index.html/doc/trunk/www/fossil-v-git.wiki

((Totally biased comparison, of course, but nonetheless...))


I especially like that Fossil has wiki and issue tracking built right into it.

And that great care has been taken to ensure that you can't shoot yourself in your feet so easily.


I think for educational use, Fossil is probably going to be an excellent choice.

I have a feeling that it has been - and still is - developed and used by primarily academics. smile.png


I use fossil on my hobby projects at home and I can attest that it is excellent. It is very easy to deploy and use, and have very few surprising behaviors. I only used it on single person projects though, I don't know how it looks like in day to day use with multiple developers. The repositories being contained in single files is useful for quick backups on for instance google drive.


It is also very robust. I actually have installed in as a server on my nas along with a script that automatically pulls and recompile it from the latest trunk version from fossil's official repos a couple times a day, which sounds dumb and suicidal but i've been running this for years and never once pulled a version with any serious bug, and never had to use my backups.

In Topic: GCC -malign-double

05 April 2015 - 11:40 AM

As Bacterius alluded to..this flag can turn out to be very viral.


You could say that it is a malign flag.

In Topic: preventing system crash or power outage from wiping savegame: best methods

03 April 2015 - 12:36 PM


A bit of explanation is probably called for.


The data in question is the bitmap masks for unexplored sections of the local maps in a FPS/RPG. Right now, they are overwritten on save, with no backup. if the power goes out, they get wiped, and the entire 25 square mile area of the game world becomes "unexplored " again.


Power outages are a special concern as i'm off grid running off a gen-batt system, and the low voltage alarm on the power inverter is not very loud.  So unexpected power outages are a multiple times a day occurrence here. i suspect laptop users might face similar issues. And since the game will run on laptops (i'm developing it on a laptop board in a mini case) i'd like to make it as robust as possible against power outage.


And its not like being on grid is much better - at least around here.  The power goes out in EVERY storm (almost all power lines are above ground in woods in this area). Its quite common for me to be the the only person in the neighborhood with power during bad weather. In fact the power went out two days ago just because of the normal March winds.



while the game has a built-in cheat to reveal all unexplored areas on the world and local maps, having to use it every few hours because the battery died makes it hard to reproduce the non-cheating player's experience in long term play testing.



Why load and save the entire map monolithically? Divide it into fixed size chunks and only overwrite those that have been touched since the last save (keep a boolean for each chunk that you set to true whenever you modify that chunk).


You could even save them on the fly in a background thread in a temporary file/directory and rename them into an actual game save file(s) when the player wants to save his progress. This way you "save game" function is almost instant (which is nice for the player), and when restarting the game after an unexpected power loss, you can offer the player to restore his "unsaved" progress from the temporary files.


Also this is exactly the kind of "mission critical" stuff where i'd definitely trust sqlite over any homegrown solution, by the way.