forum.webdiplomacy.net

webDip dev coordination forum / public access todo list
It is currently Wed Sep 20, 2017 9:27 am

All times are UTC




Post new topic Reply to topic  [ 59 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: SVG Map
PostPosted: Wed May 27, 2009 3:06 pm 
Offline
Site Admin

Joined: Sat Jun 28, 2008 6:24 am
Posts: 892
That is an impressive piece of code Lucas, thanks for posting that. I wonder how the JS adjudicator is licensed, there is a weird lack of contact or authorship details on that page


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Wed May 27, 2009 3:43 pm 
Offline

Joined: Wed Oct 08, 2008 12:47 pm
Posts: 726
Hmm, not sure how I missed this the first time round :S
Very interesting - I'll give that a proper look after my exams (groan).
Sorry for all the delays, hoping to return to the map in a month's time!


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Wed Jun 17, 2009 10:47 pm 
Offline

Joined: Wed Jun 17, 2009 10:45 pm
Posts: 3
Some of the ideas on this thread are quite good. I had been working on an SVG version of the map myself, which can be seen here:
http://phpdiplomacy.monkeylaw.org/map-svg.php?gameID=17&turn=3
(you can of course change the turn attribute around)

I got a little disillusioned by the way it seems to slow down browsers... I've been thinking of simplifying the map a little, and am looking for ways to simplify the methods by which it adds the touches like outlines that I so like.

Anyone care to pool efforts?


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Thu Jun 18, 2009 3:49 pm 
Offline

Joined: Wed Oct 08, 2008 12:47 pm
Posts: 726
You're drawing your map server side, which is whats causing it to cause such work for the browser. I don't have a full demo, currently and it isn't as bright as yours. However the main difference is that the drawing is done client side. This took quite a bit of javascript work, but means that maps load instantaneously. Add me on msn (figlesquidge[at]gmail[dot]com) if you want to talk about it. I'm busy until next wednesday but from then on I'll be right back onto development, and hope to have the map finished to slip in with one of the early 0.9x builds.


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Thu Jun 18, 2009 5:20 pm 
Offline

Joined: Wed Jun 17, 2009 10:45 pm
Posts: 3
Draw the map client side! I never thought of that! I would very much like to see an example.


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Thu Jun 18, 2009 7:29 pm 
Offline

Joined: Wed Oct 08, 2008 12:47 pm
Posts: 726
Email me and I'll respond next week, and we can talk about it in depth. I've got far too many important exams to do any 'propper' dev work at the moment but they finish on wed (important=A-levels&university entrance exams; too many =tue,wed,thu,fri,mon,tue,wed - 7 weekdays straight).


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Tue Jul 07, 2009 12:10 pm 
Offline

Joined: Sun Jun 07, 2009 3:24 pm
Posts: 71
After looking at those two demonstration links, I think I just drooled a little. That's fantastic work.

Fige, I noticed your pop-up messages. Script is single-threaded. Remember in my gadget discussion where I was whining about changing the graphics during reload? Same problem. You have to yield to the browser before it'll refresh the display, and script/html doesn't give you any direct way to do that, unfortunately. In JS the hack is to simply run a short setTimeout (1ms is plenty) which calls a function to execute the next piece of work you want to do after the display updates. Your alert box is doing the same thing -- yielding control to the OS, which is a different thread.

Note also that you want to use a function pointer with setTimeout, not the eval-based form which is what you'll find documented in most places. The eval method causes a leak in all current JS implementations because you can't avoid creating an orphaned prototype function on the stack:

Right: setTimeout(continueAfterRefresh, 1);
Wrong: setTimeout("continueAfterRefresh()", 1);

I'm curious, where did you guys source your vector-format map graphics for this, and what are you using to generate the SVG paths? (I'm guessing Monkey's source material didn't start out so highly stylized.)

I haven't looked at SVG in many years (messed with it briefly when IE was shipping that control), but I noticed that Fige's SVG is only about 430 lines whereas Moneky's is weighing in at over 8500 with much more complex paths... makes me wonder if there might be a better tool to generate the outline paths from the source format. Monkey's renders very slowly for me.


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Tue Jul 07, 2009 4:40 pm 
Offline

Joined: Wed Oct 08, 2008 12:47 pm
Posts: 726
I've done a lot of work to simplify mine, and that's cut it down a bit. The file length in lines is probably not the main issue because most of that is taken up with the speading of the lower elements. Mine was build to be worked in javascript as you noticed, and I was hoping to plug it into an early 0.9 release before continuing to develop, but unfortunately that was impractical so I decided to wait until after my holiday.
My map is a trace of the large map from the current site, and I will fully accept mine is not graphically perfect. The main objectives of it were to be as simple as possible, written clientside, and be easily expandable such that it could be used to fill in orders.


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Tue Jul 07, 2009 5:19 pm 
Offline

Joined: Sun Jun 07, 2009 3:24 pm
Posts: 71
Yeah, after I posted the line-count comment I came back later and saved out both files and noted that Monkey's was "only" about 4X larger -- which is still quite a bit, but not nearly as much as I expected based on the line counts.

Are you familiar with raphael? It's a pretty nice, reasonably lightweight, free (OSS) js library that makes it easy to get the same results in IE's VML without having to actually deal with VML, and everybody knows that dealing with IE is unavoidable -- and nobody likes downloading plugins (the last time I looked, the SVG plugin was 6MB) --

http://raphaeljs.com/index.html


Top
 Profile  
 
 Post subject: Re: SVG Map
PostPosted: Tue Jul 07, 2009 9:22 pm 
Offline

Joined: Wed Oct 08, 2008 12:47 pm
Posts: 726
Well, I'm going to stick my neck out:I have no intention of porting to IE.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 59 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group