It is currently Sat May 25, 2013 6:20 pm Advanced search

[BUG] Visualizer goes haywire with too many fleets :(

Code won't compile? Found a bug? Post here!

[BUG] Visualizer goes haywire with too many fleets :(

Postby voidptr » Fri Oct 01, 2010 6:34 pm

Check out this game in the visualizer on benzedrine.cx (the TCP server). Once my little victory fireworks display starts, around turn 106, the Javascript visualizer just goes totally haywire. At least on Firefox, it starts skipping the odd-numbered turns, displaying "NaN" and other wacky numbers for planet populations, and on some frames it doesn't draw any of the fleets even though they're still in flight.

http://72.44.46.68/canvas?game_id=259649#

Is this just a problem with Firefox's Javascript engine, or is it a bug in the Javascript visualizer itself? If it is just a Firefox bug, is there anything that could be done to the visualizer to mitigate it? I'm using Firefox 3.6.10 on Ubuntu 8.04 LTS.

(I think I turned off the victory dance in my most recent official submission, but I definitely plan to put some less-fleet-intensive dance into the final product.)

EDIT: "var data" is 264355 characters long. I'm wondering if it could be a numerical overflow somewhere. Incidentally, on some turns every single planet displays with owner=2 numships=1, and on one turn in particular the circles don't even display as circles; it looks like there are random black blocks overlaying them.
Last edited by voidptr on Fri Oct 01, 2010 8:03 pm, edited 1 time in total.
voidptr
Brigadier-General
 
Posts: 139
Joined: Sun Sep 12, 2010 7:22 pm

Re: Visualizer goes haywire with too many fleets :(

Postby Terr » Fri Oct 01, 2010 7:55 pm

Worked fine up until turn 106 in Opera 10.62, then goes wonky.

Code: Select all
JavaScript - http://72.44.46.68/canvas?game_id=259649

Uncaught exception: TypeError: Cannot convert 'k.source' to object
Error thrown at line 1, column 3344 in <anonymous function: drawFrame>(b) in http://planetwars.zerd.net/visualizer.js:
    k.x=k.source.x+(k.destination.x-k.source.x)*a;
called from line 1, column 8358 in <anonymous function: run>() in http://planetwars.zerd.net/visualizer.js:
    this.drawFrame(this.frame);
called via Function.prototype.apply() from unknown location in <anonymous function: run>() in http://planetwars.zerd.net/visualizer.js:
    /* no source available */


While it may be an outright bug in the visualizer, we should also keep in mind that JS in a browser is orders of magnitude slower than some other languages, and when you add relatively new graphics-drawing code on top of that...
Terr
Brigadier-General
 
Posts: 155
Joined: Mon Sep 13, 2010 9:19 pm

Re: [BUG] Visualizer goes haywire with too many fleets :(

Postby voidptr » Fri Oct 01, 2010 8:32 pm

Ah, I should have looked at Firefox's error console, too. I still don't know what's going on, unless split() doesn't like to split the fleet string into hundreds of elements. Someone who knows Javascript could take over, maybe start by pretty-printing visualizer.js so that the line numbers in the error messages become useful...

I don't think slow is the problem here; it's not simply freezing or hanging or taking a while to render, but actually rendering the wrong data (even incorrect owners and numbers of ships on the planets).

Code: Select all
Error: uncaught exception: [Exception... "An invalid or illegal string was specified"  code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)"  location: "http://planetwars.zerd.net/visualizer.js Line: 1"]

Error: k.source is undefined
Source File: http://planetwars.zerd.net/visualizer.js
Line: 1
voidptr
Brigadier-General
 
Posts: 139
Joined: Sun Sep 12, 2010 7:22 pm

Re: [BUG] Visualizer goes haywire with too many fleets :(

Postby Evgenius » Fri Oct 01, 2010 9:33 pm

Victory fireworks! I think we came independently to the same idea :) I use fireworks too. But yours is much nicer. I'm just sending ships to random planets.
Evgenius
Major
 
Posts: 37
Joined: Fri Sep 10, 2010 10:16 am
Location: Minsk, Belarus

Re: [BUG] Visualizer goes haywire with too many fleets :(

Postby amstan » Wed Oct 27, 2010 9:00 pm

We must fix this! lol!
Looks awesome btw.
Alexandru M. Stan
Contest Organizer
User avatar
amstan
Contest Organizer
 
Posts: 692
Joined: Sun Jan 31, 2010 4:02 am
Location: Stoney Creek, Ontario

Re: [BUG] Visualizer goes haywire with too many fleets :(

Postby Demerzel » Wed Oct 27, 2010 9:37 pm

Javascript string literals can be something like 2^23 long so I doubt that's the problem.
Demerzel
Colonel
 
Posts: 72
Joined: Sat Oct 02, 2010 6:06 am
Location: themendios at gee mail


Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron