• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Ever wanted to run jass scripts outside of war3?

Status
Not open for further replies.
Level 6
Joined
Jul 30, 2013
Messages
282
Still a very very early work in progress but if you are interested you are welcome to poke at it.

current version: 0.0.3

Sources: https://bitbucket.org/Waffle_est/jass2_interpreter

So ehm.. basically.. running jass2 as a script will be a thing.. soon.. probably..

.. and please any feedback is apprechiated as well as any thoughts on what applications you might have for a utility such as this,
what your use cases would require, what changes/additions to the CLI etc.

also.. currently i only directly support vanilla jass2 (you can always run jasshelper or some other preprocessor if you want to use an extended syntax)

TODO:
  • implement a fully emulated war3 runtime environment


how to:
get python 3.4
run "pip install jass_interpreter"

run "python -m jass_interpreter"
 
Last edited:
Level 12
Joined
Mar 13, 2012
Messages
1,121
I'm asking you the same question as Ruke and please don't be discouraged by it, everyone should do what he wants as it's all about fun!

Don't you want to do something that is useful to wc3 modders, like something boundary pushing, and will be used by more people than just yourself?
 
Level 6
Joined
Jul 30, 2013
Messages
282
hopefully this will be useful.

for instance uses i have planned already:
  • once ive mocked out the runtime (eg implemented natives) can be used to unit test some simple functions.
  • quicker turnaround time for testing short code fiddles, dont have to wait for the entire map to compile
  • ability to run jass at the compile time. eg you can have jass code that reads in some data from a config file or inserts a timestamp or dynamically generates some code.
    (for one i'm infinitely irritated by lua objectmerger.. why must i use LUA to define units/objects in code? with this system that could be just a list of calls to a thin wrapper and the code itself would be pure jass, much more approachable to the average war3 dev.)
  • access to the underlying python ecosystem
  • emitted code will run on non-windows systems -- can do code development on non-windows platforms, can be run on the server or in the browser

also im not aware of a system other that the warcraft3 game engine to run jass2 scripts so this should be the first ..
that or im badly informed..

what i'm trying to say is that there are a LOT of use cases i already know of that would be really really useful.
tho this isn't itself something a lot of people can anjoy i think it has the potential to become an important building block.
 
Last edited:
Level 6
Joined
Jul 30, 2013
Messages
282
at the moment to poke at it..


you get python3.4 or ensure you have it installed.. (python.org)

currently i have no GUI so you need to not be too afraid of the command line,
but really the commands are all realyl simple so i hope you can bear with it..

you clone the repo..
(bitbucket gives you the clone command to use, you need git tho.)

you run the command "pip install -r requirements.txt"
to get all the stuff you need to run it.

then you can run
main.py <filename> (or a list of filenames..)
and it will emit a file called <filename>.py

also there are some unittests made with the py.test framework in mind.

javascript or python doesnt really matter, there are several highly compliant python implementations in javascript so if that is really important it can probably made to run on one of these.

I guess to call it a compiler would be more appropriate than interpreter really...,
but to emit the source or execute it is really a small difference so i guess soon you will be able to do both..

why i chose to use python is basically the parsing library i use is implemented in python and i like the language.
javascript has some rough corners.

also, choozing to emit python was a way to discipline myself to emit good and readable code (eg indentations is mandatory) and going with another language might have led to temptations that result in less readable code.

If you have any issues with the library please feel free to poke at me. will make a point to smooth out any rough spots :)

#sendskypespamto:joonas.liik :)

The standard library functionality has not yet been implemented, so you cant run random jass scripots yet and have them emulate war3 behaviour. (eg there is no CreateUnit(..) etc)
also theres some design decisions yet to do, and i hope to make some of them based on feedback i get on this thread.



and no, i'm not even going to botyher doing any syntax checking at all, you have pjass for that and that works reasonably well.
also the supported syntax is not 100% jass, theres a few omissions (consider those bugs) and additions (like you can use .attr, this is mostly useless except if you want to directly acess python code that has OOP elements)
 
Last edited:
Level 6
Joined
Jul 30, 2013
Messages
282
Update:

created a pypi package..
(presuming you have python 3.4 installed)

JASS:
pip install jass_interpreter
.. will get you all the files

JASS:
python -m jass_interpreter <filename>
to translate a file.

this is strictly for usage tho, if you want to actualyl fiddle with the source i would still reccommend doing a git clone.
 
Level 6
Joined
Jul 30, 2013
Messages
282
Are you serious?

you downloaded JNGP (and ignored your antivirus to do that prolly)
you got jasshelper, tesh, a bunch of very hacky things..

you can live with havig your source files being gigant blobs that wont play well with source control..

you manage with dealing with all the quirks and manually managing all the dependencies..

But you won't trust the python software foundation??



Could you maybe .. please.. explain .. why ..?
 
Level 6
Joined
Jul 30, 2013
Messages
282
that is one of the most obvious uses, yes.

altho more generally it allows you to run jass2 code independently from the war3 game engine.
You could write actual useful programs if you wanted with this thing.

When the mock-jass-runtime gets further along it will have some merit as a unit-testing platform for jass2 code.

you could use it as part of your map build step do do some runtime computation (more support coming some time in the future i guess)
 
Level 6
Joined
Jul 30, 2013
Messages
282
Might as well make WC3 V3 while you are at it. The main reason such an interpreter has not been attempted before is that simulating the game state would require largely remaking the game anyway.

That's a good point..

Tho i intend to enable unittesting for at least small snippets of code (read: motivating reason for the entire project) so i need to make at least a good chunk of it.

If you would like to get some particular bit sooner, poke at me :p
 
Level 6
Joined
Jul 30, 2013
Messages
282
why would i do that??

nestharus' file io library already enables doing that + it opens potential security holes if you do that...

also this project is about running code outside of the warcraft 3 game. it may be used as a tool to run compile time scripts or to unit-test simple triggers or to just write code in jass2 if you have little experience with mainstream languages..

please stay on topic..
 
Status
Not open for further replies.
Top