Git Product home page Git Product logo
 photo

dibidabidab Goto Github PK

repos: 8.0 gists: 0.0

Type: Organization

Bio: Collection of repos related to a game about unicorns

Twitter: hilkojj

Location: Netherlands

Dibidab Engine

Dibidab is a small game engine with some nice features that I'd like to reuse.

Features:

  • ECS based (Entities are built out of Components, using EnTT)
  • All components are serializable
  • Saving and loading Levels (entities and their components)
  • SaveGames (saving custom progress data, or custom data specific to an entity)
  • Multiplayer (automagically sending entities and component updates over the network)
  • Lua scripting (create and update entities and their components using the Lua API)
  • Live reloading (reload assets and scripts while your game is running)
  • Entity Inspector (inspect and change component values in a GUI)
  • Profiler (get an overview of what is taking up the most time in your game-loop)
  • Cross Platform (Linux, Windows, and Web browsers)

Missing Features:

  • Documentation
  • Ease-of-use
  • Unit-testing
  • all the boring stuff
  • seriously, don't use this game engine, it's a personal project

Magic serializable Components

Usually you would define a component as a C-style struct like this:

struct MyComponent {
    int a;
    float x = -30;
    std::list<std::string> myHobbies = {"writing shit code", "sleeping"};
};

But using C-structs there's no easy way to...

  • send MyComponent over the network without breaking pointers
  • serialize MyComponent to json, used for saving and loading
  • read and change MyComponent's values from within a Lua script

So instead we define components in YAML files:

MyComponent:
  - a: int
  - x: [float, -30]
  - myHobbies: std::list<std::string>

Before compilation these Yaml files automagically get converted into C++ structs (thanks to Niek). Alongside these structs, functions are generated to make the serializing and lua magic stuff listed above possible.

Lua Scripting

I hate it when I have to recompile my game every time I change a variable or a little bit of game logic. It slows down development a lot*.

So with this game engine you can create and update your entity's components inside a (live-reloadable) Lua script!

Example of an entity-template written in Lua:

-- On game restart: recreate this entity with the same template, at the original spawn position
persistenceMode(TEMPLATE | SPAWN_POS | REVIVE) 

function create(enemy)
    setComponents(enemy, {
        Position {
            x = 3, y = 50
        },
        Physics(),
        Health {
            maxHealth = 4
        },
        AsepriteView {
            sprite = "sprites/enemy"
        }
    })

    onEntityEvent(enemy, "Attacked", function(attack)

        local health = component.Health.getFor(enemy)

        print("OUCH!", attack.points, health.currHealth, "/", health.maxHealth)
    end)
    
    setUpdateFunction(enemy, .1, function(deltaTime)
        -- do stuff every 0.1 second
    end)
end

* You know what slows down development even more? Writing your own Game Engine in C++ with a scripting API that should speed up development.

Entity Inspector

Inspect your components as if it were a JSON tree:

Profiler

void updateLevel()
{
    gu::profiler::Zone zone("level update");
    
    doStuff();
}

void loop()
{
    {
        gu::profiler::Zone zone("logic");
    
        updateLevel();
    }
    {
        gu::profiler::Zone zone("render");
    
        // render stuff...
    }
}

dibidabidab's Projects

dibidab-engine icon dibidab-engine

Game engine with Scripting, Multiplayer, Saving/loading, and more.

gu icon gu

C++ OpenGL game library for Desktop & Web

lua-serde icon lua-serde

Serialization and deserialization code generation for the sol3 lua bindings

sol2 icon sol2

Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:

zlib icon zlib

A massively spiffy yet delicately unobtrusive compression library.

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.