Official Soldat Forums

Soldat Fans => Developers Corner => Topic started by: urraka on March 06, 2015, 04:47:40 pm

Title: WebGL soldat map renderer
Post by: urraka on March 06, 2015, 04:47:40 pm
I was really bored so I did a webgl map renderer:

http://urraka.github.io/soldat-map/#ctf_Ash
http://urraka.github.io/soldat-map/#Airpirates
http://urraka.github.io/soldat-map/#Cambodia

All the default maps are uploaded there for testing, just change the name in the URL.

Source code is here: https://github.com/urraka/soldat-map
Title: Re: WebGL soldat map renderer
Post by: %%%%%%% on March 06, 2015, 06:04:01 pm
Cool, cool, cool.
Title: Re: WebGL soldat map renderer
Post by: jrgp on March 06, 2015, 08:51:47 pm
You forgot making scroll wheel zoom in and out. Good otherwise.
Title: Re: WebGL soldat map renderer
Post by: urraka on March 06, 2015, 10:05:17 pm
You forgot making scroll wheel zoom in and out. Good otherwise.

You can still zoom in and out with +/- keys. My mouse wheel is always broken so I don't bother to think about it anymore...


Edit: ok, I added mouse wheel for zooming now (hopefully it's not backwards)
Title: Re: WebGL soldat map renderer
Post by: Bistoufly on March 07, 2015, 01:00:36 am
Awesome!
Title: Re: WebGL soldat map renderer
Post by: homerofgods on March 07, 2015, 04:11:59 am
Awesome!
Title: Re: WebGL soldat map renderer
Post by: DorkeyDear on March 07, 2015, 05:57:20 am
This is quite, well, awesome, as others have said! This reminds me of when I wanted to make a heatmap of where people die or kill, among other things. I still find the idea fascinating.

I see zooming convention be different between programs. I personally like the way zooming is, but I think that is the less common convention of the two conventions (may be I am wrong here?).
Title: Re: WebGL soldat map renderer
Post by: Moroes on March 07, 2015, 07:10:57 am
More than a map preview. Brilliant!
I'd love a switch to polygon view and spawns/flags but this is good enough :D. PW can do the rest.

BTW: Zooming with scroll wheel works just fine.
Title: Re: WebGL soldat map renderer
Post by: urraka on March 07, 2015, 08:48:56 am
This reminds me of when I wanted to make a heatmap of where people die or kill, among other things.

That's a very interesting idea indeed

I'd love a switch to polygon view and spawns/flags

With "switch to polygon view" do you mean to show only polygons? or some kind of wireframe mode?
Title: Re: WebGL soldat map renderer
Post by: Izzy Rose (PL) on March 07, 2015, 11:19:31 am
This awesome thing can be used for map databases to make them more comfortable to use! No more test-downloading maps due to shitty preview screenshot! :D
Title: Re: WebGL soldat map renderer
Post by: Fawkzy on March 07, 2015, 01:57:54 pm
this is truly sexy
Title: Re: WebGL soldat map renderer
Post by: jrgp on March 07, 2015, 07:23:38 pm
This reminds me of when I wanted to make a heatmap of where people die or kill, among other things.

That's a very interesting idea indeed

Someone did that for one of the gather communities a long time ago. Something makes me feel Toumaz was involved.

Edit: ok, I added mouse wheel for zooming now (hopefully it's not backwards)

Perfection. Now it's as good as browsing with Polyworks.

With "switch to polygon view" do you mean to show only polygons? or some kind of wireframe mode?

Open Polyworks and look at the little window with the checkboxes that determine how to render the map. You can choose between full polygons rendered with texture (how your web app currently is), polys without texture but with shading, polys without shading or texture which is just wireframe which is probably what Moroes is asking.

Also, Could you add some sort of progress bar for loading the map elements? Staring at a black screen for a few seconds while the map loads is less than ideal.

Additionally, put the PMS filename in the <title> tag so it's easy to discern a bunch of tabs open at once.

Another edit: now that I've played with it for a bit, can you make it so zooming in uses the position of the mouse cursor?
Title: Re: WebGL soldat map renderer
Post by: Puure on March 07, 2015, 07:33:13 pm
wtf? empty links..
Title: Re: WebGL soldat map renderer
Post by: jrgp on March 07, 2015, 08:08:11 pm
wtf? empty links..

If you're talking about the black screen, you have to wait a few seconds for the map to load, fuckstick.
Title: Re: WebGL soldat map renderer
Post by: urraka on March 07, 2015, 11:31:42 pm
Also, Could you add some sort of progress bar for loading the map elements? Staring at a black screen for a few seconds while the map loads is less than ideal.

Additionally, put the PMS filename in the <title> tag so it's easy to discern a bunch of tabs open at once.

There's a loading indicator now, and the map name shows in the title.

I'll play with the zoom stuff tomorrow and maybe I'll work on adding some switches to show/hide stuff like PolyWorks does.

wtf? empty links..

Also note that this stuff won't work on shitty old browsers. I only tried it on Chrome and Firefox. Internet Explorer has a long history of being shitty so I wouldn't be surprised if it doesn't work there. I don't have the newer one so I can't really tell though.


Edit: did the zoom to cursor position stuff already
Title: Re: WebGL soldat map renderer
Post by: Moroes on March 08, 2015, 02:49:53 am
Yes, jrgp is right. I'd love a wireframe showing the map structure in a well arranged way. Polygons should be coloured according to their types (normal, deadly etc.)
Something like this: https://db.tt/MKA5mYtd

Zooming is even better now and map loading is sexy. It loads even the biggest "maps".  :D
http://morko.cz/#rce_freetime

Got just one problem. Fancy climb maps are always black. Doesn't it load textures of size of hundreds of kBs, or is it a server/filename problem?
http://morko.cz/#SS_Juice
http://morko.cz/#ctf_vir_coop10

I am attaching the map files in case you wanna test that.

Thanks much for the renderer ;)
Title: Re: WebGL soldat map renderer
Post by: Puure on March 08, 2015, 08:04:38 am
If you're talking about the black screen, you have to wait a few seconds for the map to load, fuckstick.
I have white screen xDDD

Also note that this stuff won't work on shitty old browsers. I only tried it on Chrome and Firefox. Internet Explorer has a long history of being shitty so I wouldn't be surprised if it doesn't work there. I don't have the newer one so I can't really tell though.
I'm using Firefox :p
Title: Re: WebGL soldat map renderer
Post by: urraka on March 08, 2015, 09:31:24 am
Got just one problem. Fancy climb maps are always black. Doesn't it load textures of size of hundreds of kBs, or is it a server/filename problem?

Yesterday I noticed some maps would fail to load because the file name casing in the PMS was different from the real file. So I renamed all images to lowercase and made it always load as lowercase. A bit hacky but just wanted to make it to work. Blame windows file system for not being case sensible.. Anyway, I thought that could be the problem there but I just noticed it's something else. Looks like WebGL requires power of two sizes for textures that have a repeat wrapping. Still, if you try custom maps make sure all the image files are lowercase until I figure out a better way to fix that.

Btw, if you have access to a bash console in your server you can use commands like this to rename images to lowercase:

Code: [Select]
cd soldat-map/data
find scenery-gfx/ -name '*[A-Z]*' | while read f; do lc=$(echo "${f}" | tr A-Z a-z); mv "$f" "$lc"; done
find textures/ -name '*[A-Z]*' | while read f; do lc=$(echo "${f}" | tr A-Z a-z); mv "$f" "$lc"; done

I'm using Firefox :p

Well, first I would make sure that WebGL actually works on your end. You can test that here https://get.webgl.org/.

If that works fine you can try checking for errors in the map renderer. Just open the console (ctrl+shift+k) and see if there is some message in there. If there's nothing refresh (with the console open), and check again just to make sure.


Edit: fixed the power of two problem
Title: Re: WebGL soldat map renderer
Post by: duz on March 08, 2015, 12:27:48 pm
http://web.soldat.pl - Now you can play Soldat using your browser, like Quake Live.


Oh, no. It's a dream :(
Title: Re: WebGL soldat map renderer
Post by: Furai on March 08, 2015, 03:24:21 pm
http://soldat.thd.vg/en/gather << this "still exists". :P
Title: Re: WebGL soldat map renderer
Post by: themangokid on March 08, 2015, 03:40:15 pm
awesome!!! :D!! more of this:)
Title: Re: WebGL soldat map renderer
Post by: jrgp on March 08, 2015, 07:58:29 pm
http://soldat.thd.vg/en/gather << this "still exists". :P

