Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

For example if I have an arbitrary number of room entities and doors to other rooms can be created or removed over time, how should I achieve this?

I guess I could fix the exits to be only of type (member :north :east :south :west :up :down) since that's mostly adhered to anyway and then since your ecs is fast, 

for players solely keep the player-room connection in a property of the player entity and just search what players are in a room at a point in time. Which I guess works for a relatively large small number of players. I guess you did this somewhere I should have looked at already in your games..!

(2 edits) (+1)

Matter of fact, you can use A* w/out ECS library, I’ve made the cl-astar to be fully framework-agnostic. The only problem is it does not support sparse worlds, only dense grids; at least I haven’t designed or tried that case.

If you insist on ECS, I’d start with “current room” component (which perhaps points to the room entity) and put it onto player entity, and then perhaps I’d have “exists” component for rooms with four booleans for each direction maybe.

I don’t think cl-fast-ecs would play nice with symbol-plists, the closest thing to it would be the actual component (you can have arbitrary number of different components set on an entity).

(+1)

Ah, when I referred to using a plist, I meant in sketching component properties I put these properties in the plist as an implementation detail. So I think

(defmacro symbols2ecs (symbols)
 `(ecs:make-object
   ',(loop for symbol in symbols
           for key = (intern (symbol-name symbol) :keyword)
           for plist = (symbol-plist symbol)
           collect (cons key plist))))

Ends up with your spec for me ;p sorry for thinking out loud. I see it's been tested on ECL, I'll figure out why mine wasn't working.

I had an old version of cl-fast-ecs in my source-registry

Glad you’ve figured that out!

Right, got it, sorry for misunderstanding :)

(+1)

As to searching, you might find :index feature of component slots usable.