4
votes
Sync one thousand vector3 across network with minimal bytes?
Standard compression algorithms are pretty efficient even at the fastest setting. As a quick test I filled a text file with 34k bytes. Compressing with 7-zip on fastest setting gave me a file of 1k. ...
3
votes
Accepted
Do you recommend having a template scripts?
If you find yourself copy/pasting code, nine times out of ten you're missing an abstraction. That's not a guarantee, but it is generally correct. Especially as a beginner, you're going to miss ...
3
votes
Sync one thousand vector3 across network with minimal bytes?
It seems to me that if you have 1000 guys on the screen and they are flocking, the exact position of each wont be so important as when you have 10?
Could you have the soldiers group up as the total ...
2
votes
API design with conditional compilation: stubs and exceptions vs public API change?
Neither option is good. Conditional compilation requires two sets of binaries, and just complicates the build process. Instead, declare an interface in your project that has the methods or properties ...
2
votes
Accepted
State machine - how to handle outside environment values?
What’s the problem?
Three actions are needed to manage the state transition:
detecting the causes that trigger a state change;
determining the target state;
switch from the current to the target ...
2
votes
Accepted
Is it ok to Inject a whole object instead of only the dependencies
What you are describing is the service locator pattern. Most times it is considered an anti-pattern, however given that Unity instantiates the components, and likely requires a constructor with ...
2
votes
Avoiding duplicate code between the player and npc classes deriving from Unity's MonoBehaviour
You would keep these two classes seperate. You should think about this like a “has behaviour” relationship instead of an “is” relationship.
Make a class Npc and a class FightingBehaviour. You add ...
2
votes
C#: Structuring Saved Data for a Game
I want 2 classes that can access it - one that checks and modifies the values during gameplay and another that actually saves and loads the data to disk.
I am all for segregating single ...
2
votes
Accepted
How to do grid systems with floats given precision causes problems
The approach I use with floats in general is not to assume they're ever an integer value, even if that's what they would be mathematically. And also to test with distinctly non-integer values.
Where ...
1
vote
Accepted
Are These Both The Same Or Different If Statements
No, they are not the same.
IF Alive and Dying were mutually exclusive (i.e. it's always one or the other), then it would mostly be the same (see below for pedantic caveat). But as there is a third ...
1
vote
Accepted
Transforming a long-running operation into a step by step operation?
Hard constraints
You need to assign the data to a Mesh. That needs to happen.
There's no way around it.
The Unity API isn't thread safe, so it must happen in the main thread.
There's no way around ...
1
vote
Sync one thousand vector3 across network with minimal bytes?
Many of the ideas you posted are good. At some point you will hit saturation point, so there are some trade-offs you are going to need to make. Some of those trade-offs depend on how large your grid ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
unity3d × 23c# × 15
design-patterns × 2
architecture × 2
api-design × 2
data-structures × 2
performance × 2
interfaces × 2
dependency-injection × 2
game-development × 2
algorithms × 1
unit-testing × 1
testing × 1
api × 1
version-control × 1
refactoring × 1
inheritance × 1
language-agnostic × 1
clean-code × 1
math × 1
ruby-on-rails × 1
visual-studio × 1
graph × 1
synchronization × 1
packages × 1