bombfuse / emerald Goto Github PK
View Code? Open in Web Editor NEWA 2D rust game engine focused on portability.
License: MIT License
A 2D rust game engine focused on portability.
License: MIT License
Currently Kira and Miniquad do not play well together
https://github.com/Bombfuse/emerald/blob/master/src/rendering/engine.rs#L396
Creating a new render pass leaves memory behind and does not get cleaned up. Only create render passes when absolutely necessary, and re-use existing ones.
base_world.merge(another_world)
Imports all entities (without changing their id's preferably) and their physics bodies into the base world.
This is a very minor thing, but as a dark theme user, looking at your repo I noticed that the icons for the supported platforms are nearly invisible for me (and other dark theme users).
Since I was already fiddling with them for something else I took the liberty to add a white background, if you're interested: icons.zip
Something like
let touches = emd.input().touches();
where touch is
struct TouchInput {
id: usize,
point: Position,
}
and you can check for drags easily with
struct TouchDrag {
previous_points: Vec<(Position, f32)> /// f32 is the amount of time elapsed before the previous point
}
let touch_drag = emd.input().get_touch_drag(touch.id).unwrap();
This should greatly improve performance, essential before 1.0 release.
Miniquad example here
Transforms are more descriptive and contain more relevant information for an entity.
Add scale and rotation to the entity itself.
Same functionality as hotreloading textures, but for fonts
Hot reloading assets during development is a big quality of life improvement, we should add a feature hotreload
that tracks asset files.
Sprites - Track texture files, reload them in the rendering engine on change.
Aseprites - Track both animation files and sprite files, reload them in the rendering engine on change.
Sounds - Track sound files, track sound progress, reload them at the point they were playing at on change.
something like
world.physics().set_hooks(my_physics_hooks);
Audio is currently not implemented.
Need to be able to run Emerald without graphics. This means creating an abstraction over miniquad, and having an implementation that opens a window and draws, and having an implementation that only updates.
I have probably about 600 lines of code just packing game assets into the binary. This is extremely tedious and eats up more time than I'd care to admit. Make this easier.
Idea 1: Asset packing macro
#[pack_assets("./my_assets/folder")]
Packs all assets in the given folder into the binary using include_bytes!()
Currently, loader pathing is relative to where the app is run from. We need to update this so that it's relative to the root of the project folder.
It's confusing and in my experience is not the best way to store your world. Worlds should likely be stored in the user's Game or their custom game states.
I want everything to be plug and play.
emerald-core
will be the core API.
emerald
will be the default implementation of the engine.
Users should be able to swap out emerald
for emerald-core
and be able to plug in their own implementations for Rendering, Audio, and Input.
No reason for people to deal with code they don't use.
aseprite.set_layer_visible("some_layer", true);
aseprite.toggle_layer("some_layer");
We can store an Arc<Asset>
in each FontKey & TextureKey. This allows use to create a feature autocleanup
, which checks the reference counts for each asset store in the engine. When the reference count hits 1
(the engine itself is referencing the asset), then the asset can be safely freed.
This will be hidden behind a feature because it's very possible that a user would never like their assets to be freed until the application exits. Additionally, this feature is essentially an asset garbage collector which some users may dislike.
Keeps that aspect ratio of the game, draws borders on top/bottom left/right when necessary.
Paintbrush should really just be a color mod inside of emerald. No need to download to another crate and waste compile time.
Tilemaps are an essential feature for many engines, Emerald needs an easy to use Tilemap component.
This tilemap should be easy to use directly, and easy to wrap over it.
let mut tilemap = Tilemap::builder()
.with_size() // Default: Vector2(100, 100)
.with_tileset() // Default: Default texture
.with_tilesize() // Default: Vector2(32, 32)
.with_spacer() // Default: Vector2(0, 0)
.build();
// Set the tile at 0,0 to the tile of index 1 in the tileset
tilemap.set_tile(Vector2::new(0, 0), 1);
Impossible to get bug reports if the logs aren't saved in a file
When a file save is attempted to the default user directory for each platform, it should attempt to create the default user directory if it doesn't exist.
Default user directory should follow this format platform_unique_save_data_path/crate-project-name/
.
Textures can be loaded asynchronously until they need to be drawn, when they're called to be drawn, finish the loading synchronously if it hasn't finished.
Need to be able to render a font via a Label component.
Need to rasterize fonts into font textures, then based on characters in a string, render portions of the texture in sequence.
Requires parsing out the texture data, and then parsing out the animation data
Remove this code from the rendering engine.
Give the user a system that updates all aseprites in the given world with the given delta.
fn aseprite_system(world: EmeraldWorld, delta: f32);
Need to guarantee that Emerald builds cross-platform.
Future builds
Alternatively, make Kira compatible with WASM emerald.
Currently out of date, need to update Assets section and pack_bytes section
Physics bodies need to be automatically cleaned up when an entity is despawned, as well as let users remove them manually.
To alter how despawn to remove physics bodies from the world, will likely need to fork hecs and integrate it directly into the engine.
Packing textures/files isn't necessary for almost anything but WASM. The "pack" API and loading from memory should happen only if the target is WASM.
Any File (User marks a file for hot reloading by using loader().add_hotreload_target("some_file") which will add the file to the hotreload list)
Need to implement rendering to a texture, and expose a clean api for the user to render to textures.
Use this miniquad example for reference.
This has been a problem since the beginning of the project. Whenever an asset is loaded, it is never release.
Need to find a way to count the number of reference to an asset in the cache, then release it when there are no references to it.
This should ideally not break the current Api, where a user is able to clone handles to textures and sounds.
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.