Настроение: | accomplished |
Entry tags: | computing |
Symta Rewrite Progress
Ok. I've updated the ECS system to use new tagged pointer system.
No changes to the type system were needed.
Yet I had to update the object creation byte code.
Now it returns an enum style tag for 0-sized objects.
Generally having these enums is useful for stuff like Nil or Empty lists.
Previously allocated these on heap, which slowed down garbage collection.
And obviously typed enums instead of raw integers are nice too.
Yet compared to C/C++ everything is dynamic, so I can convert a string to enum.
I.e. now it feels a bit more flexible and useful.
Here is how one can implement enums using this mechanism
CityNames: amsterdam kyiv moscow
type city Name: = Me = ref_ tag_(Me): CityNames.locate Name
city.as_text = "#<city:[CityNames.(gid_ Me)]>"
City city kyiv
say City //prints #<city:kyiv>
Too lazy to test the performance of the game before and after.
And it ran at 60 FPS before anyway.
Yet I can finally convert every terrain cell into an entity.
That was one of the major reasons I had to improve runtime.