Git Product home page Git Product logo

scion's Introduction

Scion

Scion is a 2D game library made in rust.

Please note that this project is in its first milestones and is subject to change according to convenience needs and big features coming.

You can use Scion as you want, although I just made this open source to serve the community not to be a competitor to the current Rust game engine ecosystem.

Why this project?

Well, firstly because it's a good way to learn the different aspects of game dev under the hood. Then, because I wanted to create something with modest goals, focused on ease of use and a short list of principles that also serves as a guideline.

Scion is not 'inspired' by any other engine, it's inspired by the needs from real game projects. This means I don't implement feature juste because I've seen it elsewhere, but because I need it for the next project that uses Scion.

Goals

  • Strong focus on 2D only.
  • Easy and Fun to use.
  • Clean and readable source code (at least we'll try to rewrite when necessary)
  • Editor-less, it's a lib and should always be

Non goals

  • Ultra/over optimized code and performances. For this, please try other engines or build your own!
  • 3D

Documentations, Tutorials?

Yes, they are planned and being worked on. If you want to see scion in action, check the examples for now.

Why ECS?

Today, ECS is like a 'magic' word for games, game libs and game engine. But ECS is not and must not be considered as a universal answer to multiple questions. I believe that ECS has its strength and its weaknesses. The choice of it here is made because the main target games of this lib at its start were to be able to make:

  • a complex city building game.
  • a pkmn fan game with real time trainer progression and wild pkmn.
  • granular network packets representation && dot simulation games.

Notable dependencies

These are the dependencies this project is relying on. Thanks to these awesome communities, we are able to build this kind of tiny projects.

Pre-requisites

To build Scion, you need to install the required packages for your system:

Debian, Ubuntu, PopOS...

sudo apt install gcc cmake build-essential libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev

Fedora

sudo dnf install gcc cmake make automake gcc gcc-c++ kernel-devel libX11-devel libXi-devel mesa-libGL-devel alsa-lib-devel

Arch, Manjaro...

sudo pacman -S gcc cmake make automake linux-headers libx11 libxi mesa alsa-lib

Run an example

Then, you can run an example:

cargo run --example bomberman --release

Showcase

Taquin Tetris Pixel-adventures
Bomberman Jezzball New bark town
Starlight Starlight

scion's People

Contributors

suspistew avatar alocquet avatar pt2121 avatar antonio-bennett avatar kaimuell avatar celeo avatar yash-punia avatar juanapatankar avatar zurrty avatar

Stargazers

Ahmed A. avatar  avatar  avatar JiangBo avatar SkuldNorniern avatar Yan Chen avatar Andreas Gillberg avatar Oli Garrett avatar Ilya M avatar  avatar  avatar  avatar alwayrun avatar Makks avatar zc avatar dusk avatar Jeremy Elalouf avatar  avatar Juha avatar  avatar Tristan Maindron avatar  avatar David Moulin avatar Tara Drwenski avatar  avatar  avatar Alec Newman avatar  avatar  avatar Peter Richmond avatar  avatar Sergio Alejandro Ribera Costa avatar Bora avatar breno avatar  avatar RanolP avatar namhyunuk avatar georgie avatar Simon avatar  avatar  avatar Shujaat Ali Khan avatar siri vus avatar Flove avatar Hubert avatar Wojtek Gawroński avatar Danilo Inácio avatar Scott Rallya avatar lei_xxx avatar Andrey Peysakhovich avatar Maxwell Yu avatar Jerry Snitselaar avatar Khant Htet Aung avatar Mr.HyperBit avatar  avatar Priyanshu avatar Jake Larson avatar Fred avatar nobbele avatar Adheesh Wadkar avatar Dmitry Kolesnikovich avatar Sergey avatar hon avatar dh avatar  avatar  avatar  avatar Nikita Zhenev avatar Daniel Durante avatar Pierre Fourgeaud avatar Miguel Gargallo avatar Weykon avatar Nodar Chkuaselidze avatar Ziloka avatar VU avatar William Fernandes avatar Daniel Vincent Horgan avatar Shareef Ifthekhar avatar Iggy Zuk avatar Robert Torrell Belzach avatar jamie avatar  avatar Nicholas Westerhausen avatar Jeremiah Loy avatar Ryan Bell avatar Thomas Murphy avatar SkillerRaptor avatar Simon Bernard avatar Tim Peters avatar Roberto Amaya avatar  avatar Hyun Sick Moon avatar Rob avatar  avatar Sean Hagstrom avatar Josh Mize avatar Guilherme Werner avatar Gustav Beije avatar Adam Dusty avatar Erdal Acar avatar

Watchers

huluwa avatar James Cloos avatar Sergey avatar  avatar Nishit Prasad avatar

scion's Issues

Texture transparency

While making the taquin, I saw that there was no transparency on png textures.

It's needed for bitmap fonts

Implement the tetris in Scion

The tetris should have this following features:

  • Have only one image and each shape type has 1 tile
  • playable as a classic tetris
  • Be pausable with ESC
  • Display the next piece in the ui
  • Display the score in the ui
  • Have a death condition. No retry etc... button are for another milestone

Make a quick explanation of 'Why ECS'.

Today, ECS is like a 'magic' word for games, game libs and game engine. But ECS is not and must not be considered as an universal answer to multiple questions.

I believe that ECS has its strength and its weaknesses. The choice of it here is made because the main target game of this lib is to be able to make a complex city building game.

I need to explain this somewhere on the project.

Implement a generic Timer feature

The goal of this feature is to provide users a way to easily have a list of timers without always needing to stock it in systems or game layers.

It will also later be used internally to handle animations timing.

Switch the default format from toml to json

This is personal preference.

Currently, using Scion::app() will try to read Scion.toml at the exe root.
The goal is to replace this behaviour by a scion.json.

Currently, we also have two ways to enter the Scion app (scion::appand scion::app_with_config). I need to also be able to give a custom path to the config as I don't want to be too restrictive on the project hierarchy.

Add a Scion::app_from_path(path: Path)

Also provide a way to give a custom path for the main config file

Solid logging implementation

The main idea is to provide a solid logging implementation based upon the log crate. These are the main concepts :

  • Configurable logging output
  • Colored

Make the configuration to be set from code and not only from file

Well inspired by the idea I've used on another engine I set Scion.toml. But as of today, I kinda think we could want to create the app with a config that come from the code. So we need to add this to the Scion app.

Goal :

Ba able to call Scion::app_with_config(config)

Create a window config

Create a window config and use it in the main scion config to configure the miniquad window

Keyboard inputs

We need default arrows inputs to be able to do basic controls

Move back to Winit and Wgpu

Why this choice ?

The goal of this tiny engine is to be a minimalist 2D engine. Going with Miniquad seemed the right way for this, but I have some problem (not with miniquad, it's a really good lib !), about what I want to achieve with this project, and what Miniquad gives to me.

Minimalist doesn't mean old

Miniquad is based on old version of everything. First, it's on openGL. openGL will still be a good thing for a couple of years but it's dying. At this time, to be able to deploy everywhere, you need to stick to openGL version 100. That's ES 1.0 from 2003. And we're in 2021.

My learning time is limited. I think the best investment for me as I want something durable, is to learn either about WGSL or SPIR-V. As of today, the main lib providing a multi platform way around this is wgpu-rs. It's based on WGSL (or it's moving to WGSL at least). So, I'll stick to this choice.

OpenGL is dying

OpenGL is not something to build new engines on, on a long term. It stills has some time left as written before, but I'm pretty sure it won't attract people.

lib dependencies vs WASM

Yeah, this engine uses legion for the ECS part. And clearly, it's not compatible with the WASM pipeline provided by Miniquad (because of transitive wasm-bindgen).

Problem : Now we have 70 dependencies, tomorrow we'll have like .. 200 :(

Render UI Text with Bitmap font

It's the first text rendering I have to do.

In my knowledges there are two main types of text rendering : bitmap and free type.

Bitmap are just texture with uv map, so no font size for the text since it's just the one you gave.
It's a easier pipeline to create and also a lightest. As for now, the tetris will be on a fixed size, It's okay if I go with this

Later, when I'll do complex UI, I surely will add free type rendering, but until then, I'll just do a simple bitmap.

Bounded concurrent messaging queue

Create an internal Messaging Systems that allow :

  • Concurrency (multi consumers, multi producers): This is needed because we don't want to duplicate the events.
  • Topics: One topic is dedicated to one event type.
  • Bounds : Optionally set a limit per topic. Convenience to be able to have a limited in memory size for the topics.
  • Pull based consumers: Consumers call the topic to get the new events using an offset. Each consumer has a pull size limit to know the maximum event it can pull in one call
  • Pausable: When pausing the game, switching layers, some topics may want to stop receiving && accept pull request from consumers

That's all, then we use it to track event in the game engine and allow users to create topics, producers, consumers with either convenience functions or macros.

Draw a simple colored triangle

So the concept is easy. Draw a simple colored triangle on the window. Not the final feature, but will be the first step in the rendering process with Miniquad

Implement a first Layer feature

This is an effort to provide a way to create Layers in the game engine that connects with the main game loop.

A game should be considered as a pile of layers.
Layers are always executed from the top of the pile (LIFO).

A layer can either be Weak or Strong:

  • Weak : Does not stop the next layer execution
  • Strong : Stops the next layer execution (Useful for pause)

A layer is a Trait that needs to have this list of function :

  • start
  • stop
  • fixed_update
  • update
  • late_update
  • on_enable
  • on_disable

In the scion data, each added state must be flagged as enabled/disabled or be totally removed from the pile.

WindowDimension

Creates a new default resource that simply keeps track of the main windows dimensions.

Create a file loader utils

Create a simple file loader that takes a file and load it in memory to bytes.

This will be used internally but should be accessible to the end user.

Mouse position

The goal is to create a resource that will consistently update the mouse position to know every time where it is.

Create clean label for the render pass and pipelines etc...

Every component has its own vertex buffer descriptor and indexes buffer descriptor

As you can see in https://github.com/grzi/scion/blob/main/src/core/components/ui/ui_image.rs

The problem is that due to a lot of copy paste, we now have wrong label for all of the renderable components.
We need to change the name of the buffers to reflect the real object beeing created

For this issue, let's find all Renderable component and clean the labels of each one.

Lay the ground for the rendering

Even if for now only one renderer is planned, I would like to make it so it's possible to give a renderer from the app config.

So in the future, I'll be able to give a custom renderer or choose between the internal ones

Implement a Game User Settings convenience utils

The goal is to provide a way to store, access player settings during && between different sessions.

The purpose is not to store game saves. It should be used only to store settings (windows, langage, in game volume etc...)

Implement pausable systems

Actually, the only way to create a pausable system is to specify in each pausable system something like

if myresource.myvalue != 'the value that set it to pause' {
execute the code
}

I want a more convenient way to do this.

I may take the side of do something like this :
By default, I add something like ScionState that will keep a track of what the last state on the pile is.
I also want this state to have an easy way to store basic bool for the user if he wants to.

Then, I'll be able do to something like this :

Scion::app()
           .with_pausable_system(my_system(), |scion_state| scion_state.top_state != 'Pause');

0.0.2 milestone planning

So it's time to decide what path I want to take next.

0.0.1 was a proof of concept to make the lib work and decide whether or not I should continue. I'm kinda proud of the result.

Back in 2020 I made a tetris like game with Amethyst engine. So I have a working tetris source code.

Going for tetris is a good path as it's a standard in the learning process of beeing an hobbyist game dev. It will also be a nice exemple for potential users.

what do I need ?

  • Basic UI (Render text and images on top of everything)
  • Sprite material
  • Keyboard inputs
  • Pausable systems

Ci is breaking du to a bad linkage.

/usr/bin/ld: cannot find -lGL
/usr/bin/ld: cannot find -lXi

On the doc it's written :

apt install libx11-dev libxi-dev libgl1-mesa-dev

Check the after this to be sure it's ok

Add a way to add / remove layers

Actually, there is no way to add / remove a layer once the game is started.
This is needed to be able to add for example a pause layer.

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.