Except that "web app" I made with MM in ~2010 no longer has the soldat servers or the backend daemons running.
Title: Re: WebGL soldat map renderer
Post by: Furai on March 09, 2015, 04:49:34 am
http://soldat.thd.vg/en/gather << this "still exists". :P

Except that "web app" I made with MM in ~2010 no longer has the soldat servers or the backend daemons running.
Hence quotes around "still exists". I wasn't sure if it's even playable. And btw, you have been working on it with me. I was your alpha/beta tester. :P
Title: Re: WebGL soldat map renderer
Post by: urraka on March 09, 2015, 11:35:02 am
The map viewer now has some options to switch scenery, polygons, wireframe, etc

http://urraka.github.io/soldat-map/

I also have in mind adding options to highlight specific polygon types (deadly, etc) and to show objects (spawn points, flags, etc).

By the way, anyone knows what the "active" field means in the PMS format? (check here http://wiki.soldat.pl/index.php/Map). Some structs like PMS_PROP have this field. Should I not render stuff that is not "active"?
Title: Re: WebGL soldat map renderer
Post by: duz on March 09, 2015, 12:40:15 pm
The map viewer now has some options to switch scenery, polygons, wireframe, etc

http://urraka.github.io/soldat-map/

I also have in mind adding options to highlight specific polygon types (deadly, etc) and to show objects (spawn points, flags, etc).

By the way, anyone knows what the "active" field means in the PMS format? (check here http://wiki.soldat.pl/index.php/Map). Some structs like PMS_PROP have this field. Should I not render stuff that is not "active"?


How hard is to put a player with the same Soldat movement, 3 weapons (auto, m79, barret) +secondary and the network things?
Title: Re: WebGL soldat map renderer
Post by: urraka on March 09, 2015, 12:49:47 pm
How hard is to put a player with the same Soldat movement, 3 weapons (auto, m79, barret) +secondary and the network things?

VERY hard :)
Title: Re: WebGL soldat map renderer
Post by: jrgp on March 09, 2015, 03:41:10 pm
How hard is to put a player with the same Soldat movement, 3 weapons (auto, m79, barret) +secondary and the network things?

VERY hard Challenge accepted. :)

