Giter Site home page Giter Site logo

megamanjs's Introduction

megamanjs

Build Status codecov.io

Project that aims at creating a game engine in JavaScript using Megaman 2 on NES as guide. WebGL is used as renderer and despite Megaman 2 being a 2D game it is run in 3D space using THREE.js as 3D lib.

Deployed at http://megaman.pomle.com/

This project have generated the SnakeSilk Game Engine and the following libraries:

Follow the project blog at https://medium.com/recreating-megaman-2-using-js-webgl

Running

  • Clone repo.

      git clone https://github.com/pomle/megamanjs.git
      cd megamanjs
    
  • Install dependencies

      yarn install
    
  • Start; should open game in a browser.

      yarn start
    

Developing

Prerequisites

  • Make sure you are running Node.js >= 7. Installation instructions for your platform can be found at https://nodejs.org/en/download/package-manager/.

      node --version
    
  • Install dev dependencies.

      cd megamanjs
      yarn install
    
  • Run test suite.

      yarn test
    

    The test suite begins with running a Mocha unit test in Node. After that a Chrome window should open and run a browser test.

Contributing

Contributions are welcome.

megamanjs's People

Contributors

pomle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

megamanjs's Issues

Fix Human Input reading

Instead of binding things directly to the event, a state should be updated instead and then read on every simulation update. This should make it easier to control human input and get rid of some bugs like being able to control characters that are dead and immobilized.

Copying velocity from objects have side effects while timestopper active

Since we copy the velocity from an object we are standing on, we will get the objects internal velocity and not the objects apparent velocity.

This is a problem when standing on a moving platform while it uses a different time stretch than our own.

Potential fix is that time stretch is applied on the velocity when it is calculated and not when it is applied to the position of an object.

Refactor texture handling

  • Don't load textures in constructor.
  • Singleton texture or resource loader class.
  • Decouple TextureManager and Texture utils perhaps.

Too difficult to land on platforms when vertical speed high

When the fall speed is high, the margin for when a characters lands on a platform is too low.

How to reproduce:

  1. Set up two solids with a gap of 32 units, this will be the jump that you need to bridge.
  2. Above the landing platform, put a solid 32 units exactly above the landing area.
  3. Megaman will not be able to land after the gap.

screen shot 2015-07-22 at 09 07 26

Level XML for testing below.

<?xml version="1.0" encoding="UTF-8"?>
<level>
    <camera smoothing="0" />
    <gravity x="0" y="983" />

    <layout>
        <solids expose="true">
            <rect x="-16" y="32" w="64" h="16"/>
            <rect x="96" y="32" w="64" h="16"/>
            <rect x="96" y="-32" w="16" h="32"/>
        </solids>
    </layout>
</level>

Refactor sprite animation system

Instead of referencing this string when creating a frame

var fromFlame = this.sprites.addSprite('fromFlame');
fromFlame.addFrame(0, 144, .03);
fromFlame.addFrame(48, 144, .03);
fromFlame.addFrame(96, 144);

we could simply expect the returned object back when setting.

Megaman costume color texture maker poorly optimized

Color replacement is done on the upscaled version. We could do it on the original sprite size instead.
The color replacement is pretty fast, but would be magnitudes faster if we ran it on the smaller.

For Megmans sprite sheet we are looking at 256x4x256x4 pixels instead of 256x256. 1 048 576 vs. 65 536.

Honor jump force

Since gravity was integrated into the physics trait, it is now applied after jump inertia has been applied, which makes the jump force exactly one gravity unit smaller than before.

The previous model overrode the gravity force, effectively ignoring it by setting inertia to current inertia + force.

Proposed solutions:

  • Add ~16.5 units of "missing" force.
  • Gravity trait that is applied before jump.
  • Separate gravity as a special force that can be ignored.

Refactor Engine events.

After simulate and render events are called and this could use a nicer setup using Engine.Events for example.

Pixel perfect port?

Hi, are you still working actively on this project?

Are you looking to make a pixel perfect port? If so, maybe you could use a JavaScript emulator running the original game in the tests. The idea is to compare a few frames from this game and the emulator and make sure you get the same result from a similar set of commands (like jump, shoot, run...). This could be used to test the levels and enemies behaviour too.

Add support for object traits

Objects should be able to have traits. Traits would be functions of a type that is run with collision, timeShift etc.

This should make it much easier to combine behaviors in different objects and prevent excess inheritance.

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.