malpenzibo / zengine Goto Github PK
View Code? Open in Web Editor NEWA simple 2D ECS game engine built in Rust
License: MIT License
A simple 2D ECS game engine built in Rust
License: MIT License
Create an engine logger with various output types (console, file, etc...)
Create a basic state machine to handle scene and scene changes
Select the right OpenGL version based on target OS
ref: https://doc.rust-lang.org/stable/rust-by-example/attribute/cfg.html
Add MacOS support to the engine.
Explain ECS architecture.
Principal feature:
A system can request entities with 1,N mandatory component and 0,N optional component for each signature supported.
Create the entity.
An Entity is composed of a unique id in the scene.
Create a system that can handle the event loop
Create a system that handles the window
Load some audio resource and play some sound effect
Use fnv as default hashing algorithm for every hashmap in the engine.
Use https://crates.io/crates/fnv crate and FnvHashMap instead of standard HashMap
Controller instance isn't stored after opening so the connection it's closed at the end of the function
Rewrite the engine initialization and run method to better fit the ECS architecture
Remove RefCell from the storage system.
A system now will require a context
composes of immutable references to Resource
and Set
(see Read
and ReadSet
type) and a data
tuple composes of value to Resource
and Set
(this value could be mutable). Every system should then return a tuple with the same structure of data
.
Add a pong implementation stupid as fuck in the example folder with:
Sprite sheet and GL_LINEAR filter cause texture bleeding problems.
https://gamedev.stackexchange.com/questions/46963/how-to-avoid-texture-bleeding-in-a-texture-atlas
Create a basic scene structure.
A Scene is composed of a name and a root Node. Every Node has a name and can have from 0 to N child Node.
The Engine should have a method to create the initial state from a scene definition specified in a YAML file.
Update readme with more information about the project and the youtube video series
There should be 4 main chapter
Create a texture manager
Value of Mouse move and wheel event is handled without any sense
Create an extensible asset loader.
Initial support for image and text asset
rewrite the ECS core to support archetypes
clean & reorganize code and modules
Blocked by #40
Protect master branch from mergers from branches that have not passed the build and test action
Setup a github action for build and test commit on master and pull request.
Protect master Branch with some status check
Create the new system
using raw rust functions
Write an Entities Resource to handle all entity id generation in one place
Implement a basic game loop with timing to run at a defined FPS.
The game engine should have a method to specify the game FPS.
Create the basic component architecture.
The should be a method to declare component type (what data a component handle) and a way to create a component manager to handle these components.
A Component manager should have a list<Entity> for every C where C is a component type. Each list should be accessible with the component type name.
Entity is a struct with an entity ID (a simple u32 should be fine) and an instance of component data C.
An entity should have a signature that represents what components it possesses.
A system declares what component an entity should possess in order to be elaborated.
example:
fn main() {
let component1_id = 0;
let component2_id = 1;
let component3_id = 2;
let component4_id = 3;
let mut entity_signature: u32 = 0;
// add component to entity signature (bit mask)
// bit rapresentation example
// 0 0 0 0 -> no component
// 0 1 0 0 -> component id 2
// 0 1 0 1 -> component id: 2, 0
// 1 1 0 1 -> component id: 3, 2, 0
// 1 1 1 1 -> component id: 3, 2, 1, 0
entity_signature |= 1 << component2_id;
println!("mask: {}", entity_signature);
// remove component to entity signature (bit mask)
entity_signature &= !(1 << component2_id);
println!("mask: {}", entity_signature);
entity_signature |= 1 << component1_id;
let mut system_signature = 0;
// setup system signature for request component1 (id = 0)
// same stuff as before for entity signature
system_signature |= 1 << component1_id;
// check if entity signature meets system signature
// example
// entity signature = 0 1 0 1
// system signature = 0 0 0 1
// entity sign & system_sign = 0 0 0 1
// is equal to system_sign 0 0 0 1? -> yess
let is_matching = (entity_signature & system_signature) == system_signature;
println!("signature match: {}", is_matching);
}
Create a system that can control the engine framerate
Create a very basic collision system for the game engine
Add texture to the render system
Create a way to define a list of systems in the game engine.
A system is an element with an id and a function that can exec computation over a list of components of entities that respect a signature profile.
Every system can define a list of signature profiles. Every signature profile should define 1 to N mandatory component and 0 to N optional component.
Optimize GitHub Action performance using cache
Describe the bug
When user input is defined like this
axis_mappings:
X:
- source:
Keyboard:
key: D
scale: 1.0
- source:
Keyboard:
key: A
scale: -1.0
When A Key is down InputHandler.axis_value(UserInput::X)
return correctly -1 but when the D key is clicked (down and then up, A key is still down), InputHandler.axis_value(UserInput::X)
no longer return -1.
Create a system that can render stuff
Create an event bus for system to system communication
Fix name, import, test and all the messy stuff
Update project structure to use cargo workspaces
A system to define user action in a format like
{
"axis": {
"move_y": [
{ "source": "W", "scale": 1.0 },
{ "source": "S", "scale": -1.0 },
{ "source": "Controller1.LeftStick.Y", "scale": 1.0 }
],
"move_x": [
{ "source": "D", "scale": 1.0 },
{ "source": "A", "scale": -1.0 },
{ "source": "Controller1.LeftStick.X", "scale": 1.0 }
]
},
"actions": {
"jump": [
{ "source": "SPACEBAR", "mod": "(something like shift, ctrl, alt, etc..." },
{ "source": "Controller1.Button.A" }
]
}
}
that can read events and populate the user actions
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.