Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

m0ksem/Bronze-Engine

Repository files navigation

Bronze-Engine

Simple game engine based on WebGL with JavaScript.

Examples

  • 🏗 Dev polygon - polygon for testing new features.
  • 🎯 Aim training - simple game shooter game.
  • 👻 Horror - the horror game, showing the possibilities of light in the engine.
  • 🧐 Strategy - the game demo, showing the possibilities of camera and different shaders.
  • 🚘 Nightcall - the game demo, showing the mtl support and work with many objects of the same type.

Plans

Roadmap

  • Create easy object loading.
  • Create SceneBundler
  • Create Editor for SceneBundler. Scene can be easy created and deployed in site.

Using (vanillaJS)

  1. Setup
    Download last realese and use it
<script src="Bronze.min.js"></script>
  1. Define engine
// Creating instance of engine
var engine = new Bronze.Engine(canvas)
// Creating camera for engine
var camera = new Bronze.Camera(engine)
// You can also define controls object for control camera or objects.
var controls = new Bronze.Controls(engine)
  1. Map building
// Create all texture files
var texture = new Bronze.Texture(engine)  
    texture.setColor(159, 136, 105, 255)  // If engine draws before all resources loaded color will be shown
    texture.loadFrom("path/to/texture.png")
// Creating instance of some object
var object = new Bronze.Object(Engine)
    object.loadFromObj("path/to/object.obj")
    object.setTexture(texture)
// We can transform him
    object.setPosition(0, 200, 500)
    object.setRotation(0, 90, 45)
    object.scale(2, 3, 2)
// Also we can set animation function
    object.animate(60, (obj) => {
        obj.rotate(+1, 0, 0)
        if (!(obj.position.y == 100)) {
          obj.move(0, -10, 0)
        }
    })

Development

# Install dependencies
yarn install

# Serve with hot reload at localhost:8080 
yarn dev 

# Production build with minification 
yarn run build

# Create docs
yarn run build:docs

Author

© Nedoshev Maksym