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

Posts I've Made

In Topic: Best comment ever

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

In Topic: Best comment ever

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.

In Topic: Lighting voxel planets

19 August 2015 - 03:08 PM

I'd either assign each face a light value or each vertex and blend them for smoother lighting depending on the number of vertices. Per vertex close up, per face a little farther out maybe?


To calculate light levels a modified flood fill should work just fine if you dont have to many light levels.

In Topic: Looking for Multiplayer 3d game engine with tools

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.

In Topic: When you realize how dumb a bug is...

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. :/