Map transformer

Designed a level that creates new, exciting, and challenging Armagetron game play? Or maybe just something funky. Put it right here.
Post Reply
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Map transformer

Post by wrtlprnft »

http://wrtlprnft.ath.cx/python/maptrans ... ptransform

Should work in all browsers that support XHTML and some basic DOM, and it's an useful tool to transform maps, ie scale, rotate, translate and skew them.

Basic usage: Enter your map into the textarea at the top, then use the six boxes at the bottom (you'll probably only need the first three) to tell the script in what way you want to transform the map. Don't forget to use the buttons below the inputs to apply your transformations to the matrix, and then press transform.

Problems:
  • Zones can't be skewed or nonproportionally scaled. The script will attempt to make a guess at the best radius, but it's basically just an average of the width and height of the ellipse. Skewed zones don't get a meaningful radius at all.
  • The spawn points' directions are transformed, too, by adding the original location and direction, then transforming both, then substracting the calculated location from the result to yield the new direction. This may not always be what you want.
There's no place like ::1
User avatar
ed
Match Winner
Posts: 613
Joined: Mon Feb 13, 2006 12:34 pm
Location: UK

Post by ed »

Wow. great job.
All you need to do now is integrate the map previewer :wink:

Couple of things.

spawn angles don't work, ie

Code: Select all

                    <Spawn x="250" y="-25" angle="270"/>
                    <Spawn x="250" y="-475" angle="90"/>
will throw up an error. Whereas

Code: Select all

                    <Spawn x="239" y="16" xdir="0" ydir="1"/>
                    <Spawn x="241" y="592" xdir="0" ydir="-1"/>
is fine.

Rotate seems to skew the map. If I rotate a square by 45 I would expect a kind of diamond shape. Instead I get a kind of skewed polygon somewhere between the two. Maybe I'm just not understanding it correctly.

But, just for the move and scale it's a great tool. Would have saved me hours wrestling with a text editor.
Maybe a skewed map with custom axes would confuse the masses. hmmm...
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

Working on the map previewer (that is, emerging ruby on the server to even be able to think about it). It would have been great if nemo's online previewer supported maps submitted not via file upload, but regular POST (ie a <textarea>), then i could have just provided a form with a hidden input field containing the generated map code that would directly take you to the previever.

I fixed the rotation thing, thanks for notifying me. Note that I did the exact same mistake with svg2aamap, I just don't learn :s

Angles on spawn points are now supported, too, with the usual restriction when skewing the map.

The <Axis> tag is left alone currently, so you'll have to mess with it yourself if your maps use it.
There's no place like ::1
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

I added support for the axes tag and previews (after figuring out how to successfully emerge rmagick) :)
There's no place like ::1
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

ajax rocks :)
Added a preview button. It's a bit slow, but you can avoid using the back button that way.

EDIT: Tested successfully in opera, konqueror and firefox. Can someone test if it works in safari, please?
There's no place like ::1
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Just tried it in Safari. Manipulating the transformation seems to work fine, but it didn't do anything when I tried to preview. After clicking transform it complained about "undefined undefined" and tried to load something, but didn't get past "Contacting wrtlprnft.ath.cx". Actually I can't load anything right now. Server gone?
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

Umm, try again. My whole server crashed some 24666 seconds ago :s
There's no place like ::1
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

Working now. Wait, that was a few minutes ago, it doesn't now. Is it that I hit skew rapidly some ~80 times in a row? (which, as I figured out later, triggers a preview)
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

ah, that would explain why my server was so slow :s
Need to fix the javascript then :s
There's no place like ::1
Post Reply