Fixed that for you :P
Title: Re: WebGL soldat map renderer
Post by: urraka on March 09, 2015, 05:01:01 pm
Haha very funny. I think it would be easier to find a way to compile soldat source to javascript. It's a trend to compile things to javascript these days.

On a different note, mr. %%%%%% noted me that the wireframe mode is barely visible when polygon texture is disabled, so I made it render darker when texture is unchecked.


Edit: added options to highlight specific polygon types
Title: Re: WebGL soldat map renderer
Post by: urraka on March 10, 2015, 08:47:07 pm
Added options to switch colliders and object spawns http://urraka.github.io/soldat-map/

Only thing missing is the bot waypoints, but it doesn't sound like a very useful thing.
Title: Re: WebGL soldat map renderer
Post by: Sipar on March 13, 2015, 06:40:17 pm
spawn a car http://phaser.io/examples/v2/box2d/car-on-terrain
Title: Re: WebGL soldat map renderer
Post by: Toumaz on April 02, 2015, 03:58:03 pm
Bit of a bump. Hi.

I did the heatmap stuff a looong while back for #soldat.realistic (http://toumaz.users.avalanchehosting.com/index.php?p=heatmaps). Since that site won't be online for much longer, here's a generated image (http://i.imgur.com/JFt09Vg.jpg) for posterity's sake.

If anybody wants to play around with some data for heatmaps or the like, I've attached a CSV with about five million game events. Columns are map, event, team, x, y, weapon. Feel free to do whatever you like with it.
Title: Re: WebGL soldat map renderer
Post by: urraka on April 02, 2015, 08:39:26 pm
That's pretty cool, I might try something with that stuff later. Thanks for the data!
Title: Re: WebGL soldat map renderer
Post by: jrgp on April 02, 2015, 09:18:54 pm
Bit of a bump. Hi.

I did the heatmap stuff a looong while back for #soldat.realistic (http://toumaz.users.avalanchehosting.com/index.php?p=heatmaps). Since that site won't be online for much longer, here's a generated image (http://i.imgur.com/JFt09Vg.jpg) for posterity's sake.

If anybody wants to play around with some data for heatmaps or the like, I've attached a CSV with about five million game events. Columns are map, event, team, x, y, weapon. Feel free to do whatever you like with it.

Knew it was you! Thanks for those links.

Also, welcome back. xD

Also also, I'll give you free web hosting to keep that online. That's cool as hell.
Title: Re: WebGL soldat map renderer
Post by: SyavX on April 03, 2015, 03:24:36 pm
If anybody wants to play around with some data for heatmaps or the like, I've attached a CSV with about five million game events. Columns are map, event, team, x, y, weapon. Feel free to do whatever you like with it.

In addition to this, here is an attachment with same data in a format of SQLite database.
Title: Re: WebGL soldat map renderer
Post by: xmRipper on April 17, 2015, 04:57:10 am
That's a lot of hard work, great. So what is next, web based Soldat game? :P
Title: Re: WebGL soldat map renderer
Post by: urraka on April 17, 2015, 08:12:39 am
That's a lot of hard work, great. So what is next, web based Soldat game? :P

I'm almost there! http://urraka.github.io/estampida/


(not really)