HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Go faster stripes

11-18-2007, 07:15 AM#1
PipeDream
Here's a from scratch and (intended to be, at least) compatible implementation of the JassVM. Enter it through
Collapse JASS:
call Cheat("funcname")
Use by injecting warmachine.dll in grimoire's ongameload.lua.

It supports enough JASS to run the constraints demo map I posted recently.

In a silly benchmark of adding and multiplying in a loop, it was 3.3 times faster than the blizzard VM.

Notes/Limitations:
  • No TriggerSleepAction(). Not fixable.
  • Globals aren't as fast as everything else, because it uses the built in hash tables. I don't know if this is necessary. It makes it easy to use both VMs side by side anyway.
  • Bad transparency-requires map modification. fixable.
  • Locals aren't reference counted. Fixable if it becomes sensible to do so.
  • Return bugs may not work right. HtoI does have a bandaid.

Source is in the grimoire SVN
Attached Files
File type: 7zwarmachine.7z (71.9 KB)
11-21-2007, 09:56 AM#2
PitzerMike
From what I understand the "funcname" must not take any arguments or return a value. And by replacing call MyFunc() with call Cheat("MyFunc") all code inside the function and calls spawning from there will be executed in your faster VM.
I'd say it can be quite useful for heavy initialization functions and mathematical calculations (eg physics engines ...). Input/output would have to be passed via globals?

However, I couldn't quite get it to run. The log says the Op signature couldn't be found. Here's the log.

Code:
symtable offset: 2854
War3_497: 4400c0
SMemAlloc: 15027db0
SStrHashHT: 1503bfa0
NativeStrGet: 6f2b0b30
strget: 6f6a2000
getnativestruct: 6f6a2030
jString_of_char: 6f6b1ca0
nstr_of_jString: 6f6b1c80
nativename: Cheat
hooknative: 8ef4510
hooknativedata: 57e58955
nativenameaddr: 6f815630
regaddr: 6f2b036a
war3_native: 8e44a1c

Error: Op signature not found

Since this is supposedly part of the warmachine initialization I guess details about the map/code that i used won't matter.
I have 1.21, no cracks, etc...

I'm impressed anyway.
11-21-2007, 11:22 PM#3
PipeDream
I forgot to mention you need to disable war3err.

I don't intend to support jumping to functions with args because the goal is to have all code run under it. Since you always start with an empty stack... We do have the description of the blizzard stack though so it could be done.
11-28-2007, 09:22 AM#4
PitzerMike
Thanks. Without war3err the error goes away.
12-02-2007, 02:12 AM#5
PipeDream
Step 2, transparency. It now runs your code with out intervention. Assorted bug fixes, most importantly TriggerEvaluate(). There's still _something_ broken since it can't run <init>, config, or main, but I have yet to find out why.

To try, place dll in grimoire/bin. Disable war3err in newgenpack menu. Add line to ongameload.lua: loaddll("bin\\warmachine.dll"). Watch as your code runs faster or, preferably, crashes so that I have a test case to figure out what is still wrong.
Attached Files
File type: 7zwarmachine.7z (35.5 KB)
12-02-2007, 11:07 PM#6
Toadcop
it's fucking awesome !
I was right than i decided to expand TcX to a mod. so i can use all advantages of Grimoire (load mpq JAPI) and here the new imba =) a new MV so the map will run awesome smootly. (btw it's possible alsmot completly to replace the blizz one ? (yes config and main may by runed under default VM) but the rest ? i mean use some more advanced vars/arrays...)

but well :'( currently it doesnt work on my sys =( it's simply doesnt happen anything. here the log.
(i use call Cheat("myfunctocall") and for test i call a echo to display message and nothing happens.)

if this will work stable enough i will completely move to mod development so i could use the full potential of this fucking awesome features ^^.
omg... Bryan you are BEYOND GODLIKE ! ^^ :beer:
Attached Files
File type: rarwarmachine.rar (581 bytes)
12-02-2007, 11:40 PM#7
PipeDream
In the last DLL posted, Cheat() just logs. All code except that spawned from <init>, config and main runs under the new VM. If warmachine.txt appears and map code is running, then it's working.
12-02-2007, 11:49 PM#8
Toadcop
omg i am confused >.<.
ok
1) i am included warmachine into ongameload.txt (or lua =\)
2) i am run war3 with grimoire and it works well
3) DO I NEED TO CALL Cheat ? O_o ? or does it simple work from begin ? (the new VM)
hmm ok i will test. (yes how you can see it create a warmachine.txt file ^^)

