Code Monkey home page Code Monkey logo

merriment's Introduction

Merriment

Entity/Components based 2D engine written in C with embedded Lua scripts.

Description

Engine written on my spare time. I wanted to do a game, ended up doing an engine ... again. Hey, engines are fun.

Usage

It is currently possible to load scenes with scripts and program shaders. You can run and load a scene :

scons -Q && ./bin/merriment

Requirements

  • Scons
  • SDL2
  • OpenGL (OS X only)
  • chipmunk
  • LuaJIT
  • python2.7 (only required for the so-called "editor")

Editor

{
    "entities": [
        {
            "components": [
                [
                    "script",
                    {
                        "instance": {},
                        "path": "assets/scripts/player.lua"
                    }
                ],
                [
                    "transform",
                    {
                        "angle": 0.0,
                        "position": [
                            0.0,
                            0.0
                        ],
                        "scale": [
                            1.0,
                            1.0
                        ]
                    }
                ],
                [
                    "sprite",
                    {
                        "sprite": "assets/sprites/red_square.png",
                        "program": ["assets/shaders/vertex.vs", "assets/shaders/fragment.fs"]
                    }
                ]
            ],
            "name": "test"
        }
    ],
    "path": "scene.mp",
    "source": "scene.json"
}

Install the python requirements from /editor/requirements.txt with

pip install -r editor/requirements.txt

It is possible to convert a json scene to msgpack format with the following command :

python editor/compiler.py

To unpack a scene :

python editor/decompiler.py

By default, compiler and decompiler will run through all the files of assets/editor/ or assets/scenes/. In order to (de)compile only one file, the usage would be :

python editor/decompiler.py MSGPACK_FILE_PATH

or

python editor/compiler.py JSON_FILE_PATH

Hot reload

If you have already a running application, it is possible to hotreload a scene by pressing BACKSPACE.

Why Merriment ?

mer•ri•ment (mĕrˈĭ-mənt)

    n.  High-spirited fun and enjoyment; hilarity.

It's jun for fun and for learning.

Resources

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.