vincent / three-arena

A framework to create 3D hack and slash games
23 stars 7 forks source link

Three Arena

http://three-arena.com/examples/#simplest.js

Three Arena is an opiniated WebGL game framework to create 3D terrain-based games in an HTML context. It uses three.js 3D engine, machinejs behaviour trees, recastnavigation pathfinding system, knockoutjs dom binding system and other open source projects.

Features

Not ready (yet)

Examples

Some examples here three-arena.com/examples

Or run npm install && npm start from the project root.

  new Arena({
    container: 'game-container', // the container DOM ID

    cameraHeight: 80,

    fog: { near: 20, far: 250 }, // configure fog
  })

  .setTerrain('/gamedata/maps/simplest.obj', { // use this .OBJ as terrain

    map: '/path/to/terrain/texture.png' // the terrain texture

    // other material options, like bumpMap, wireframe, etc..
  })

  .addCharacter(function(done){ // add a character

    new Arena.Characters.Ogro({

      name: 'Shrek', // the character name

      image: '/gamedata/unknown.png', // its portrait

      tomb: '/gamedata/models/rts_elements.dae', // use this model when it dies

      life: 100, // start with 100 life points

      onLoad: function(){

        this.learnSpell(Arena.Spells.FireBullet); // learn a spell

        done(this); // on scene !
      }
    });

  });

Show me the code

Hack the pathfinding system

The pathfinding is done via an javascript Emscripten-compiled interface above the c++ library recastnavigation. To add methods in this module, you need to code their javascript interface and rebuild the javascript module with

npm run recast

Or build a separated build with

cd recastnavigation/emscripten
./build.sh ../../lib/pathfinding/recast.js