Git Product home page Git Product logo

ige's Introduction

Isogenic Game Engine

HTML5 2D and isometric scenegraph-based game engine written entirely in TypeScript / JavaScript.

Main Features

  • Full un-obfuscated source code
  • Advanced networking system with built-in server
  • Particle system
  • Scenegraph-based
  • Tile maps
  • Box2D physics component for easy integration with 2d and isometric games
  • Multiple viewport support
  • Tweening support
  • Cell-based animation support
  • Native and font-sheet text support
  • WebGPU support is incoming, currently all the above renders using canvas 2d context

Latest Updates & Changelog

Version 3.0.2

Module Based Import

From version 3.0.1 the engine expects to be installed into a project and used as a module via npm:

npm i @irrelon/ige

You should use the engine via an import statement:

import { ige } from "@irrelon/ige";

Streaming Transform Data

The stream code has been updated so any transform data (translate, rotate and scale) sent to the client/s by the server are no longer directly assigned via this._translate.x = streamData.x and instead are passed to the transform method related to the data e.g. this.translateTo(streamData.x, streamData.y, streamData.z);

The same goes for rotateTo() and scaleTo(). This is so that code is written that overrides those base class methods will get called correctly when the streamed entity is transformed. Previously there was no way to detect that a transform had changed by streaming data.

IGE Initialisation

The optional modules you can call uses() for are currently: network, audio, box2d, tweening and ui

The engine expects you to specify some of the previously auto-included modules that are now optional, then wait for them to load. For instance, if your app is using networking you should tell the engine about that up front via

ige.uses("network");

You should call this for each module you wish to use before calling ige.init();.

After you've specified all the modules via uses() calls, you need to call init() and then wait for the isReady signal before proceeding further:

ige.uses("network");
ige.uses("ui");

// Now tell the engine we are OK to proceed, having declared what we want to use
ige.init();

// Now wait for the engine
ige.isReady().then(() => {
	// Proceed with the rest of your code
});

Version 3.0.0

The original engine was written over 12 years ago, and it is a testament to that work that it is still by far the most feature-rich browser-based game engine available today. There is still NO OTHER engine that supports realtime multiplayer streaming out of the box written purely in JavaScript in a 2d and isometric rendering engine.

With all that said, it's 2024 and back in 2011, ES classes, ES modules, TypeScript, webpack etc did not exist. As such, language functionality such as classes were custom-created to facilitate an inheritance-style codebase. This was great, as was the magic of using ES classes years before they even existed, but now we have native functionality in JavaScript, a rewrite of the engine needs to happen to make use of that new functionality.

Minor changes exist as well as some breaking changes (such as the removal of ClientConfig and ServerConfig files) that were ultimately made to increase functionality or update anachronistic coding patterns to more modern expectations.

The major changes are:

The built-in compiler is no longer required since import now exists in browsers natively, so it is no longer a requirement to compile using the engine's compiler to get a runnable project / game. You should code with ES modules import and export, not CommonJS require and module.exports (although CommonJS is still currently supported).

The node.js server-side executable system that ran IGE on your server for multiplayer support has been removed as the isomorphic JavaScript output runs natively in Node.js - again due to the support for ES modules, ES classes and there is no need to "package" projects / games anymore! :)

The ClientConfig.js and ServerConfig.js are no longer required and can be removed everywhere. The engine simply uses ES module imports and exports now, directly in the files that need them.

Many of the examples in the examples folder have been converted to TypeScript and ES modules although this work is still ongoing. You can tell which ones can be run because there will be an index.ts rather than only an index.js file. Examples might be in a broken state for a while but focus has been on the core functionality of the engine and bringing it up to modern standards of code rather than updating example code for the moment.

Developing / Building / Modifying the Engine

This is only required if you intend to make changes to the core engine. If you only want to use the engine in a project, you do not need to clone the repo from GitHub since you can use the engine via npm i @irrelon/ige and then import it normally.

After downloading or cloning this repository, please change to the folder you cloned the repository to and then run:

npm i

You must have Node.js installed for the installation to work. This version of the engine has been tested against Node.js 16.13.1 and higher.

Compiling the Engine from Source

