mousebelt / BrowserQuest

A HTML5/JavaScript multiplayer game experiment
http://browserquest.mozilla.org/
Other
2 stars 0 forks source link

Game Crashes when attempting to access Tunnels #14

Closed Eskew closed 5 years ago

Eskew commented 5 years ago

When 2 players are present in the same game, the BrowserQuest game crashes when attempting to access the tunnels.

Steps followed to produce bug:

Login 2 players to the stardust game Run to the desert area Try to access the tunnel between the three giants Game freezes for my player but shows my player as in-game still to player 2

screen shot 2019-01-14 at 4 36 24 pm
gedanziger commented 5 years ago

@Eskew can you open the inspect and paste any console log errors?

Eskew commented 5 years ago
screen shot 2019-01-14 at 4 53 21 pm
gedanziger commented 5 years ago

On entering the cave, I can reproduce the same error as @Eskew :

Uncaught TypeError: Cannot read property 'getComponent' of null
    at bundle.js:7094
    at bundle.js:982
    at Object._.each._.forEach (bundle.js:26703)
    at Attackable.forEachAttacker (bundle.js:981)
    at AttackSystem.cleanAttackers (bundle.js:7091)
    at AttackSystem.onNotify (bundle.js:7128)
    at bundle.js:3161
    at WorldSystem.forEach (bundle.js:12489)
    at BroadcastEvent (bundle.js:3160)
    at MapSystem.onNotify (bundle.js:10697)

Afterwards, the screen freezes (pictured below): screen shot 2019-01-14 at 4 53 10 pm


Investigating farther into the source where this function is called, it is here:

, {
        key: "cleanAttackers",
        value: function cleanAttackers(origin) {
            var attackable = origin.getComponent(_Components.Attackable);
            attackable.forEachAttacker(function (attacker) {
                var entity = _EntityManager2.default.getEntityWithID(attacker); // Serious Error - TypeError : Entity is null
                if (!entity) {
                    entity.getComponent(_Components.Attack).removeTarget();
                    (0, _ecs.BroadcastEvent)(_GameEvents.GameEvents.Attack_RemoveTarget.params(entity, origin));
                    var _attackable = entity.getComponent(_Components.Attackable);
                    if (_attackable.isAttackedBy(origin.id)) _attackable.removeAttacker(origin.id);
                }
            });

Particularly, the line: entity.getComponent(_Components.Attack).removeTarget(); gives the null pointer @sunrisepopov @oleg-baturov .

0xweb3builder commented 5 years ago

Verified by e179a4246b391ba24ab686d4e0271309c9d73009