Author Topic: I wrote a Warcraft II map viewer in JavaScript  (Read 10611 times)

Offline typhoon

  • Critter
  • *
  • Posts: 2
    • View Profile
I wrote a Warcraft II map viewer in JavaScript
« on: April 04, 2019, 12:56:50 AM »
It lets you open any of the maps included with Warcraft II BNE (including campaign maps) or load maps off your computer.

http://jcfields.gitlab.io/warcraft2-map-editor/

My intention is ultimately to turn it into a full map editor, but right now, it only opens maps. It can also save map images using "Save Map as Image" under the "Editor" tab. It'll probably be a while before I implement full editing functionality, but it's fun to work on a little here and there.

Works well in Firefox and Chrome. Works in Safari but loads very slowly.

The source code is available for anyone who's curious. Hopefully someone else finds it interesting or useful.

Edit 6/26: I took a break from it but finally implemented saving, so you can use it to modify unit data, upgrades, and so forth.
Edit 6/30: Implemented restriction data (i.e., the ALOW chunk).
Edit 7/11: Implemented unit placement/deletion.
« Last Edit: July 11, 2019, 06:56:02 AM by typhoon »

Offline iL

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 1653
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #1 on: April 04, 2019, 04:05:20 AM »
Excellent job, typhoon, you are great developer!

Thinking about to replace map list like this: http://www.war2.ru//map-list/thumb.html to your project!

Is there a way to open the map by url? I mean, to use query string like site-name/warcraft2-map-editor/?map=GardenOfWar.pud or w/e?
To let people give links to some map directly somewhere on forum or anywhere else?
Need help to translate War2Combat to German, French, Italian, Polish or another language: http://forum.war2.ru/index.php/topic,4728.0.html
Please, contact me if you are interested in that.

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #2 on: April 04, 2019, 05:23:59 AM »
Nice one jc. Looks great :)
its gooder to hax hard and NEVER get caught!

Offline typhoon

  • Critter
  • *
  • Posts: 2
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #3 on: April 04, 2019, 07:01:17 AM »
Is there a way to open the map by url? I mean, to use query string like site-name/warcraft2-map-editor/?map=GardenOfWar.pud or w/e?
To let people give links to some map directly somewhere on forum or anywhere else?

That's a great idea. I implemented it as you suggested, following the same file paths as given in the file browser. Some examples:

classic/Plains of snow.pud
campaign/xhuman12.pud
ladder/Garden of war BNE.pud
classic/expansion/Friends.pud

(Edit: I also added a "Link to Map" action under the "Editor" menu to generate these URLs automagically.)
Nice one jc. Looks great :)

I appreciate it! It looks like there's a wealth of information here, so I intend to stick around and absorb some things. :)
« Last Edit: April 09, 2019, 12:43:24 AM by typhoon »

Offline WarKid

  • Peon
  • **
  • Posts: 35
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #4 on: April 04, 2019, 07:28:49 AM »
Really good!! Keep it up with the good work! ^-^

Offline Szwagier

  • Ogre Mage
  • ********
  • Posts: 1707
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #5 on: April 04, 2019, 11:11:45 AM »
very nice, but I see bugs in player setup, I cant scroll to yellow, or pick human for red
http://www.youtube.com/user/SzwagierR


Equinox - the dumbest person in this game, do not argue with an idiot, because he will bring you to his level and overcome with experience

Offline shesycompany

  • Death Knight
  • *********
  • Posts: 3587
  • retired, be in music section
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #6 on: April 04, 2019, 06:32:52 PM »
love the sprite sheet approach  :-* for tiles

Offline Muz

  • Axe Thrower
  • ****
  • Posts: 312
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #7 on: January 01, 2020, 04:10:01 PM »
Can you make a script for BNE chat?

Offline durazno33

  • Peon
  • **
  • Posts: 8
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #8 on: November 30, 2021, 12:06:31 AM »
I love the idea of this. If this is not abandoned, could you make an option to modify the cost of a spell? So make healing cost 4 mana instead of 6?
« Last Edit: November 30, 2021, 09:39:14 AM by durazno33 »

Offline Mistral

  • Administrator
  • Axe Thrower
  • *****
  • Posts: 408
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #9 on: November 30, 2021, 02:48:46 PM »
normal map editor cannot modify manacosts
cuz they are hardcoded
use triggers editor instead
https://forum.war2.ru/index.php?topic=6242.0

Offline durazno33

  • Peon
  • **
  • Posts: 8
    • View Profile
Re: I wrote a Warcraft II map viewer in JavaScript
« Reply #10 on: November 30, 2021, 09:54:42 PM »
OK I'll give that a try. Thanks.