Run the build npm command will compile the TypeScript to JavaScript files. The build command also runs npx @irrelon/fix-paths to automatically resolve TypeScript paths e.g. @/engine/something in .js files to their relative equivalents like ../engine/something.

npm run build

The resulting build will be available in the dist folder. The docs folder will also update during the build to output JSDoc compatible documentation.

Examples

There are a lot of examples in the ./examples folder. Please see the ./examples/readme.md file for more information about running the examples.

Documentation

https://www.isogenicengine.com/docs-manual.html

Feedback & Support

If you have any comments, questions, requests etc. you can post on the GitHub issue tracker.

Gotcha Hints

Create IGE App Helper

A create-ige-app npx script is on the way as well, almost ready! This will create a basic app with the webpack and Node.js setup to create games with this version of the engine without configuring all the things yourself. This will also support templates, so we can get started on something faster.

UI Entities

When working with the provided UI classes (IgeUiEntity and IgeUiElement) it's important to understand the differences. IgeUiElement instances stop pointer even propagation by default. This means if you mount one IgeUiElement inside another one, only the parent will get pointer events like pointerDown and pointerUp.

IgeUiEntity instances have the same general capabilities but are considered graphical rather than interactive so don't hook or interfere with pointer events by default.

License

MIT

Intellectual Property, Ownership & Copyright

(C)opyright 2023 Irrelon Software Limited https://www.irrelon.com

ige's People

Contributors

beyond-code-github avatar chriset avatar doidel avatar emorling avatar foolmoron avatar georgebutter avatar goldfire avatar irrelon avatar kaw2k avatar lsimkins avatar pitieu avatar raldred avatar sandstedt avatar thiele91 avatar thurtt avatar volkans80 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  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

ige's Issues

Optimized Terrain Render

I have a bottom layer where the terrain/floor/ground gets rendered. How do I ensure that this TextureMap only gets rendered once, or upon request?

Tests Folder to be Renamed to "examples"

This change is currently in the dev branch and will make it through to the master soon. There are various reasons for doing this but the most obvious is that for new users, an examples folder is where they will look first, not a tests folder... and I think they are becoming more about being examples than tests now anyway.

Let me know if you have any compelling reasons this will mess with your life. :)

Box2d <-> Isogenic Engine position conversion

The basic structure of the isogenic engine scenegraph is pixels, correct? Insofar as at a default zoom level, a positional value of x=10 means 10 pixels right from the beginning of the canvas, correct?

I noticed that there is a 30 Pixel To Meters ratio set for the box2d world out of the box, so I suppose this means game creators should either modify the pixel to meter conversion to their liking and/or make sure their artwork follows a 30 PTM ratio, correct?

This must mean that the game designer also needs to take a look at the PTM ratio when they are setting up the collision boxes for their game objects..

Some musings regarding the network streaming component

I just noticed that as it stands you need to mirror your scene graph on the client and the server if you want the stream to work properly...

I think that we need to have some way to specify the target scene of an entity coming in from the server to the client.. Perhaps the auto mode should work as it is now where you need to mirror the names of the client/server side scene graphs.. but have an advanced option where we can choose the target scene object we want to push the streaming entity too..

Finally, and importantly, is there a way to reverse the stream flow and have a separate stream running from the client to the server? I couldn't find anything about going the other direction in the documentation.

Thoughts?

Behaviors don't seem to fire server-side without rendering ticks

Not sure if this is just me setting up my behaviors incorrectly, but I can't seem to get behaviors to fire on server-side characters. No errors, but nothing fires.

My test code on the server side:

var LogBehaviour = function () {
console.log("COOL!");
};

var tempCharacter = new Character()
.addBehaviour('logit', LogBehaviour);

(Character() is an object extended from IgeEntityBox2d)

No errors, but I get no console.log output. Bug or just incorrect usage?

IgeTextureMap Render Caching

In order to cache render data the texture map will have to know its dimensions in advance. This is different from the current IgeTextureMaps because current ones have unlimited space on which to paint tiles.

In order to cache rendered tile image data we need to create a new cache canvas and paint to that, then paint the cache canvas to the main canvas each tick.

This means that instead of looping all the tiles on the map and painting each one individually we just paint one larger pre-rendered cache canvas but we will need to define the size of this canvas before hand and limit it to a sensible size.

