Change repo name

This commit is contained in:
bakpakin 2015-03-29 15:50:42 +08:00
parent 26ecc4f0a5
commit eb1ee4c210
3 changed files with 29 additions and 32 deletions

View File

@ -1,15 +1,15 @@
# Jojo #
Jojo is an Entity Component System for lua that's simple, flexible, and useful.
# tiny-ecs #
Tiny-ecs is an Entity Component System for lua that's simple, flexible, and useful.
Because of lua's tabular nature, Entity Component Systems are a natural choice
for simulating large and complex systems. For more explanation on Entity
Component Systems, here is some
[basic info](http://en.wikipedia.org/wiki/Entity_component_system "Wikipedia").
## Use It ##
Copy paste jojo.lua into your source folder.
Copy paste tiny.lua into your source folder.
## Overview ##
Jojo has four important types: Worlds, Aspects, Systems, and Entities.
Tiny-ecs has four important types: Worlds, Aspects, Systems, and Entities.
Entities, however, can be any lua table.
### Entities ###
@ -19,11 +19,11 @@ do logic on data. Henceforth, a key-value pair in an Entity will
be referred to as a Component.
### Worlds ###
Worlds are the outermost containers in Jojo that contain both Systems
Worlds are the outermost containers in tiny-ecs that contain both Systems
and Entities. In typical use, only one World is used at a time.
### Systems ###
Systems in Jojo describe how to update Entities. Systems select certain Entities
Systems in tiny-ecs describe how to update Entities. Systems select certain Entities
using an aspect, and then only update those select Entities. Systems have three
parts: a one-time update function, a per Entity update function, and an Aspect.
The one-time update function is called once per World update, and the per Entity
@ -39,15 +39,11 @@ are equivalent to the union of all sub-Aspects.
## Example ##
```lua
local jojo = require("jojo")
local tiny = require("tiny")
local World = jojo.World
local Aspect = jojo.Aspect
local System = jojo.System
local personAspect = tiny.Aspect({"name", "mass", "phrase"})
local personAspect = Aspect({"name", "mass", "phrase"})
local talkingSystem = System(
local talkingSystem = tiny.System(
nil,
function (p, delta)
p.mass = p.mass + delta * 3
@ -63,7 +59,7 @@ local joe = {
hairColor = "brown"
}
local world = World(talkingSystem, joe)
local world = tiny.World(talkingSystem, joe)
for i = 1, 20 do
world:update(1)
@ -71,7 +67,7 @@ end
```
## Testing ##
Jojo uses [busted](http://olivinelabs.com/busted/) for testing. Install and run
Tiny-ecs uses [busted](http://olivinelabs.com/busted/) for testing. Install and run
`busted` from the command line to test.
## TODO ##
@ -80,3 +76,4 @@ Jojo uses [busted](http://olivinelabs.com/busted/) for testing. Install and run
* More testing
* Performance testing / optimization
* API outside of source code
* Add more complete examples

View File

@ -1,8 +1,8 @@
local jojo = require "jojo"
local tiny = require "tiny"
local World = jojo.World
local Aspect = jojo.Aspect
local System = jojo.System
local World = tiny.World
local Aspect = tiny.Aspect
local System = tiny.System
-- Taken from answer at http://stackoverflow.com/questions/640642/how-do-you-copy-a-lua-table-by-value
local function deep_copy(o, seen)
@ -50,7 +50,7 @@ local entityTemplate3 = {
description = "The smallest entity."
}
describe('Jojo:', function()
describe('tiny-ecs:', function()
describe('Aspect:', function()

View File

@ -1,7 +1,7 @@
local jojo = {
_VERSION = "0.1.0",
_URL = "https://github.com/bakpakin/Jojo",
_DESCRIPTION = "jojo - Entity Component System for lua."
local tiny = {
_VERSION = "0.2.0",
_URL = "https://github.com/bakpakin/tiny-ecs",
_DESCRIPTION = "tiny-ecs - Entity Component System for lua."
}
local tinsert = table.insert
@ -34,9 +34,9 @@ local World = class("World")
local Aspect = class("Aspect")
local System = class("System")
jojo.World = World
jojo.Aspect = Aspect
jojo.System = System
tiny.World = World
tiny.Aspect = Aspect
tiny.System = System
----- Aspect -----
@ -156,9 +156,9 @@ end
function Aspect:__tostring()
if self[4] then
return "JojoAspect<>"
return "TinyAspect<>"
else
return "JojoAspect<Required: {" ..
return "TinyAspect<Required: {" ..
tconcat(self[1], ", ") ..
"}, Excluded: {" ..
tconcat(self[2], ", ") ..
@ -188,7 +188,7 @@ function System:init(preupdate, update, aspect, add, remove)
end
function System:__tostring()
return "JojoSystem<preupdate: " ..
return "TinySystem<preupdate: " ..
self.preupdate ..
", update: " ..
self.update ..
@ -241,7 +241,7 @@ function World:init(...)
end
function World:__tostring()
return "JojoWorld<systemCount: " ..
return "TinyWorld<systemCount: " ..
self.systemCount ..
", entityCount: " ..
self.entityCount ..
@ -467,4 +467,4 @@ function World:setSystemActive(system, active)
self.activeSystem[system] = active and true or nil
end
return jojo
return tiny