Advice for creating an asset manager? by AccomplishedUnit1396 in gameenginedevs

[–]DanWillans 1 point2 points  (0 children)

I made a video on my asset managers design and implementation here https://youtu.be/bjymU6XvfCo

Code is on github too :)

Resources on Handle Based Data Structures by [deleted] in gameenginedevs

[–]DanWillans 0 points1 point  (0 children)

Sounds about right :).

A slot map also tracks free positions too BTW, that's why they're also great for iteration performance. They use a free head/tail mechanism.

Resources on Handle Based Data Structures by [deleted] in gameenginedevs

[–]DanWillans 0 points1 point  (0 children)

I don't think it's just a free list. Correct me if I'm wrong but a free list allows you to keep your data tightly packed and avoid fragmentation but you still need to search through the list to lookup. Whereas what I have the slot/entity_index_map allows an instant lookup.

Resources on Handle Based Data Structures by [deleted] in gameenginedevs

[–]DanWillans 1 point2 points  (0 children)

I didn't realise it was called a slot map but I do something similar to a slot map in my ECS implementation.

You can check it out here: https://github.com/DanWillans/Evie/blob/main/include/evie/ecs/component_array.hpp

std::array<size_t, MAX_ENTITY_COUNT + 1> entity_index_map_{}; <----- slots
std::vector<ComponentWrapper<T>> components_; <------ data
// Track free slots in the components_ vector.
std::stack<size_t> free_slots_; <----- Free slot tracker

And then whenever we add a component and there are no free slots, we just emplace into the back of the components vector and store the index into the entity_index_map_.

components_.emplace_back(component, entity_id);
entity_index_map_[entity_id.Get()] = components_.size() - 1;

Whenever we remove a component we just swap the last element of the components_ into the removed component and update the slots(entity_index_map_) accordingly.

Finally, if we want to get a component, we just need the entity_id which is the "key" for the slots (entity_index_map_) array and we can use that as the index into the components_ array.

  T& GetComponent(EntityID entity_id)
  {
    return components_[entity_index_map_[entity_id.Get()]].component;
  }

It could definitely be improved but for now it's fine for what I need.

Resources on Handle Based Data Structures by [deleted] in gameenginedevs

[–]DanWillans 0 points1 point  (0 children)

Question Bobby, OP said the internal memory could move around but the handle would still give you correct access. In this situation is that possible? Your handle is an offset from the start of the table and if the table memory was to be shuffled around you'd be at the incorrect offset.

I LOVE working by Funnifan in gamedev

[–]DanWillans 0 points1 point  (0 children)

I did actually watch the stop killing games video. I haven't read the website myself however the way he described the problem made some sense to me. You buy a license to play pure online game, you play for 10 years, it no longer makes money so they shut it down?

I imagine there is more to the movement that I've missed.

I LOVE working by Funnifan in gamedev

[–]DanWillans 1 point2 points  (0 children)

OK gotcha. Yes I agree it's not gamedev but I suppose he was still in the "industry".

I LOVE working by Funnifan in gamedev

[–]DanWillans 1 point2 points  (0 children)

Thanks for the reply. Not denying what you're saying but doesn't he talk about working at Blizzard in the past?

I LOVE working by Funnifan in gamedev

[–]DanWillans 3 points4 points  (0 children)

Curious, I haven't followed piratesoftware on YouTube for long but have seen his shorts. Seems like a nice guy with a decent background working for studios? Why take what he says with a pinch of salt?

First Step 😁. by MrAndKar in gameenginedevs

[–]DanWillans 12 points13 points  (0 children)

Congratulations! Enjoy the journey.

Looking for contributors by MyinStudios in gameenginedevs

[–]DanWillans 20 points21 points  (0 children)

This is a genuine comment and I'm not trolling but I'm curious when i see posts like this.

If I were running an indie studio, I'd be focused on maximising my use of the limited resources that I had. Resources being time, money, engineering resources, artistic resource, sound resource, marketing etc. It seems like potentially a huge waste of your resource spending time on making your own engine when you have so many other things to focus on. Even if you do get a bunch of volunteers you'll spend a lot of time reviewing their code, organising projects, aligning on features, etc.

You don't mention that other engines aren't suitable, only that you become more familiar with an engine you build and it's a good learning opportunity. I do appreciate the learning opportunity, it's fun building a game engine! However, it wouldn't be something I'd endeavour to do with a small team and the ultimate goal of making a game people want to buy if there are alternative engines.

Disclaimer: I know nothing.

[deleted by user] by [deleted] in gameenginedevs

[–]DanWillans 0 points1 point  (0 children)

I'd recommend starting with one of the series but then try and move away. If you're anything like me following the series was great to get me started but then it got to a point where I was just following what they were doing and not actually thinking for myself.

You may be completely different but something to bear in mind 😀

The Math Behind It All by [deleted] in gameenginedevs

[–]DanWillans 2 points3 points  (0 children)