Feedback on how this should work and the scenarios that it might be used in would be helpful.

This system works best in the outlined form when the texture map is used to create a static image from many different tiles which never change or change infrequently, and when the camera moves, the texture map does not change either. A good example of this is the background "room" image in the 13.3 test.

It will not work well for massive maps with tons of tiles and huge cache canvases.

Thoughts?

ReferenceError: IgeObject is not defined

Now that the box2d component uses an IgeObject for the debug painter, the node server won't start. The reason for this is clearly that IgeObject hasn't been required in ige.js when IgeBox2dComponent is, so the error is given. Moving IgeObject's require above box2d fixes this, but I'm not sure how you want to organize that.

Client-side physics sim screws up streaming

If a client-side physics sim is started up, it completely wrecks the streaming. I believe this is because entities are streamed in as-is (just their current translation data) and nothing is sent into the client-side box2d. Thus, the box2d physics thinks this new entity is always at 0,0 (because no box2d translation data is performed).

Rob, I know that you are trying to basically have the client simply be a receiver for all data (and do little-no processing by itself), but for more intensive games, we might want to offload some of the physics processing work to the client... What we really need is an option on the stream component to tell it to directly modify the box2d body positional data (somehow incorporate the currently included interpolation data).

If we don't have an option to write stream positional changes to the client's box2d body instead of it's entity transform, then we will need to set up custom data on the stream and then manually modify the box2dBody position ourselves, correct?

What do you think?

Server for MMO

Is it recommended to use the IGE server for an MMO? I have earlier used my own hand-crafted java server, FUSE (habbo hotel server), DarkStar (Sun) and also SmartFoxServer at another point. Any input?

Offset a texture

What is the proper way to offset a texture in the render function? My anchor point in the texture is not centered. My texture is 48x48, but the texture anchor is at 24,30 instead of 24,24.

Path-finding events

There should be events fired when the direction along a path changes and at the end of a path. This way things like animations can be updated depending on the state along the path.

Reverse Occupied?

Hm. After working a bit on this primitive editor:
http://imagebin.org/228013

I came to the conclusion that it would probably be better if all tiles were occupied per default, instead of the other way around. In a map like in the image above, it makes sense that all the black, untouched, tiles are blocked.

I guess I should extend the IgeMapStack2d class to tamper with the collision function. Any thoughts?

Scrollable UI areas

Be able to make a UI element scrollable with custom scroll bars. Similar to how you would do it in the DOM, if you have 500px of vertical content, but only 250px of UI area, be able to scroll that area to see all of the content.

Path-finding test 9.5 path error

When using the 9.5 path-finding test, occasionally the player will move along a path that shouldn't be allowed because the middle tile of the square is supposed to be impassable. Debug and fix ! :)

Announce: Engine is Now Enforcing Strict Class ID Naming

Hi all,

When you define a new class you MUST provide a classId property as such:

var someClass = IgeClass.extend({
    classId: 'someClass',
});

The classId MUST also be the same as the variable you store the class definition in. If you change var someClass = .. to var newClassName = ... you must also change classId: 'newClassName'.

There are some really good reasons why this is the case including sceneGraph clarity, functional compatibility with the editor etc, but the most important is that the network stream needs to be able to instantiate a new entity based on its classId.

The class system will also check that the classId being assigned is unique and will throw and error if not.

Thanks.

Viewport Render Optimization?

Without really knowing the specifics, an optimized render routine would be:

  1. Loop through all entities to see which require an update, and what their bounding boxes are
  2. Calculate the TOTAL bounding box of the area including all the entities requiring rendering
  3. Only render to this bounding box
  4. If the bounding box is (0,0,0,0) then do not render at all

Smart Textures

Does anyone have a working example of smart textures in 1.1?

Potential bug: #<IgeClass> has no method 'box2dBody'

I'm attempting to convert my entity into a box2dBody via:

Pastbin code : http://pastebin.com/1Z1xuiQ6

However, I get the error "Uncaught TypeError: Object # has no method 'box2dBody' " when the client gets to that line.

