npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@goodboydigital/odie

v12.3.2

Published

Goodboys Awesome Entity Component based HTML5 game engine

Downloads

131

Readme

README

This README would normally document whatever steps are necessary to get your application up and running.

ODIE concepts

Odie is a game engine that mixes the good bits of entity components systems with the flexability of javascript. Fundamentally it relies on a few key building blocks that pretty much anything can be built with.

Entity A game element. As a loose rule it does do much on its own. Components can be added to it that give it functionality. Rather than using inheritance a entity can be composed of many components.

Components A component is should be used to add logic and functionality to you entity. Generally a component should have a fairly focused task. In ODIE every component will have functions called on it automatically as when attached to an entity depending on its life cycle. generally it goes:

init() // called when the Entity is retreived from the pool addedToScene() // called when the entity is aded to the game start() // called the first time an entity is updated in the game update() // called each tick render() // called each render removedFromScene() // whan the entity is removed from the game reset() // when returned to the pool

Game A single game element, this is what manages the entities and game systems. Game logic is contained in systems.

System Systems are great for managing many entities or broader parts of your game. They have the same structure as components. Music systems, Collision System etc

Here is some example entitie:

class Player extends Entity
{
    constructor()
    {
        super(data)

        this.add(Movement) // add a movment component
        .add(Contoller) // add a controller component
        .add(Health) // add a health component
        .add(View) // add a view component
    }
}

class Enemy extends Entity
{
    constructor()
    {
        super(data)

        this.add(Movement) // add a movment component
        .add(AI) // add a AI component
        .add(Health) // add a health component
        .add(View) // add a view component
    }
}

example components


class Health extends Component
{
    constructor(entity, data)
    {
        super(entity, data);
        this.life = data.life || 100;

        entity.registerSignals('onDead');
    }

    hit()
    {
        this.life--;
        if(this.life < 0)
        {
            this.entity.signals.emit('onDead');
        }
    }
}

class Movment extends Component
{
    constructor(entity, data)
    {
        super(entity, data);
        this.xSpeed = 0;
        this.ySpeed = 0;
    }

    update()
    {
        this.entity.position.x += this.xSpeed;
        this.entity.positionx += this.ySpeed;
    }
}

System example:


class CollisonSystem extends System
{
    constructor(entity, data)
    {
        super(entity, data);

        this.entities = [];

        entity.registerSignals('onCollide');
    }

    entityAddedToScene(entity)
    {
        this.entities.push(entity)
    }

    entityRemovedToGame(entity)
    {
        const index = this.entities.indexOf(entity);

        this.entities.splice(index, 1);
    }

    update()
    {
        hittest(this.entities);
    }
}

To use them and add them to a game:


const game = new Game();
game.addSystem(CollisonSystem);

const player = new Player();
const enemy = new Enemy();

game.addChild(player);
game.addChild(enemy);

What is this repository for?

How do I get set up?

  • Summary of set up
  • Configuration
  • Dependencies
  • Database configuration
  • How to run tests
  • Deployment instructions

Contribution guidelines

  • Writing tests
  • Code review
  • Other guidelines

Who do I talk to?

  • Repo owner or admin
  • Other community or team contact