Nolram
Nolram
Explore posts from servers
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
In a larger project - ECS for the win, absolutely
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
ECS just makes everything more complicated in this project where the total project complexity is not expected to be very large.
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
I have, and it's not suitable for this project due to the target demographic of programmer, additional overhead to tooling creation, etc etc
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
hence my interest in source generators, because right now there's still a bit of boilerplate here and there (such as registering a button with the editing tool to create a new entity of a new given entity type, and now also the clone function). In an ideal world, I'd be able to just create a new entity type that derives from some interface or baseclass and have the rest happen automatically, but that's sadly not possible without advanced reflection (which I can't due to NAOT) or source generation.
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Higher performance is certainly preferred in my case; but actually the Nr. 1 priority is ease of implementation for someone creating a new entity type, as that's the code on the project that won't be written by me. I.e. minimizing boilerplate and all that
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
I'm aware you can; I just avoid it :)
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Oh I was talking about multi-inheritance in the sense of inheritance depth, not necessarily amount of interfaces implemented at once
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
I always thought classes were moreso about overriding base behaviour rather than having to conform to a template
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Hm, I see. I suppose I'll migrate over the a base class then (I'm not super familiar with them - I come from a procedural & data-oriented background with C++ primarily), I didn't know they actually prevented multi-inheritance.
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
I didn't consider the interface to actually exist within itself; just to be a template to implement.
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Hmmm, okay. I generally considered Interfaces as essentially just a "contract" that a type has to implement in order to qualify generically as that interface.
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Eh, is it? I just have a single interface that my entities have to implement for some basic engine callbacks
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Hm, that seems to go a bit into multi-inheritance which I generally try to avoid; so instead may be better
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
So I'd need to use a baseclass instead of an interface?
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Unless there's some odd trick I don't know about.
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Looking into MemberwiseClone - seems I unfortunately can't just have a standard implementation in my interface that calls it :(
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Right, I should actually be fine with a shallow copy since I would expect my entity types to only have value types, so that might actually work - thanks! Sorry for stealing your time.
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
I've had a look now at this, however this seems to just be used to box the type. I'm still trying to create a copy of my object (now a class). Reading up on it online, it does seem that now the only way to actually do that sort of copy (without weird hacks like serializing & deserialising) is via a clone function, which returns to my original question about being able to source-generate it. Are you randomly aware of any info or resources about that? I've heard source generation can be quite difficult & tedious, so if it ends up being too complicated I may just stick to manually writing a clone function.
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Thank you for informing me though, greatly appreciated :)
58 replies
CC#
Created by Nolram on 3/3/2025 in #help
Odd behaviour copying structs
Hm, yeah, seems I'll have to deal with it being passed by reference. I'll change over to a class then, it's not a big deal in my case
58 replies