Re: [Vala] Treating a uint as a reference type?



From: Alan Manuel Gloria <almkglor gmail com>
Semantically, an Entity is a reference to a row in an entity component
system; it just happens to be implemented using uint.  


This kind of sounds like referential integrity rules in 
a relational database. I presume you not using a database
for performance and/or memory issues?


I want to do this> because when I delete a row in the ECS table, I want the row to be retained
as "deleted" until all references to it are dropped, so that I avoid 
the "missile suddenly chases a new entity" problem.

By 'retained as "deleted"' do you mean changing the state of the row so it can
no longer be used when a new entity is created? Would it cause too much of a
performance hit if the row had an 'allow new references' boolean that caused
a newly created entity to skip it if the row was closed?

Another thought is GLib signals, these are Vala signals, with a return value.
So you would emit an I am about to delete xyz referenced component and if
anything returns no don't do that the component is kept. I've not used return
values so not sure how this would work and is a bit more heavy weight compared
to reference counting.

Just a few thoughts. I got the impression it could be a design issue rather
than an implementation one.

All the best,



Al


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]