Dev Example 13_7

Post your help queries and engine programming questions here

Dev Example 13_7

Postby Killersan » Sat Jul 26, 2014 1:50 pm

Hello guys,

I'm kind a new here, so I just want to say hello at start as this is my first post. Me and my friend are trying to make a full mmorpg game based on IGE. I have to say that Rob is doing great job with this engine so huge thanks for Your effort Rob and right now I'll get to the point :)

In the Dev branch I have a problem with example 13_7 which is not working at all. I have en error while I'm trying to start the server:

Code: Select all
...\13.7-server-load-tiled\gameClasses\CharacterAi.js:72
           .path.add(path)
                 ^
TypeError: Cannot call method 'add' of undefined
    at IgeClass.Character.extend.newPath (C:\Users\marcin\Documents\GitHub\13.7-server-load-tiled\gameClasses\CharacterAi.js:72:16)
    at IgeClass.Character.extend.tick (C:\Users\marcin\Documents\GitHub\13.7-server-load-tiled\gameClasses\CharacterAi.js:83:9)
    at IgeClass.IgeEventingClass.extend.tick (C:\Users\marcin\Documents\GitHub\ige_dev\engine\core\IgeObject.js:1596:22)
    at IgeClass.IgeObject.extend.tick (C:\Users\marcin\Documents\GitHub\ige_dev\engine\core\IgeEntity.js:1683:30)
    at IgeClass.IgeEventingClass.extend.tick (C:\Users\marcin\Documents\GitHub\ige_dev\engine\core\IgeObject.js:1596:22)
    at IgeClass.IgeObject.extend.tick (C:\Users\marcin\Documents\GitHub\ige_dev\engine\core\IgeEntity.js:1683:30)
    at IgeClass.IgeEntity.extend.tick (C:\Users\marcin\Documents\GitHub\ige_dev\engine\core\IgeScene2d.js:136:29)
    at IgeClass.IgeEntity.extend.tick (C:\Users\marcin\Documents\GitHub\ige_dev\engine\core\IgeViewport.js:204:17)
    at IgeClass.IgeEntity.extend.renderSceneGraph (C:\Users\marcin\Documents\GitHub\ige_dev\engine\core\IgeEngine.js:1879:20)
    at IgeEntity.extend.engineStep (C:\Users\marcin\Documents\GitHub\ige_dev\engine\core\IgeEngine.js:1758:12)

Process finished with exit code 8
User avatar
Killersan
 
Posts: 24
Joined: Sat Jun 21, 2014 1:45 pm

Re: Dev Example 13_7

Postby Smoozilla » Mon Aug 04, 2014 4:40 pm

Hey! Welcome :-)

Have you looked at dev branch example 9.6? This contains the new pathfinding.

It goes something like this:

add this to the entity you're trying to make path.
Code: Select all
this.path.finder(ige.server.pathFinder)
  //add the map used for collision checking. ( I used an IgeTileMap2d)
  .tileMap(ige.server.collisionMap)
  .tileChecker(function (tileData, tileX, tileY, node, prevNodeX, prevNodeY, dynamic) {
  // If the map tile data is set to 1, don't allow a path along it
   if (typeof tileData === 'string') {
     return tileData === this._id;
     }
    return tileData !== 1;
    })
  .lookAheadSteps(3)
  .dynamic(true)
  .allowSquare(true) // Allow north, south, east and west movement
  .allowDiagonal(true); // Allow north-east, north-west, south-east, south-west movement


and to get the entity to path, call something like this.
Code: Select all
Entity.path.set(startTile.x, startTile.y, 0, destTile.x, destTile.y, 0);
Entity.path.speed(2);
Entity.path.start();



I personally had to look up path.set() parameters and here they are:

/**
* Clears any existing path points and sets the path the entity will traverse
* from start to finish.
* @param {Number} fromX The x tile to path from.
* @param {Number} fromY The y tile to path from.
* @param {Number} fromZ The z tile to path from.
* @param {Number} toX The x tile to path to.
* @param {Number} toY The y tile to path to.
* @param {Number} toZ The z tile to path to.
* @param {Boolean=} findNearest If the destination is unreachable, when set to
* true this option will allow the pathfinder to return the closest path to the
* destination tile.
* @returns {*}
*/
set: function (fromX, fromY, fromZ, toX, toY, toZ, findNearest) {

I know it's been a bit since you've asked but hopefully this will help :-)

-Kade
User avatar
Smoozilla
 
Posts: 10
Joined: Wed Jul 30, 2014 6:37 am

Re: Dev Example 13_7

Postby robaldred » Tue Aug 05, 2014 11:03 am

Hey welcome,
Sorry the example 13.7 hasn't been updated.
As Smoozilla said, it needs to be updated to work with the new pathing system.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: Dev Example 13_7

Postby Killersan » Thu Aug 21, 2014 5:24 pm

We made a decision not to migrate to dev right now, we will make our project on master branch and after that we will refactor the code to implement newest functionalities up and running.

Till then I'll follow changes in dev.
Thx for help.
User avatar
Killersan
 
Posts: 24
Joined: Sat Jun 21, 2014 1:45 pm


Return to Help & Questions

Who is online

Users browsing this forum: No registered users and 1 guest
cron