-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation website #78
Comments
Something I still struggle to wrap my head around is when/where you create entities (and tag them with components). For example, where do I tag a players character as a How does UI exist within this pattern? Can I use existing libraries I'm used to, such as Roact or even Fusion? |
It may take some getting used to the fact that a game object in Anatta is not represented by an It's okay in Roblox to drive generative systems like this using the usual events: -- get the world, import component definitions, etc...
local PlayerEntity = {
fromInstance = {},
}
World:getReactor({
withAll = { Player },
}):withAttachments(function(entity, player)
return {
player.CharacterAdded:Connect(function(character)
registry:addComponent(entity, Character, character)
end),
player.CharacterRemoving:Connect(function()
registry:removeComponent(entity, Character)
end),
}
end)
Players.PlayerAdded:Connect(function(player)
local entity = registry:createEntity()
PlayerEntity.fromInstance[player] = entity
registry:addComponent(entity, Player, player)
end)
Players.PlayerRemoving:Connect(function(player)
local entity = PlayerEntity.fromInstance[player]
registry:destroyEntity(entity)
PlayerEntity.fromInstance[player] = nil
end)
return PlayerEntity One reason for creating the reverse mapping with One quick thing to note - Anatta includes no built-in facilities for networking, as it is not something I believe belongs in the library. I'm not comfortable prescribing a one-size-fits-all solution for how people should network their games. Anatta provides the basic building blocks needed to do it well, and the additional code needed is fairly simple.
The answer to the first question is definitely no! ECS sees the world as a flat collection of entities and components, and most games will need other kinds of data structures to do things like spatial queries. UI in Roblox is also a good example - although it is possible to use Anatta to make UI, there are already more developed paradigms that work well. There's no need to try to cram everything into an ECS world. One way to think about Anatta is that it's the "glue" that holds various parts of the game logic together. It provides a notion of object identity which is more stable and more predictable than the one provided by the Roblox DOM (and serializable... but this is for another day), and a means to share game state in a well-defined way. |
The API reference is in an okay state. Some behavior needs to be documented more thoroughly:
Mapper:map
causes updates on componentsReactor
- not so for aMapper
TypeDefinition
member functionstryGetConcreteType
andtryDefault
Dom.waitForRefs
Because ECS is uncommon on Roblox, there should also be good introductory material that gives a birds-eye view of the problems the library addresses and solutions that it provides:
CollectionService
The text was updated successfully, but these errors were encountered: