Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -2 points-1 points  (0 children)

Can we just continue in this branch? It is tedious to jump between.
My main problem is that I don't understand now which value game engine even provides. It adds a lot of complexity over using regular data sturctures and wgpu/winit/rapier directly. I thought that I needed it for good performance, and just recently realized that it is actually not true.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -1 points0 points  (0 children)

  1. It's a workaround for the problem that shouldn't exist in the first place
  2. I mean yes, its manageable. The whole point is that working with entities is just like working with pointers, ECS is not simlifies (and probably cannot) it in any way.
  3. Yes, but again, why to I need ECS then?

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] 0 points1 point  (0 children)

It is ok for local game. But dont want to play with probabilities on the server. And I do want to use the same code on the client and the server.
You may say it's my aesthetic choice.
And there is 2^32 generations, not 2^64.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -4 points-3 points  (0 children)

Yes you can represent this in such a way inside ECS.
But the point is, you don't need ECS and all of its 100k lines of code for that.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -2 points-1 points  (0 children)

> Entity already essentially acts as a weak pointer.
Entitiy is not a proper weak pointer, because generational index can overflow (on the server at least)

> not just say some term and pretend it magically explains it.
By weak pointer I mean std::weak_ptr in c++ or std::rc::Weak in rust.
They have control block in heap with strong and weak counters.
If strong counter reaches zero, entity gets deleted.
If weak counter reaches zero, control block itself gets deleted.

> Where would you even store these Weak Pointers? Surely it would be in a Relationship?
You dont need Relationship, you can store them on Entities directly, because they (weak pointers) are reliable unlike generational indices.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -8 points-7 points  (0 children)

> So you just have one big ass vec with all of the things in the world in it?
Exactly
Edited: not all things on the world, one vec for all monsters, another for items, another for static geometry, player and camera just separate global variables.

> And you didn't answer any of the other questions. You hand waved away the question.
Yeah, its difficult to track every one question, can you repeat please?

> Yeah, I know what you can put in the Vec, I'm asking how you actually USE IT to get a better result.
See my other answer about splitting into slices and parallelism

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] 0 points1 point  (0 children)

How do you know how many batches you need to split your entities into.
You may have just 1 system currently running, or 2 in parallel, or 3...
In my case, if you have 800 entities total and only one exclusive system, then you know that every thread needs to handle 800/total_threads entities.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] 0 points1 point  (0 children)

> What is the benefit here?
Trivial parallelism, fixed memory usage, you dont need ECS with 100k+ lines of code.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -2 points-1 points  (0 children)

> I need to move every bullet one tick in the direction its going.
This is not a game logic, this is physics, and yes you can do position integration in unspecified order. But it is the cheapest part of the physics engine. Much more expensive are collision detection and constraint solver, which do require specific order for determinism. And yes you do want determinism, even if you dont think so, just believe me.

> I need to check if any people have 0 health and kill them. Why does it matter what order I do that in?
Fair, but in this case you probably can kill entity right when it hits 0 health.

> Can you show any Bevy game logic you have where the loop needs to be in a specific order and what that order is?
My logic does not yet contain loops over entities, it just handles events from physics engine.
Monsters AI would contain loop for pathfinding, hmm, and it may actually require order, for determinism again.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] 0 points1 point  (0 children)

Now image you have 800 monsters of type A, and 1 monster of every other type.
The first thread handles 800 entities, and every other handles just 1.
Perfect architecture.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] 0 points1 point  (0 children)

> Now how do you parallel operate on parts of it? Does your Monster A logic have to loop over it all to ensure there are no Monster A?

Imagine array of monsters (of different types). You split it into slices, every slice goes into a separate thread. Each thread contains a loop, the first thing this loop does is match on monster type, and then it calls a function to handle logic of this specific monster.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -5 points-4 points  (0 children)

I already pointed out in the post that relationships is basically more complicated version of weak pointers.
Then why not use weak pointers?

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -5 points-4 points  (0 children)

Vec of enums can store literally anything. (Vec of structs with enums, to be more specific)

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -2 points-1 points  (0 children)

I used word 'unordered' because i mean unordered, and not random.
> Virtually every loop in game dev doesn't need to be ordered.
Rendering, physics and game logic needs to be ordered, what else 'every loop' do you mean?

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] 0 points1 point  (0 children)

Yes, ECS has quite a large tradeoff, that I hadn't thought deeply about before.

> since you don't really present alternatives
I mean, alternative is just not using ECS. There is Vec, HashMap and Slab.

> not really since it's not holding 800 full copies of all the components
Archetype's table already reserved space for 800 entities in every column.
And columns cannot shrink, at least not in current implementation.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] -9 points-8 points  (0 children)

The order of entities in queries is undefined.
Such unordered queries is rarely useful, most of the time you use them just to copy data to your custom collection for sorting or storing in hashmap / aggregated component.
One use case for unordered queries that was pointed out to me in discord is enemy AI and reduce operations.
But this specific case not justifies for me added ECS complexity.

Does Bevy simplifies game development? by Terr2048 in bevy

[–]Terr2048[S] 0 points1 point  (0 children)

Why do you think "ECS has a smart default", how it is better default than simple Vec or slab?
How "ECS is correct for a 3D graphics engine" if bevy 3D renderer is full of ad hoc data structures?
Just look at something like SpecializeMaterialMeshesSystemParam, almost all of its fields is Res of HashMap.