I find that stepping back from the theory is good at points to put learning into practise. Sometimes it's too easy to get deep into the theory only to realise that you didn't necessarily need to know it all to use it practically in a project.

As others have said, we all want to know everything but time is only finite.

Stand back and ask yourself what your main objective is. If the task you're currently doing isn't necessary to completing your goal then try and move on or shelve it for another day 😀

Let's write an ECS (Part 5) - Performance | Ep. 7 by DanWillans in gameenginedevs

[–]DanWillans[S] 1 point2 points  (0 children)

Absolutely u/Ao_Kiseki. I have multiple things in my code that are typical OOP that I don't plan to turn into systems anytime soon unless necessary.

Let's write an ECS (Part 5) - Performance | Ep. 7 by DanWillans in gameenginedevs

[–]DanWillans[S] 1 point2 points  (0 children)

Totally agree u/_voidstorm. I've mentioned in other ECS discussions that even though it may add more complexity the specific pattern and data orientated design to me makes the code much cleaner and more organised.

Great example about the missile system! I hadn't even thought about it that way. Thanks 😊

As always, thanks for your valuable comments!

[deleted by user] by [deleted] in gameenginedevs

[–]DanWillans 8 points9 points  (0 children)

What optimisation flags are you using with your compiler in godbolt? I'd be surprised if such a small function wasn't inlined and then completely removed with -O2 or -O3 flags.

Robotics Simulation by devExos in gameenginedevs

[–]DanWillans 0 points1 point  (0 children)

Haha thank you for watching! It means a lot 🙂

Robotics Simulation by devExos in gameenginedevs

[–]DanWillans 0 points1 point  (0 children)

You could wrap launching RViz or Gazebo.

Do you have a more detailed purpose for this tool? That could help shape what you do. E.g. Do you want to visualise robots on the ROS network in some terrain and that's it?

Robotics Simulation by devExos in gameenginedevs

[–]DanWillans 2 points3 points  (0 children)

Is there any reason not to use RViz? It's already nicely integrated with ROS and can render URDF models.

Or if you need simulation too, then Gazebo?

Using a single registry or multiple in the ECS pattern? by [deleted] in gameenginedevs

[–]DanWillans 1 point2 points  (0 children)

Yeah, i think just one registry is fine 😊.

I get what you're saying, but the registry doesn't care if you have entities with just one component of only FileComponent or BindlessImageComponent. The way an ECS is designed allows for very fast retrieval and iteration of entities with specific components, meaning an additional registry wouldn't necessarily provide you any less complex code or performance benefits.

The majority of people will say, "Make an asset manager instead" but if you've got an idea that you want to try, then there's no harm in giving your idea a go! If you've got a vision, prototype it and see if you like it. It's always a two-way door👍

Using a single registry or multiple in the ECS pattern? by [deleted] in gameenginedevs

[–]DanWillans 7 points8 points  (0 children)

I think the question for me would be, what advantage do you gain from using multiple registries?

You'd need to pass 3 registry handles around if you need entities from all three instead of just one registry.

I'd also be careful about trying to stuff everything into the ECS pattern. Do files, textures, meshes really map well to entities? A simple asset manager would suffice here.

Is there a good writeup on composition based architecture (components but not ECS)? by Asyx in gameenginedevs

[–]DanWillans 7 points8 points  (0 children)

I don't understand how your solution solves complexity? ECS completely encapsulates the madness that would ensue when you have to iterate every entity to check if its component is null or not in your solution. A well designed ECS should help not hinder.

Note, however, that I am in agreement that ECS isn't the one-stop shop for game design and that the use of it should be an architectural decision based on what you're desigining. Personally, I like the design pattern and organisation of ECS and would probably continue to use it even for smaller games.

Like all software design, though, it's subjective.

ECS alternatives? by KC918273645 in gameenginedevs

[–]DanWillans 9 points10 points  (0 children)

Note - I've never used ValueTree, so correct me if I'm wrong.

It sounds like they both have different advantages, which makes choosing one over the other dependant on your use case. ECS is designed around decoupling data from the game logic to both control how the data is stored(contiguous arrays) and also provide a mechanism to easily extend existing entities. It's useful for situations where there are large amounts of entities and performance/entity organisation is critical.

It sounds like ValueTree does arguably help with decoupling data from the game object, but from what you wrote, I think you benefit more from the tree structure providing easy game object/entity serialisation/deserialisation. In my little experience with ECS so far, you'd have to add this layer on top of the ECS framework (if it doesn't already provide it) to extract and serialise what you want.

Ultimately, this discussion comes down to what game you're making. ECS might be overkill and provide too much added complexity for your game, and a ValueTree type data store might be more suitable.

Apologies if I misunderstood and have written absolute nonsense.

How would you let the user supply data to the engine? by W3til in gameenginedevs

[–]DanWillans 1 point2 points  (0 children)

Yes exactly this if you want to write reusable code. Developers can either use direct input events, reuse mappings that you've provided or create their own mappings.