Giter Club home page Giter Club logo

matter-types's Introduction

Matter


Matter is a modern ECS library for Roblox.

Installation

Matter can be installed with Wally by including it as a dependency in your wally.toml file.

Matter = "matter-ecs/[email protected]"

Migration

If you're currently using the scope evaera/matter, prior versions are the same package. You can migrate by changing your wally.toml file to use the scope matter-ecs/matter.

Building

Before building, you'll need to install all dependencies using Wally.

You can then sync or build the project with Rojo. Matter contains several project files with different builds of the project. The default.project.json is the package build. The example.project.json is the example game build.

Contributing

Contributions are welcome, please make a pull request! Check out our contribution guide for further information.

Please read our code of conduct when getting involved.

Project Legacy

Matter was originally pioneered by @evaera. She laid the robust foundation for the work we continue today.

License

Matter is free software available under the MIT license. See the license for details.

matter-types's People

Contributors

ukendio avatar evaera avatar jacktabscode avatar lasttalon avatar nidoxs avatar anaminus avatar memorycode avatar patrick-baby avatar noahwillcrow avatar rimuy avatar xuleos avatar metrowaii avatar benbrimeyer avatar hatmatty avatar alexasterisk avatar mathfox avatar lolmanurfunny avatar 4igz avatar thefnox avatar urbanindigo avatar shouxtech avatar sasial-dev avatar samcparker avatar overhash avatar murmanox avatar majestikbutter avatar fizzyhex avatar dataencoded avatar ambergamefam avatar aloroid avatar

Stargazers

Yadi Apriyadi avatar  avatar Conz avatar Lucia Luna avatar SpencerDevv avatar  avatar  avatar  avatar Fabricio Caneva avatar Mark avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

matter-types's Issues

Community docs have been overwritten

Current behavior

The readme and other community docs got replaced during the last sync. This seems like a mistake since they currently instruct rbxts users to use this by installing with Wally, etc.

Proposed improvement

Revert to previous versions of these docs and consider most other non-src files for reverting as well to ensure mistakes aren't being made here. It seems like most non-src files are likely not needed to be updated/replaced.

Multiple function signatures are incorrectly marked as Entity<T> or AnyEntity instead of number

Add :with to world query

the matter has .without

is it possible to add something like .withAll (from Unity ECS)

it filters all entities with this component but doesn't include it in the iterator

world.query(position_component).with(enemy_component)
-- will return all entities with position_component and enemy_component ,but dont pass enemy_component

this is useful for situations if you only need position_component and not the enemy_component

QueryResult:snapshot has untyped iter metamethod

Currently it's typed as returning ReadonlyArray<[Entity<T>, ...T]>, but the return value actually has an __iter metamethod that interferes with things.

The metamethod lets you do this in Lua (the same as iterating a query without snapshotting it):

for entityId, health, player in world:query(Health, Player):snapshot() do

But in TS if we do something like .snapshot().mapFiltered(([id, health, player]) => {}), we'll generate something like:

local callback = function(_param)
    local id = _param[1]
    local cpn = _param[2]
    local player = _param[3]
end
--  ReadonlyArray.mapFiltered 
local _newValue = {}
local _length = 0
for _k, _v in querySnapshot do
    local _result = _arg0(_v, _k - 1, querySnapshot)
    if _result ~= nil then
        _length += 1
        _newValue[_length] = _result
    end
end
--  ReadonlyArray.mapFiltered 

And because of __iter, _k will end up being the id instead of the index and _v will be health, not [id, health, player], and so the callback will not get the value that the types think it will

Wrap returned component data with Readonly

Component data is immutable, but only for first scope. So I can easily edit 2-nd+ scope by accident. Is it by design, or it's impossible to wrap it to Readonly?
Ex:

SomeComponent({
someKey: []
});

const someComponent = world.get(...);
someComponent.someKey.push({});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.