Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 13 Apr 2010
Offline Last Active Jan 24 2015 05:06 PM

#5121590 redesigning the sse

Posted by zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 zfvesoljc 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 );

#4884195 Opinions on particle system

Posted by zfvesoljc on 15 November 2011 - 09:51 AM

Similarly, we have implemented a particle system like mentioned above: effect, list of emitters and particles for each emitter. Effect is basically a render object and emitter holder. An emitter as the name implies, defines where and how are particles created. A particle is a point in space with direction velocity, color, texture info, etc...

Both emitter data and particle data have a bunch of evaluators (line/curve editor), which are driven with emitter/particle life, ie: size, color, alpha, velocity, gravity, etc... To get better re-usability, we've added "instance data", so that some specific options are not set (locked) on data, but there where data is used (ie: when emitter data is linked under effect data, an emitter instance data slot is created, under which the emitter data is linked).

Biggest problem we reached was when we tried to create fireworks effect - where a "particle" is also an emitter. We had to add the concept of child emitters. On a particle data we define a new emitter data link, and it's "active evaluator". This defines when the child emitter will be active in accordance to particle life. This way we can nest as much as wanted, but for sanity, memory and performance reasons the depth is limited to 3.

Each emitter can also hold various engine objects like lights, flares, sounds, etc... whose properties can be also evaluated (ie: light color, intensity and range).

The editor is written with inhouse UI (sadly Posted Image ), and the system is job friendly.

edit: current biggest wish by designers is ability to animate particle movement, so they can create fancy movement like spiral, tornado, etc.. we are probably just going to import animation keyframes from an external tool (ie: maya), and interpolate particle movement based on that. note, that this will be just the "base" particle position, something like:
newpos += animationdelta + (velocity * dt)
so that you can still modify the particle movement even if particle movement is animated