Coder Social home page Coder Social logo

thomasdepian / marbleevolution Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8.2 MB

A small project showing how marbles find their way to a goal using a genetic algorithm.

License: MIT License

HTML 15.06% TypeScript 82.95% JavaScript 0.68% CSS 1.31%
marble genetic-algorithm phaser3 typescript evolution

marbleevolution's Introduction

Marble Evolution

GitHub GitHub package.json version GitHub Workflow Status

A small project showing how marbles find their way to a goal using a genetic algorithm.

Demo

To checkout the demo version see this link.

How to play

Human mode

Once the game has launched left-click somewhere in the game-frame to adjust the direction and the power with which the marble should launch.
The coloured line shows you the approximate direction and the text in the lower right corner tells you with which power the marble launches. The higher the power, the faster the marble moves. By releasing the mouse, the marble launches.
The text below or next to the game-frame shows you some basic information about the distance to the goal and the best distance reached so far.

AI mode

Once the game has launched a left-click inside the game-frame starts the simulation.

Configuration

Various settings can be configured without touching the code. There exists a folder config with two .yaml files: config.yaml and default.yaml, both containing some configuration values for the game. At startup, the config.yaml will be loaded and serves as the initial configuration, whereas default.yaml is just a backup copy in case you mess up the configuration.
The game contains also several ways of changing some values (as for example the mutation rate) 'on the fly'. Just change the values on the webpage. The changes take affect once you press Reload to apply configuration. Please note that the configuration will not be saved, unless you manually copy the configuration values into the file config.yaml.

The possibility to change other settings and save the current configuration will be added in future versions.

Project setup

Prerequisites

If you want to run the code in your own environment you need a web server running on your machine. If you already have one installed just set the root folder to this folder and you can enjoy the game. If you haven't any installed, I can recommend you http-server. Just follow the documentation on the provided link.
Alternatively you can set up the developing environment which has a built in web server.

Running the project

To start the game just launch the server, visit the url your webserver is telling you and have fun.

Developing

Prerequisites

If you want to develop you need Node.js installed in your developing environment.

Installing the dependencies

The project per se does not have any dependencies. Yet there are some development dependencies which needs to be installed. They can be installed with the command

npm i -D

Provided development commands

To speed things up there are several commands which can be launched:

Rebuild on change and reloading
Run

npm run start

to start the live rebuild and live reloading. The game launches automatically in the browser.

Generate the documentation
Run

npm run document

to generate the documentation. It will be generated in the folder docs.
To view the documentation move to the docs folder and open the index.html file.

Build the JavaScript
Run

npm run build

to build the project and generate the minified javascript file app.js in the dist folder.

Documentation

Don't want to dig through the lines of code to understand how everything is connected? I can feel you. The latest documentation can be found in the docs folder. The documentation of the latest release can also be found online.

Contributing

Want to add levels? Or have another idea?

First of all thanks for showing the interest to participate. Please feel free to fork the repository and change whatever you want. Once you are ready create a pull request and I will review your work as soon as possible.

Found a bug?

Your eyes spotted something you think is wrong?
Chances are high that I am aware of the bug, as the current versions are still under heavy development. But if the bug persists over several versions feel free to open an issue.

Other Resources

Build with Phaser3.
Documentation generated with typedoc.
Styled using Bulma.
Assets used:

Development dependencies:
See package.json

Licence

For the detailed license see the Licence.

MIT © Thomas Depian

marbleevolution's People

Contributors

dependabot[bot] avatar thomasdepian avatar

Watchers

 avatar

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.