Map Preview v2.0

Everything todo with programming goes HERE.
Post Reply
User avatar
LOVER$BOY
Match Winner
Posts: 725
Joined: Thu Jan 24, 2008 12:46 pm
Contact:

Map Preview v2.0

Post by LOVER$BOY »

Hello my beloved tron community.

Information
Yet again I release a new version of map preview. My first release of Map Preview only used SVG format to display maps on websites. I am still using it in my resource browser which I find is easier and quick to use. I am not pointing out that this version is less suitable than the method I firstly use but this version has a slight error but I'll explain as I go through.

Obviously this versions is 2.0. The main difference from the version 1.0 from this one is, I'm not using SVG to display maps. Instead, I'm solely relying on the php commands to convert maps into png (any other format of your choice) of image and outputting it to image.png. It is pretty amazing of a script that anyone can use to convert their maps into images and then display them on the websites so that their audience can clearly see, click and save them ;)

Struggles & Accomplishments
I have struggled for several hours before I overcome a stupid error I faced with loading walls. Strangely enough, I got the zones to work pretty quickly. It was a thrilling sensation, especially when I have tried to do this several times in the past.

The real snag I faced was the positioning the spawn indicators. I generally preferred to use arrows but due my lack of ... let's say, imagination, I couldn't figure out the base points for the arrow. After persisting for more than 2 hours, I finally cracked the problem and came up with a solution. I resorted to using the arrow points that already exist in my version 1.0 script. Then I fed the points to that arrow and finally it worked.

The only slight misgiving I have, right now, is the positioning of the arrows. Due to some unknown reasons, the arrows don't appear exactly as they should on the image. They appear where the spawns are set but either they spawn behind or after the spawn point sis a real mystery for me now.

Background & Development
Originally the idea came to be watching using Crazy Tronner's map preview for several years (almost 3 I think). At the start of the year, I explored into php and noticed the Imagick object. It was an object I soon found out how difficult it was to convert svg to images. That would've been the best because the svg produced the best quality of displays. After trying for several months (4) I gave up and decided to stick with svg.

It was two months later that I discovered Wik's map previewer script that it rekindled my urge to turn maps into images. I downloaded his source and was shocked at how squashed his scripting was. Seriously... I got lost in the code several times and felt like giving up again. It's a good thing my persistence through annoying situations is one of my greatest attributes.

I decided to look into the functions that he used and soon, after a month (because of my exams and assignments) of getting used to them and testing them out, I finally started to build the script only a few days ago. I did my best to keep the script neat and easy to read, understand and chance ;)

Source
After my... rather... dull speech, here's the code and enjoy :D
https://github.com/Vertrexia/map_preview

The maps present in that branch are the ones I tested the script with.
map_preview.php is the one your after ;)

Credits
Script solely made by me.
Special thanks to Wik for providing the source of his script (even though I didn't look at most of it).
Image

User avatar
AI-team
Shutout Match Winner
Posts: 1021
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Map Preview v2.0

Post by AI-team »

If you could change your indentation to 4 spaces that would be great ;)
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 

User avatar
LOVER$BOY
Match Winner
Posts: 725
Joined: Thu Jan 24, 2008 12:46 pm
Contact:

Re: Map Preview v2.0

Post by LOVER$BOY »

Couldn't be bothered, especially since I had to work the script in an old computer. Anyway, indenting the whole thing now is going to be another pain as I got another projects to look after. :P

Sorry AI but it's up to you guys to either indent it yourself or use it as it comes while changing only a couple of things, here and there to fit your needs :D
Image

User avatar
LOVER$BOY
Match Winner
Posts: 725
Joined: Thu Jan 24, 2008 12:46 pm
Contact:

Re: Map Preview v2.0

Post by LOVER$BOY »

Ok, as AI-team requested, I have removed all tab indentation and replaced them with spaces. Took me a while but it's done :)

Hope the use of it will go well :)
Image

User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1868
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: Map Preview v2.0

Post by kyle »

LOVER$BOY wrote:Ok, as AI-team requested, I have removed all tab indentation and replaced them with spaces. Took me a while but it's done :)

Hope the use of it will go well :)
Don't tell me you manually did that, Geany can do it in 2 clicks
Image

User avatar
sinewav
Graphic Artist
Posts: 6348
Joined: Wed Jan 23, 2008 3:37 am
Contact:

Re: Map Preview v2.0

Post by sinewav »

Dude, tabs for weaks. Who tabs?

User avatar
LOVER$BOY
Match Winner
Posts: 725
Joined: Thu Jan 24, 2008 12:46 pm
Contact:

Re: Map Preview v2.0

Post by LOVER$BOY »

mmm... I might have to post backwards for this one... :D
sinewav wrote:Dude, tabs for weaks. Who tabs?
Obviously, me :P

Well the program I used to code the script wasn't set properly (first time using it). I went back to using my old program and it works fine :)
kyle wrote:
LOVER$BOY wrote:Ok, as AI-team requested, I have removed all tab indentation and replaced them with spaces. Took me a while but it's done :)

Hope the use of it will go well :)
Don't tell me you manually did that, Geany can do it in 2 clicks
Never really got the hang of using Geany actually.
Image

Post Reply