The example I am basing this off of works, and I have fitted my code to almost exactly mirror it (the character creation code at least). Besides having the IgeBox2dComponent started (it's working correctly) is there something else I need to do before the .box2dBody method works?

Small error with newest trunk version

Get an error in IgeEntity with the latest version:

Game Server App/node_modules/engine/core/IgeEntity.js:7
{extension: IgeStreamExtension, overwrite: false}
^
ReferenceError: IgeStreamExtension is not defined

Seems the code isn't defining things in the proper order/something is missing?

Server-side entity transform data streaming and client-side data interpolation

Server-Side

Add component for data streaming to allow clients to receive updates from the server about changes to an entity's transform data just as 1.0.0 already does but with more control over which clients receive the updates.

System should have two modes:

  • Auto-mode: Use a callback model that will ask a method to return true or false for each client as to whether the update should be sent to them or not. If no callback is defined, send to all clients each tick whenever new data is available.
  • Advanced-mode: Allow the programmer to control when and how data is synced with which clients. Provide a method in the IgeEntity class called streamSync() that will take a client id (or array of ids) as a parameter and send the transform update to those clients.
  • Transform data should be generated only once each tick on request (not automatically, only if required to conserve CPU) and subsequent requests for the data in the same tick should return the cache. Similarly, if no transform data has changed between ticks, cached data should be returned.
  • Write a component that allows a "visibility radius". The radius will determine when that entity should be sent from the server to the client (and also when any transform updates should be streamed). If the client's player entity moves inside the radius, the entity data is then streamed to the client. When the player entity moves outside of the radius the entity streaming stops for that client and the entity is destroyed client-side. This allows mechanics like hidden objects to be created that only become available in client-side memory (so it cannot be examined to determine location) once the player is in "range" of the entity.

Client-Side

On the client-side, once transform update stream data has been received it needs to be applied via interpolation. The system in 1.0.0 is already perfect for porting to 1.1.0. Some updates would make this a much more advanced system:

When data for an entity is first received by a client it needs to know:

  • The classId of the entity (what class the entity is created with)
  • The ID of the entity
  • The transform data

Everything else should be static or at least, is not part of the data stream. This system therefore relies on the programmer having correctly set up their classes for use in a client/server fashion. Take this example:

  • We create a new class that extends IgeEntity called "MyPlayer"
  • MyPlayer can be instantiated on both client and server
  • In the MyPlayer init() method the programmer determines what properties and default values are set. This can be conditional based on if the class is being instantiated on client or server using the ige.isServer boolean flag
  • Things like a texture only need to be applied on the client-side since the server will not deal with rendering
  • The idea is that when the client receives a message from the server saying "Create this entity with a classId of MyPlayer and assign it this ID", everything the client needs to know in order to set that entity up correctly should already be in the client init() or other extended methods. The server should not have to send ANYTHING to the client beyond the classId (MyPlayer), ID to assign this new entity and it's transform data (this does not include dimensions... they should also be set during class init())

When the client receives a data stream for an entity that does not yet exist, it can simply do this:

var newEntity = new classId().id(newEntityId);

The classId will actually be a string so we will look up our ACTUAL class object from the global class store, something like:

var newEntity = new ige.classStore(classId)().id(newEntityId);

Comments, questions and ideas related to this post are welcome.

What is the point of occupyTile on an entity if it can't be used with path-finding?

Here is what I've done:

  • Created tilemap
  • Mounted static entities to it
  • Used occupyTile to occupy the tiles on the tilemap
  • Use path-finding on the character for movement

The problem is that the path-finding doesn't use the occupied tiles data from the tilemap to calculate the paths, so players still walk through buildings. From the example, it looks like you have to have a collision map layer as well, and then specify the occupied tiles separately. Why can't the data be used from the tilemap for this?

IgeTextureMap Gets Render Areas Update and Entity Tracking, IgeTiledComponent Update, Box2D Static Bodies From Map Data, Box2D Debug Drawing Gets Update, IgeEntity 3d Bounds Update

Hi all,

The IgeTextureMap class now has entity tracking to allow the render area of the map to be automatically set based on the position of the passed entity.

The Tiled map editor (www.mapeditor.org) map data loader IgeTiledComponent now provides a callback system to allow you to decide what to do with the resulting IgeTextureMap instances it creates.

The IgeBox2dComponent can now extrapolate static bodies directly from map data in any instance that extends from IgeTileMap2d. The system determines tiles on the map that constitute rectangular areas and generates Box2D static bodies for them automatically.

The Box2D system can now output both 2d and isometrically positioned debug draw data to allow you to debug your Box2D bodies easily. The new debug draw system uses a debug "painter" entity which gets mounted to the object of your choice in the scenegraph. If it is mounted to an object (such as a tilemap) that is set to isometricMounts(true) then it will output in isometric mode.

Finally, the 3d bounds system has received an update so that overlapping entities can still be depth-sorted with some accuracy. This means you can now create overlapping entities should you choose to do so (and there are times when this happens naturally such as when two players "walk" on the same tile). When 3d bounds overlap, the bounds will be ignored and the entities will be depth-sorted by the calculation of their position x + y + z.

ALL of these updates are available to see in action in the 13.4 example that loads data from a Tiled JSON export, determines which resulting layers to use, reads one of the layers and generates Box2D static bodies for it, creates a bunch of AI NPCs and also shows you how to do box2d debug drawing (commented out in the repo but you can un-comment it easily on line 178 of client.js).

Am I missing something, or are tiles being drawn at twice their set size?

So I was tweaking around with some settings and all of a sudden realized my tiles are twice the size they are supposed to be. In order to better demonstrate this, I've got a texturemap with _tileWidth & _tileHeight set to 64, and a tilemap on top of it with _tileWidth & _tileHeight set to 32.

Tiles too big

What really caused me to notice this is when I started playing around with the Tiled editor and set the tiles to 64x64, and noticed that they looked much smaller than the ones that IGE was drawing.

How to latch "onClientConnect" with NetIo?

Hello guys.

I'm wondering how to set up an event listener for the "onClientConnect" event. I need to handle a login process as well as pushing data to each individual client as they connect.

Also, I noticed there is a method in Net.io to output a list of all currently connected clients. Would you grab that via ige.netIo.clients(); ?

If there is an example that covers this please let me know! :)

