PDA

View Full Version : Testing a web server ?



Redrobes
05-27-2009, 04:22 PM
Ravi and I were chatting the other day and we thought it would be fun to be able to play RPGs via the forums in the CWBP. It was suggested that we might be able to have many groups running amok spread all over the area and I suggested that it would be possible to keep track of the maps and maybe serve up the maps on the forums by request. Then I thought that what might be better is serving them us via your browser. So I have been implementing a web server into ViewingDale to you guys can get at the CWBP maps dynamically. Now I don't know how to do interiors and underground as well as you cant click through the jump points on the map but one thing at a time eh ?

It works just great on the desktop between two machines but thats always easy. I have used a proxy, tried it on some out of same building machines, and a few people here have had a play from my PMs. Mostly its been great and some people have had a few problems but I have made some changes to it since.

The URL is quite complex. It has an X, Y, Z and S. The X & Y are in meters from some arbitrary point bottom left. The Z is zoom or scale where a big number is zoomed out a long way. The optional S is the image size to serve up.

So... START HERE (http://82.32.151.149:8080/?x=1444771&y=3376670.4&z=100&s=512)

which should be the cart in Fentor Cross, Thrubmorton, Ansium and manually change the Z and maybe X&Y if you feel like it.

There is no scripts or log in or anything its running right out of my desktop machine. It can note the IP address and User Agent (I.E / Firefox) etc and the map coords but does not track anything other than the normal web page stuff you dish out to every other web server.

If your able then it would be cool if you could reply in this thread with whether it worked or not and whether you think its a good idea to serve these maps and also whether you think it would be good to play RPG by chat/forum posts/other in the CWBP.

Also, if anyone has a windows based always on web server that they just happen to have running and might be able to host with a more 'always on' experience than I might be able to do then that would be appreciated. I'll be running this for at least a few hours from now but then its likely to be off. Hope it stays up for at least a few hours tho :shock:

Enjoy.

Steel General
05-27-2009, 04:38 PM
Neat stuff RedRobes!

Maybe implement similar controls to Google Maps or something (I have no idea how difficult that would be).

Notsonoble
05-27-2009, 04:49 PM
the first load worked (i think) I got an image of a cart, when I went to change x to what thought would be forward, it never loaded...

torstan
05-27-2009, 05:43 PM
I tried but the connection timed out.

ravells
05-27-2009, 07:03 PM
I got stuck with an endless load too :(

This is a really cool idea though!

Redrobes
05-27-2009, 07:58 PM
Ok so basically some issues to resolve then. That's pretty usual and ill have a look through the list of connection list and see which bits it seemed to get stuck on. Bit of a shame that because I cant find a connection where its not solid - which is always the way aint it ! It was gathering stuck threads and it seems to be better in that department now so I must just serve the pages and ensure that the browser is told that I have done it and to stop requesting it again.

Did anyone have any opinions or ideas about whether this would be useful and whether this, as an idea, is good for playing in the CWBP ?

If I use a cookie then I think ill be able to keep track of where you last asked for and then if you press left or right then it could determine a new position based on the previous one. That would make the UI much more simple. Not sure how easy that is at this point but it sounds like it should be easy. Or I could keep a list of URL links to the groups playing so you can just click to go to their position. Use something like the members map I host but instead of a new person pin I could make it so that you enter a name and some password and a new position and it changes it. That position could come from the map server so it lines up accurately. So groups update their own position on the global map which would be an always on deal.

Anyways, to those that tried it, thanks guys. I'll have to work on it some more tho.

Edit -- its still running just fine for me. Time to find an Australian proxy I think...

NeonKnight
05-27-2009, 08:25 PM
Tried, and here is where I moved the map too.

http://82.32.151.149:8080/?x=1444780&y=3376680.4&z=150&s=512

Redrobes
05-27-2009, 08:34 PM
I am glad its working for some people. I have tried a few more proxies and its just fine. Heres one...

http://www.anonasurf.com/

This one is based in california so thats a 10K mi round trip at least and it seems fine. I'll try your link address Neon :)

It will be up for about 20 mins more then I have to get some kip :D

torstan
05-27-2009, 08:38 PM
Okay, now it works (back at home rather than in the office - could it be a portforwarding or firewall issue?)

That's great! A right, left, up and down arrow to move the view by increments would be a handy first implementation of panning. Also, any chance of a larger image?

I like the idea of a CWB pbp campaign area. I'm not sure I'd have time to run anything but I like the concept of playing a laid back game.

Redrobes
05-27-2009, 09:05 PM
Yeah I am thinking maybe the issue is that I am hosting it on 8080 cos I run an internet web server for myself too. Maybe I should host it on 80 like a normal web server so that I can drop the :8080 bit of the url and then maybe everyones firewalls and internet connections wont think its too bizarre.

Hmm odd isnt it. So its not a total loss and seems as though with certain set ups its just fine and with others not so fine. I will have to try and see how I can rough it up a bit and see if I can break it. Looking at the log it seems as though some connections make multiple rapid attempts to connect. I cant be sure what happens from that point. I don't know if I abort the new connections or serve the last one requested.

I reckon it would be great to play in a group but I dont have much time to map let alone GM. Struggling to map anything and do thumbnails at mo... sigh.

Redrobes
05-27-2009, 09:08 PM
Also, any chance of a larger image? Yes, change the S value. I have set it to max at 1280 I think. Certainly 1024. But I am pulling the plug on it in a mo. Can try again tomorrow eve tho.

RobA
05-27-2009, 11:52 PM
Yeah I am thinking maybe the issue is that I am hosting it on 8080 cos I run an internet web server for myself too. Maybe I should host it on 80 like a normal web server so that I can drop the :8080 bit of the url and then maybe everyones firewalls and internet connections wont think its too bizarre.

If you are using apache, you can use mod-rewrite to map a url to the other port. Something like this should work (untested):


Options +Indexes +FollowSymLinks
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[a-z]{3,9}\ /mycooldemo\.html\ HTTP/ [NC]
RewriteRule ^.*mycooldemo\.html$ http://82.32.151.149:8080/ [R=301,L]


and should redirect connections like
http://82.32.151.149/mycooldemo.html?x=1444771&y=3376670.4&z=100&s=512

to
http://82.32.151.149:8080/?x=1444771&y=3376670.4&z=100&s=512

-Rob A>

torstan
05-27-2009, 11:55 PM
@Redrobes: Thanks. Missed that in the OP. Cheers for clearing it up.

Looks good.

Redrobes
05-28-2009, 08:03 AM
If you are using apache, you can use mod-rewrite to map a url to the other port.Hi Rob, These images are being served from the ViewingDale app itself. They are not images which are saved and hosted via Apache. I have been programming the web server using sockets and stuff but it does not have a nice rewrite engine. What it does mean is that there is no limit to where to go and what values to zoom to like say Google maps. Google has discreet levels of zoom which is alright and makes caching easier, faster and less bandwidth but its not good for a map that is (hopefully) changing as we add new maps to it. Obviously that also means its web interface is never going to be quite as slick as Google maps either for all the same reasons. But then if you wanted it more slick you could connect via its standard VTT connection and get the map updates super fast since it would be hosted and rendered locally.

What I probably will do is host a standard web page with an iframe containing the image and get the page to request the image from the app. So people don't connect to some odd URL and have no UI.

Gotta think how I can get the server running all day. It might have to be an occasional thing tho. I had some more ideas about the mechanics of play by post in CWBP and all of this serving stuff which ill type up in a different post.

RobA
05-29-2009, 12:01 PM
What I probably will do is host a standard web page with an iframe containing the image and get the page to request the image from the app. So people don't connect to some odd URL and have no UI.

I suggested the mod-rewrite as it really acts more like a URL proxy. Lots of firewalls won't allow connections to other than the standard ports (80 and 443), so the iframe contents still won't be visible in that case.

-Rob A>

Redrobes
05-29-2009, 12:42 PM
I have to admit that I don't understand your fix because there is no rewrite engine anywhere in the chain. And your right, if I host a web page on an Apache server then do a rewrite there wont help because that would just go back to the browser and request that it fetches the page on a new port instead. The fix I think is for me to reprogram my firewall to port forward 80 to internal 8080 and do the translation there. Or I could host my internal web server on 8080 and put the externally viewable one on 80 which would make everything a lot easier and as you say a lot of places don't like web page fetches on anything other than the default port numbers.

If I understand what your saying then is it really possible then for me to go to a web page (that I have access to the rewrite engine) and when the browser asks for its URL there then Apache goes and fetches the result of a get from a different site and forwards the result to the browser ? I have been using the rewrite engine to direct specific IP addresses to the 'your barred' page but thats a page that is hosted on the same server space.

Y'see I thought and maybe this is where I am wrong then, is that the GET request is translated via the regex and then forwarded as though the browser asked for the translated URL. I just assumed that the result would have to reside on that Apaches set of web files.

I am gonna have a play with the FTP and Twitter API perl modules at the end of the weekend when I get a moment to burn. If all that works well then I think a console driven PbP play manager might be in order. Perl runs on everything and I am not into Java. Also, ill look into doing the Ansium map like the members map thing. That ought to be real easy since I have most of it already running.

Ah but noone has responded to my suggestion that we do some play in the CWBP so perhaps its just me (n ravs) getting excited at the prospect !?? But it seems we have 99% of the effort in place so ill do the 1% even if its just me who uses it. I'll GM and be all the players too like Billy Nomates - heh ;D

Steel General
05-29-2009, 02:13 PM
I thought I knew some stuff about web servers, but you guys are way beyond me now... :)

Redrobes
05-30-2009, 05:28 AM
Its not that bad. Maybe ill write a few notes about all of this because its useful to know esp if your setting up a VTT where you have to serve as a DM. Its more VTT related than anything specific to mapping but it comes up time and time again so maybe. The rewrite engine is slightly more complicated but you dont need to know about that unless you are running Apache or have web pages served from an ISP which uses it. And even then you don't have to use it.