« first day (3928 days earlier)      last day (1094 days later) » 

user92578
3:34 AM
@Vaillancourt That looks pretty neat!
 
2:32 PM
@Tyyppi_77 Thanks! If I have time, I'll try to take the "properties" out of the struct, but that'll need more thinking.
 
user92578
What C++ version are you on?
 
"early 17", using VS 2017
 
user92578
You might be able to rely on CTAD and just write Property{&Engine::mRpmIdle, "rpmIdle"} to clean things up a bit
 
user92578
Also the serialization recursion might be able to be cleaned up with std::index_sequence and a fold expression if you're interested in that
 
By fold expression you mean something like template<typename Thing, typename... Things>?
I used something like that for the ECS when I getComponents<CmpType1, CmpType2>().
 
2:43 PM
SHOW ME WHAT YOU GOT
 
user92578
In this case more like
 
user92578
template <typename... T, std::size_t... Indices>
void Foo(std::tuple<T...>& t, std::index_sequence<Indices...>) {
    (DoThing(std::get<Indices>(t)), ...);
}
 
user92578
Didn't check if that compiles but the fold expression is the ", ..." inside the implementation
 
user92578
(If written correctly) this will call DoThing() for each element inside the tuple
 
user92578
You just need a wrapper to invoke it with make_index_sequence based on the size of the tuple
 
2:45 PM
aaah, right, right, good call, I'll check that out!
I've tried to use CTAD but it "doesn't work" so far!
@Almo Hmm? want me to show my recursion?
Does it recurse? Hmm.
 
user92578
Oof no CTAD :(
 
Ah yes, it does. It does a bit like parsing a list in prolog?
Not sure I can copy-paste this code, that's what I use at the office and that's probably a trade secret or something...
 
user92578
Well it will instantiate a new function for each I, dunno if that's worse than the index sequence but at least with fold expressions you don't need a specific terminating implementation
 
Yeah, good point. I don't really "care" about time or spacial efficiency here, that'll be ran once at startup and we don't mind generating bigger .exes...
Perhaps making this code similar to the other "complicated" template code I have will make life easier for the person that will have to maintain it, either me or someone else.
It would probably be safer (for my colleagues to copy-paste this), to use something like Property<Engine, decltype(Engine::mRpmIdle)>{&Engine::mRpmIdle, "rpmIdle"}, which could also be replaced with a macro, something which would be called like this: MAKE_PROPERTY(Engine, mRpmIdle, "rpmIdle").
 
user92578
3:00 PM
Usually you can replace CTAD with a function too if you want to avoid macros
 
user92578
That's why make_tuple etc. exist
 
Okay, I'll check that out! But not now, though, I need to attend to other things. Like condo stuff. fun fun fun.
(not)
 
 
4 hours later…
7:22 PM
I just finished making crosshairs for my game. But then when putting it into my game, I realized that I have no idea how big to make my crosshairs. See, I have multiple crosshairs, for whichever the player(s) prefer. I know how big to make my dot, and my donut, but I have this far more advanced crosshairs that looks like a plus, but has multiple moving parts.
I don't want to make it too small or else the player can't see the markings. the marks are arrows and indicate things such as if the thing is an enemy, or an ally (also indicated by color), if it can or can't be shot, or if shooting it will kill/destroy it, but in doing so, it will not benefit the player in any way (like shooting a bird or a fox, etc.) It can also tell the player if it is an object, sentient lifeform, or vehicle.
And btw plants fall into the object category.
 
user92578
For an initial prototype you can move forward with just a dot crosshair :)
 
Right.
But still, I can't figure out how big it should be.
 
user92578
Existing gameplay content will also help you determine what kind of sizes are enough for the markers to stand out from the rest of your content
 
user92578
Or alternatively just make them 20px wide
 
Because I can't look at Borderlands for an example, which is the game I play the most, because I'm always a Sniper (Why run in to combat and get shot, or kill an enemy in like 20 shots; when you can shoot them from a distance, one-hit-kill them, and not even take damage?) Being a Sniper, I'm always looking through a scope. And the crosshairs on a scope are actually aiming markings, found on real scopes, and they take up the whole screen. So, I don't really pay attention to the tiny crosshairs.
Good point, though, I'll start them at 20px wide, and then go bigger/smaller depending on the game.
 
user92578
7:35 PM
Luckily this isn't a priority for you so you can just set it to whatever or even leave it out until you have more gameplay going
 
8:30 PM
True.
Want to see all of my pre-planned crosshairs configurations?
 

« first day (3928 days earlier)      last day (1094 days later) »