ECS programming pattern question

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Habba
Prole
Posts: 4
Joined: Fri Dec 08, 2017 1:38 pm

ECS programming pattern question

Post by Habba »

Hi all,

I am working with an ECS library (specifically HooECS which is based on lovetoys).

In one of my Systems I check if the player is firing and construct a new projectile entity if she is. This entity needs to be added to the Engine so that it becomes part of the game world, but I see no obvious way to do this.

The library does not provide a reference to the engine in the systems, which was my first thought. I added this functionality myself since it is only 1 line of code but I was wondering if there is a more ECS idiomatic way to do this.
Nelvin
Party member
Posts: 124
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

Re: ECS programming pattern question

Post by Nelvin »

If you solved your problem with one line of code and you're questioning your solution with 5 lines of text in a forum message I'd say, you've already done a decent job before posting.

Seems like you found a solution, it's as pragmatic as possible (which is IMO really good) and there's actually no reason to think about this anymore. Don't get dragged into the rabbithole of overthinking stuff because you read xyz in whatever tutorial any (usually very inexperienced) coder wrote at some point of personal "enlightment".
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 62 guests