!!! yeah ^^ it does work ! AND I CAN CONFIRM what it does call functions ~3x times faster !!!
but the vars are not get pushed ? =( it's possible to increase var,array speed ?

and yeah maybe a lil bug report =) save the game and load it ^^ (the VM will strike) aka nothing will work (jass)
anyway it PAWNZ !


hmmm =( it does crash the game =\ here (also it seems to don't like Multiboards) (Press Esc to run test (push it several times))
Attached Files
File type: w3xCrashing.w3x (103.8 KB)
File type: rar2007-12-03 03.07.50 Crash.rar (3.8 KB)
12-03-2007, 12:48 AM#9
PipeDream
Quote:
but the vars are not get pushed ?
I don't understand
Quote:
it's possible to increase var,array speed ?
Locals and local arrays are fast. Globals and global arrays are slow in the hopes of supporting BNet and save games. Yes, they can be made faster.

Thanks for the map.
12-04-2007, 10:01 PM#10
Toadcop
Quote:
but the vars are not get pushed ?
are they "faster" ? =) // aha ok understand.

Quote:
Yes, they can be made faster.
hmmm what would be great... and btw if it would make much complications (to keep default globla vars/arrays "possibilitys") so you could add new globals type ?
Code:
globals
  x integer myint=0 // ? or something. so it would have a back compability with the standart globlas and this would be the faster one.
endglobals

well anyway global arrays are keeping the important data ^^
// btw is math faster ??? (in your VM)
// also i will check now your "No limits" it sounds awesome.

// btw it would be possible to log (save into a file) the values of globals vars or ? (i think about "Custom Save/Load"...) jass have on save load events.
save runs BEFORE the map get saved.
and load event runs before the map starts (at the end of loading)
so it could be used...
// can't wait to use this features in practise :P
btw
Quote:
of supporting BNet
you mean due some anti hacks etc (on Bnet servers) ? hmm in theory you can don't care about it cause players may use GGC or something to play online (imho) and in most cases it's also better than Bnet.
12-04-2007, 11:05 PM#11
MaD[Lion]
one question, im not sure what this is about. but i like the word faster :D so i wanna know will this "whatever it is" work on bnet. if it does, then i would like to learn more what we are talking about here, and how to use :)
12-05-2007, 01:26 AM#12
PipeDream
My VM replaces a method on the blizzard class. It's intended that the state when the method exits be identical to what it would be if Blizzard ran. Save game and BNet should just work because they happen between JASS executions where the game has no idea that anything different happened.

I'm not sure what you mean by new globals type. If you are only concerned with optimizing, don't worry about it. They are only slow because I haven't rewritten blizzard's routines for setting global variables.

Yes, math should be fast.

Save globals: If you want to save them for debugging purposes, you can do this with war3err: Cheat("Dump_GlobalHT") or something like that. Check the manual. If it's a suggestion for how to get save/load working, I will probably have to go at a lower level. But I think save/load should just work, the problem right now is that the map code doesn't get recompiled.

BNet: I was worried about multiplayer period because of issues like globals synchronizing.
12-05-2007, 09:40 AM#13
MaD[Lion]
oh, so this means only the people using ur VM will have the advandtage of this? Example in a bnet game, only players who use ur VM will get better performance (on somethings)? Or is this a global thing, that u can implement into a map and everyone become faster when playing tat map
12-05-2007, 10:27 PM#14
Toadcop
Quote:
BNet: I was worried about multiplayer period because of issues like globals synchronizing.
hmmm globals don't need to be synced ^^ + btw DO YOU MEAN WHAT YOU VM WILL NOT "KICK" PLAYERS !? if global data is different O_o OMG ! IT'S WOULD BE BRILLIANT ! ^^ (no really) it would allow alot of awesome features ! (yes cheating... but you will not use Grimoire to run some melee maps ;D so you can add custom anti cheat protection.)
well anyway Grimoire rules !

MaD[Lion] this stuff is only for true fathers xD
so go away Simple war3 map creator :P
well it's a joke but it's true. this makes only sense in a war3 mod. no there else.
so say "bye bye" or do you have decide to make a mod ? =)
well if yes so you can use it.
(//btw it's a Grimoire "addon")
12-06-2007, 12:01 AM#15
PipeDream
Mad: The VM does the actual JASS execution, so it only helps you if you are running it to play the map.

If you're making a mod I would suggest writing everything in C++, or through C++ any other language.