GithubHelp home page GithubHelp logo

steren / hl-engine-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from btarg/xash3d-emscripten

10.0 3.0 3.0 893.38 MB

Half-Life Engine in the browser, based on JS port of FWGS/xash3d-fwgs

Home Page: https://hl-engine-js.steren.fr

JavaScript 77.02% HTML 22.98%
half-life xash3d

hl-engine-js's Introduction

Half-Life Engine JS

A JavaScript module to play Half Life maps in the browser.

Half-Life Engien JS logo

It is based on Xash3D a game engine aiming to provide compatibility with Half-Life Engine.

It is currently based on an old JavaScript port (Xash3D-Emscripten). The intent is to rebase it on a newer WebAssembly build of Xash3D.

Using the library

  • Load BrowserFS: <script type='text/javascript' src='browserfs.min.js'></script>
  • Create a JS module: <script type="module" src='index.js'></script>
  • In this index.js file:
    • load this module: import {init, start, fullscreen} from './lib/hl-engine.js';
    • Initialize the engine:
      init({
        canvas: document.getElementById('canvas'), // an existing <canvas> element where the game will be rendered
        location: 'lib', // URL path to the library and other files of this repo
        setStatus: (text) => { console.log(text); }, // Optional, a function to display status messages
      });
    • Start the game:
      You must pass either one .zip file containing the game files (a valve folder and optionally other mod folder). Or you must pass two .zip files, one with the content of the valve folder and with the content of the mod folder.
      start({
        // Game files as an ArrayBuffer of the zip file. 
        // Must contain a valve folder
        // See index.js for example of how to load from an <input> element
        zip: 
        // Alternatively, pass two zips: one including the inside of valve folder and one with the inside of the mod folder
        zipValve: // ArrayBuffer of a zip file of the inside of the valve folder.
        zipMod: // ArrayBuffer of a zip file of the inside of the valve folder.
        // Optional parameters
        mod: "", // the mod to load, for example "cstrike", if zipMod is passed, must match the mod name
        map: "", // optional the map to load, for example "de_dust2"
        args: ['-width', '1920', '-height', '1080'] // optional array of strings as launch paramters
      });
    • Go fullscreen
      fullscreen();

hl-engine-js's People

Contributors

btarg avatar steren avatar x8bitrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.