Easy collisions without box2d

It would be great if there was an easy way of having very basic ground collisions without using box2d. For example, I'd like to be able to define a collision area on a building and on a player, and the player automatically shouldn't be able to walk through that building. It would be even nicer if this were possible on a pixel-basis rather than just a tile-basis to allow for more fine-tuned control of collision boundaries.

I've currently got this all working with box2d, but I've had to build in a lot of hacks to make it behave how I want, and it seems like a lot of overhead for just this very basic collision detection.

Path-finding: Clicking somewhere that they can't walk paths until they are blocked?

Is this behavior possible? For example, if I've got an entity that is occupying a tile, and I want the player to click on it and walk up to it. Currently, the player will just do nothing. However, it would be nice if they could click on it and it would path them up to the adjacent tile.

Another example would be where a player is on the other side of a wall and click on the side they can't get to. In some cases, I'd like the player to walk up to the wall when they do this, instead of just not moving.

I realize this isn't a behavior that would always be desirable, but I'm seeing use-cases where it would be as an option.

Strange stuff going on with chrome dev browser install

Hey all.

It seems that when a client connects with the new dev version of the chrome browser, this error pops up.

Uncaught SyntaxError: Unexpected token = lib_box2d.js:2340

I don't understand.. why would the box2d lib be giving me an unexpected token when the linux environment isn't? This makes zero sense to me.

That line on lib_box2d.js .... var d13_2 = (-w1e13);

Perhaps the next version of chrome might have some errors that need to be sorted out on the isogenic side in preparation for chrome's next release? Or maybe because it's a dev version we don't really need to care?

Wonkyness in Net.io regarding connection rejection

When I have a client attempt to connect to the server before it is ready to accept connections (called via "acceptConnections"), this error pops up:

network/net.io/IgeNetIoServer.js:232
socket.disconnect();
^
TypeError: Object # has no method 'disconnect'

Stack Trace:
At IgeClass.IgeNetIoServer._onClientConnect (node_modules/engine/components/network/net.io/IgeNetIoServer.js:232:11)

