Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Mar 2012
Offline Last Active Jan 15 2016 07:16 AM

#5263863 Best comment ever

Posted by on 27 November 2015 - 01:06 PM

I can't comment on the validity of that (despite doing similar aliasing in other places ), but I can suggest that the struct itself test for std::is_trivially_copyable via a std::static_assert.
union Bytes
static_assert(std::is_trivially_copyable::value, "'Bytes' requires trivially-copyable types");

stype data;
unsigned char bytes[sizeof(stype)];


Hu. I didnt know you could do a static assert inside a union/struct etc. :| Neat, i always love it when i learn something new. :) Now i only wish i could change the compiler warning regarding non-trivially_copyable types. Saying e.g. the destructor is deleted is unfortunately uninformative if you dont know unions.


Back to topic: Too bad. I will have to remove the comment now. :P

#5263570 Best comment ever

Posted by on 25 November 2015 - 09:03 AM

I just found that little gem in a collaborative hobby project.


@brief Enables easy access to bytes in a struct for array/struct conversion.
@details stype should be trivially_copyable. Its your duty to make sure it is. Otherwise you might be in
undefined-behavior-land, which is - trust me on that - not a amusement park.
@tparam stype The type to be wrapped.
template<typename stype>
union Bytes
stype data;
unsigned char bytes[sizeof(stype)];

I dont know if that is good style (its in a "details" namespace) but its quite convenient to have something like that.

#5231768 Looking for Multiplayer 3d game engine with tools

Posted by on 29 May 2015 - 05:41 PM

You have no clue what you are getting yourself into.:)


As far as i know there is no such thing as a "(M)MORPG Do-It-Yourself-Development Kit for Dummies". Multiplayer Games are hard work. Multiplayer realtime 3D games are even harder.

Further you arent really specific in your needs at all. The needs of a Shooter might differ greatly from those of a ... say RTS. Thus the engines would differ greatly in terms of rendering mechanics, networking etc.


I am with no means an expert on this topic though and i might underestimate your expertise greatly by packing you with the cliche "I want to write an awsome multiplayer game after i mastered HTML now!" guy... I Also dont mean to discourage you in anyway. Its just... if it fails - which has a great chance to be the cas specially in a 5 year project - you possibly wasted a lot of time for nothing.

Of course: You can learn a lot in the process if you do it right. But if learning isnt the goal than it is better achieved by smaller projects where failure isnt such a great trigger for frustration.

#5200054 When you realize how dumb a bug is...

Posted by on 26 December 2014 - 06:59 AM

Exporting a tree-structure as a visual output to another tool from a tool that doesnt provide positional data...

So yeah... Calculate them from the structure. Not that hard to do, right?


But i wasted like a shitton of time because the target tool had the undocumented feature to set everything with a x or y coordinate of 0 (totally valid value...) to 100 / 100. Searched for ages in my code and then just tried adding 1 to everything... and suddenly it worked.

Biggest derp in my recent programming carreer. :/

#5149518 DX11 Hardware Voxel Terrain (your opinion)

Posted by on 25 April 2014 - 05:59 PM

It is indeed for generation on the CPU but i guess it still applies for the GPU.

Problematic with this approach is btw that you would need to implement a volumebased physicsengine or a physicapproach on the GPU that works with your extracted meshes etc.

Its hard to do, i think, if you need physics, that is.


But i didnt implement any of those algorithms on the GPU and i dont plan to, so i cant help that much with that. I just wanted to point you to some maybe helpful things :)

#5149043 DX11 Hardware Voxel Terrain (your opinion)

Posted by on 23 April 2014 - 02:52 PM

Now that I'm learning DX11, there are a few new options open to me using hardware (video card). I've been eyeing http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html and was wondering what experienced programmers think and know. My concerns are as follows:

-- how much control would I have during generation? What kinds of controls are there?

-- when the terrain is generated, how would I get info about the "height" of a specific location on the terrain?

-- could I implement LOD to this terrain? How?


Remember, I'm asking about DX11, not DX9.......



How much control? Depends on your noise of course. You can do pretty amazing things with multiple noise steps and some pseudo randomly distributed precalculated models like e.g. trees. Youtube has some nice vids to that.

If you go for only perlin noise for example you have persistence, frequency, etc. as parameters to play with and your seed as a starting point.


When it is generated you dont need to know the info, do you? Otherwise: Voxelspace -> Worldspace calculations. 

LOD... Thats tricky. Its of course possible e.g. by means of the Trans Voxel Algorithm as proposed by Eric Langyel.


But the topic is not as trivial as it should be. I am fiddling around with it, myself. :P