Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Apr 2010
Offline Last Active Yesterday, 01:48 PM

#5290703 Custom editor undo/redo system

Posted by on 08 May 2016 - 02:45 PM

i tried two version on two different projects:


- a particle editor which was using the command approach (3), I've ended up with list of following commands (new, delete, copy, deep copy, deep delete and modify property). A few quirks along the way, but it worked. wasn't too hard to make but the editor was quite specific. also, the undo/redo was not persistent and a crash meant that all unsaved data was gone (save early, save often)


- the second project was a generic editor (scene/prefab,etc..) which worked with json data. there I took a more generic way of saving json diff (2). the editor system was basically a local/remote server hosting a mongo database, to which a number of editor front ends could be connected, ie: you could write an editor as a webpage or as full standalone application -using websockets for communication. making the logic to handle json diff took some time, but in the end it magically worked. I managed to write two editor prototypes to try out the system and it was very promising. sadly, due to company changes the projects was halted...

the most pretty part is that you can have a clumsy written editor, which leaks and crashes, but you don't care. the data is always safe, as each change is treated as json delta and inserted into a database automatically. the changes are persistent, logged and tracked. it does require some handling on the editor side, but once the system is up and running adding "new commands" is automatic.


credits to:




#5121590 redesigning the sse

Posted by on 06 January 2014 - 03:55 AM

for example there is no as far as i know command for horizontal multiply
that would just mul a1*a2*a3*a4


Sometimes you just need to rearrange the data. The benefits of simd ops do no come from a1*a2*a3*a4 but rather from:


v5 = vec4mul( v1, vec4mul( v2, vec4mul( v3, v4 ) ) );
// v5( a1*a2*a3*a4, b1*b2*b3*b4, c1*c2*c3*c4, d1*d2*d3*d4 )

#5098245 OpenCL and also Heterogeneous computing

Posted by on 02 October 2013 - 05:17 AM

For multiplatform window handling (and other "basics"), you can use SDL.

#5098014 OpenCL and also Heterogeneous computing

Posted by on 01 October 2013 - 01:50 AM

If you want a more concrete answer, you need to ask a more specific question. What kind of a project are you aiming at?

#5098012 OpenCL and also Heterogeneous computing

Posted by on 01 October 2013 - 01:18 AM


I use a WinAPI. Because I think that is fast GUI, such as tow a big Qt Framework is a crazy idea. And a lot of dlls files... WinAPI is not bad, but isn't crossplatform. Well, I want use a OpenCL for Heterogeneous computing.
Here is scheme:
OpenGL(As Graphics) + OpenCL(As computing) + OpenAL(As Sound) + WInAPI(As GUI and also I/O)
And What do you say? Will the scheme work quickly?
Please feel free to criticize and comment!



yes, quite quickly cool.png

#4985048 Sending char strings in structs

Posted by on 29 September 2012 - 08:01 AM

Use a network library, i.e. enet, which works on udp protocol but also supports reliable packets. That way you can send important messages as reliable (and ordered) and state changes like position, rotation as unreliable messages (spam like, multiple times per seconds). I wouldn't use size as a message descriptor, just use header ID for that.

#4977094 Multithreading in games

Posted by on 06 September 2012 - 12:58 AM

Hm... Thank you.
That does have a point, but I wonder where I could create tasks to make use of at least 2 cores. Resource loading doesn't happen every frame.

Where ever you have N items to update, ie: 200 particle effects can be split into 4 tasks, where each one can update 50 particle effects.

#4973704 Processing game input

Posted by on 27 August 2012 - 02:21 AM

As mentioned, a good way is to pull current state from the input devices once per frame and do logic based on that. However, usually only current state is not enough, for example if you are reading raw input or analog values from gamepad. Here, keeping an input state from previous frame(s) with time stamps can help a lot. Based on previous states one can determine how the value changed (slow vs fast) you can even manually catch double clicks (press).

#4917686 required bit count at compile time

Posted by on 29 February 2012 - 04:50 AM

A very trivial way to get the number of necessary bits to store a value at compile time:

template<unsigned int N> struct number_of_bits
	static const unsigned int value = 1 + number_of_bits<(N >> 1)>::value;

template<> struct number_of_bits<0>
	static const unsigned int value = 0;

int bits = number_of_bits<42>::value;

It's not very generic or error-safe, but it works under normal circumstances at least. Add whatever error-checking you feel is necessary, or modify to suite you needs.

Thank you!

#4917428 required bit count at compile time

Posted by on 28 February 2012 - 10:52 AM

HDD/RAM space is not a problem these days

Who said anything about storage? Believe it or not, there are still some parts of the world where network bandwidth is not abundant.

but you could use one bit flag to tell whether to read a full byte or 4bits

I'm not sure how this would help me. I want to save minimum number of bits required. It could be 2, 4, 7 or even 23. I just wanted to know, if anybody had a quick idea how to get number of minimum bits required based on some max value (at compile time).

#4917414 required bit count at compile time

Posted by on 28 February 2012 - 10:21 AM

Quit wasting your time on the triviality and work on making more/better code. Realistically you're likely to add more enum values over time; leave room for them.

I asked a specific question, trivial or not. And I can waste my time any way I want.

#4887922 Input manager, mapping functionality

Posted by on 26 November 2011 - 11:39 AM

Firstly, let’s say you have mapped a key to an action. B to jump.
But now you are in water. Remap the key to “swim”? Keep the key on “Jump” but add code to check if you are in water during a jump?

well, to avoid such problems, you can still give a more generic action name, like fire1, fire2, action1, action2, if you have clear action definitions that is :)

#4887025 Best way to load a mesh

Posted by on 23 November 2011 - 03:36 PM

For a final game, best way is to pre-bake the mesh and load in place the entire thing (header, index buffer, vertex buffer, even shaders and textures).

#4884692 [C++] templates function specialization

Posted by on 16 November 2011 - 02:59 PM

Could you please specify what you mean by:

explicitly instantiate a Test<int> in the .cpp file

all template code (function implementations for example) must go into header

#4884477 Data storage C

Posted by on 16 November 2011 - 01:50 AM

why not serialize with xml? It's human readable, editable and there are some nice free xml libraries out there than can be used. I've used tiny xml before, haven't found any serious issues with it.

just a hint, if you have bitwise flags in an attribute, don't save the attribute as a value, save each flag on it's own. It can save you a lot of trouble :)

enum EAttr {
  aActive = 1,
  aVisible = 2,
  aMagic = 4,

int attr;
xml.Write( "attr", attr );
// DO
xml.Write( "active", attr & aActive );
xml.Write( "visible", attr & aVisible );
xml.Write( "magic", attr & aMagic );