at Class. (/network/net.io/IgeNetIoServer.js:25:65)
at Class.NetIo.EventingClass.NetIo.Class.extend.emit (node_modules/server/node_modules/net.io-server/index.js:386:33)
at WebSocketServer.NetIo.Server.NetIo.EventingClass.extend.start (node_modules/server/node_modules/net.io-server/index.js:583:9)
at WebSocketServer.EventEmitter.emit (events.js:115:20)
at WebSocketServer.handleUpgrade (node_modules/server/node_modules/net.io-server/node_modules/websocket/lib/WebSocketServer.js:179:14)
at Server.EventEmitter.emit (events.js:115:20)
at Socket.socket.ondata (http.js:1710:14)
at TCP.onread (net.js:402:27)

Interpolator, Pathing and Tweening - The same thing?

Basically at the moment we have an interpolation system that has a "queue" of network data that it receives and then interpolates through. Think of it like a timeline with keyframes. When network data about a transform change comes in it is added to the list of keyframes and then when the "play head" of the entity reaches the keyframe it starts to interpolate towards the next keyframe.

The pathing system works in a similar way, each point along the path could be considered a keyframe that we are interpolating towards.

Again, same thing for tweening, we have some value to tween to and the current value so we are interpolating to the tween's keyframe.

These are all currently distinct separate components of the engine but I'm wondering if they should be unified so that everything works through a single interpolator.

For instance, if we keep the network stream the same, then for the pathing just add a bunch of keyframes to the timeline, and same for tweening, just add a keyframe.

Can anyone see a problem with this? Any issues you think might arise? Are there cases where you might want to use tweening, pathing and the stream system all at once? What happens if they are all using the same timeline / queue of keyframe items?

I'm tired/stupid.. :)

I'm stupid, please ignore >_<

**Warning to everyone... when you set up a custom class extending from IgeEntity.. for the love of god, put your class properties in the init function >.<

I am still new to programming and instead of placing properites in the init function I placed them outside via:

testProp1: 11,
testProp2: 22,
etc..

Man was that bad! :/

Network send cannot send multiple data values??

I'm not sure why, but doing a network send from the server -> client as follows:

ige.network.send('clientPreloadReady',{
playerId: tempPUID,
playerLoc: [10,10]
});

and then receiving it via:
ige.network.on('clientPreloadReady', function (data,data2){
console.log(data2);
}

Gives undefined... I also try just function(data) but console.log(data) then just gives the first argument (playerId) and nothing else.

Am I doing something wrong?

Custom bounding boxes

I've got a sort of tycoon aspect in the game I'm working on, where you can select an item from a menu and then place it in the game world. I'd like to be able to have a green bounding box around the entity when it is over tiles that it can be placed on, and a red bounding box over tiles that it can't be placed on.

I guess partly this is a question, is that the best way to do this, and if so, can a feature be added to change the styles of the bounding boxes?

Path-finding: 2nd path fires pointComplete twice on start

I'm using the pointComplete event to update the player animation so they are walking the right direction. I do this by incrementing a variable I attached to the player entity (_pathNum), and using that as the index for the current and next point, and then comparing those points to determine the animation to run. This works great on the first click/path; however, after the first path complets, when the player clicks again, it fires 'pointComplete' twice instantly, incrementing the count higher than it should be, and breaking the animation.

How to cancel specific IGE input event?

I need to temporarily track mouse movements on whole screen, so I create an input event listener:

ige.input.on('mouseMove', function() {
  // ….
});

However, I obviously don't want this running forever. What is the correct way to then remove this?

Smooth out path-finding to be more natural

Is there a way to smooth the path-finding out so that the player can move diagonally instead of being forced to walk out of their way to go to a certain tile?

For example, in the below image, the yellow path would be much preferred over the blue as that is what the player would be expecting to happen when they click there, unless there is something blocking their path in the middle tile.

Path-Finding Example

Relative paths in the command line don't work on Unix/Linux

For example, the following doesn't work on OSX or Linux:

node ige/server/ige.js -g game

It fails with this error:

module.js:340
    throw err;
          ^
Error: Cannot find module 'game/server.js'

The only way to make this work is to use the full path like this:

node ige/server/ige.js -g /full/path/to/folder/game

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.