MrGodin wrote:I've been thinking, i am so lazy with my const correctness i think i'm going to refactor a bunch of stuff. I've gotten lazy with some coding and frankly, the way the standard changes so much, it's easy to just spend a whole lotta time learning all this stuff and never really coding up something exciting. If you know what i mean.
I can understand the concern, and it isn't necessary to implement all the latest features the C++ standards come up with.
There are things that keep me guessing though. Pass by value or pass by constant reference. It's usually common knowledge to pass structs/classes by constant reference, but with copy elision and move semantics it's not so black and white. Copy elision is where you instantiate an object using another object either by returning the source from a function or passing to a function that has value parameters.
struct S{};
S Foo( S s )
{
return s;
}
S a;
S b = Foo(a); // b will be instantiated using a copy of a, but only one copy is made, from a to s
S c = Foo( S{} ); // c will be instantiated using default constructor of S, no copies will be made.
This seems trivial, but I'm obsessed with getting the best performance, so for me not having a clear path is crippling. Then there's cache locality. For passing small classes, say a vec3, would it be faster to pass by value so that the data is fresh in the cache?
Aside from that, I tend to give up when I spend a few days on something and can't figure it out. Collision handling is one of the biggest hurdles I've had. Not so much the detection, but the correction portion. Then there is architecture. How to get things to interact with each other without too much coupling. I like the use of a messaging system, and yours is pretty straight forward using defines or ints and switch statements, but I want something a little more object oriented and I haven't been able to grasp that yet. Probably because I'm trying to use polymorphism and inheritance. I should probably try using templates, but then there is the issue of not being able to use std::vector. I have shied away from using map/unordered map, perhaps it's time to look into it.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com