• 🏆 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!

[Template / Terrain] Open Source WC3 ORPG "Template"

Level 4
Joined
Mar 8, 2006
Messages
27

WC3 ORPG "TEMPLATE"

Info

This is a wc3 project me and a few others were working on for a few months, but then Blizzard released 1.32 and caused issues with lua. We have since lost interest (and patience in Blizzard) in trying to fix it, so we've decided to open source the project in the hopes that someone might find it useful. There is probably something here that might be useful to someone, however the map itself will desync in multiplayer after a while.

It's not really a template, hence the quotes, but with a little coding you could easily turn it into your own project. Making spells is fairly easy (check src/spells/ and src/spell.lua). Making new heroes should be fairly easy (check out src/hero.lua), and making items/quests/vendors/drops is all done in a UI and doesn't require any coding.

Setup

Repo: mashlol/wc3-orpg
Requirements: Git, Node.js & MinGW
Git & MinGW: [https://git-scm.com/download/win](https://git-scm.com/download/win)
Node.js: Download | Node.js
Make sure node & npm (in C:\Program Files\nodejs) are in your `$PATH` . Add to the PATH on Windows 10 | Architect Ryan
You might also have to modify your wc3 executable path in `compile/build.sh`, since it only checks a couple of places.
Open the “git bash” file which you downloaded from the git website (Mines in `C:\Program Files\Git\git-bash.exe`). Run the following:
Code:
cd ~
git clone https://github.com/mashlol/wc3map.git
cd ~/wc3map/compile
npm install
cd ~/wc3map
./build.sh --no-min
Thats it! The map should start. If you make changes, rerun the ./build.sh part and it will re-compile and run the map with your changes.

Adding a house you can enter

First, add the house interior terrain in a corner of the map. Once you're done with the terrain and know which house it's supposed to be for, you just need to add some regions:
  • Add a region called house{[project]}enter[/project]{#}.
    • This region goes at the outside door of the house.
    • The first # should be incremental, find whichever the highest house is and increase it by one. For example, if the highest one is 2, yours should be 3.
    • The second number is incremental for the house itself. If your house has multiple entrances, you can increase it, starting at 1.
    • So a valid region would be: house3enter1
  • Add a region called house{[project]}entrance[/project]{#}
    • This region is where the unit will appear after they enter the house. Don't overlap it with any exits or they'll immediately leave!
    • The first number matches the first number above.
    • The second number matches the second number above. If you have multiple entrances, you'll need multiple of these regions as well
  • Add a region called house{[project]}leave[/project]{#}
    • This region is the interior door where they will leave from.
    • Numbers match from above
  • Add a region called house{[project]}exit[/project]{#}
    • This is where the unit will appear outside of the house after leaving.
    • Don't overlap it with any entrances or they'll just pop back in!
  • That's it, it's all in the editor, no code changes required. Build and test it out :). You can add multiple "enter" or "leave" regions for a single house, but they will need a corresponding entrance/exit region!

Using the UI to make changes to quests/items/drops/vendors

To use the UI for the first time, run the following:
Code:
cd ~/wc3map/web
npm install
npm start &
cd ..
./build.sh --no-min
Be patient with it, it may take some time for each of the steps. If things don't work, try running git bash in admin mode. For subsequent runs you can omit the `npm install` command.

Object Editor Information

We've done a few weird hacks to make things work.
  • Point value is actually the scale of the unit (* 100). So if their scale is 1.5, their point value must be 150.
  • The field Combat - Death Type actually means something different
    • Can raise - the unit is respawnable by normal measures, will respawn after 30 sec
    • Can't raise - the unit is either not respawnable, or in a dungeon so respawned as part of the dungeon
    • Does not decay - Means the unit is elite
    • Does decay - Means the unit is not elite.
  • The field Art - Use Extended Line of Sight actually means whether the unit will give EXP or not.
    • If it is marked as True, then the unit will NOT give exp!

Credits

@mash - Programming
@Magicon92 - A lot of terrain, quests, items
Spoon - Terrain, quests items
@Recklessabandon - Terrain, quests, items


WC3ScrnShot_111719_181007_001.png

WC3ScrnShot_111719_181207_001.png

WC3ScrnShot_111719_180836_001.png

ylbVtz4.png
 
Last edited:
Level 14
Joined
Feb 7, 2020
Messages
387
Booted it up. Hurray for git bash when you forget how to do basic command lines.

This could have been the next Gaia's Retaliation for Reforged. UI is very impressive and sleek and the unit control/spells are more interesting than the typical ORPG fare.

Shame on Blizzard's shoddy product release for causing so much abandonware.
 
Level 2
Joined
Mar 31, 2020
Messages
12
What problems came up with Lua, particularly concerning 1.32? I've been coding a map in Lua and I've heard vague things like this from a couple different sources but nobody has said what those issues actually are.
 
Level 4
Joined
Mar 8, 2006
Messages
27
> What problems came up with Lua, particularly concerning 1.32? I've been coding a map in Lua and I've heard vague things like this from a couple different sources but nobody has said what those issues actually are.

The map worked fine in 1.31 but desynced in 1.32. 1.32 removed `collectgarbage` which was what a lot of people suspected to be the issue. @TriggerHappy recently posted in discord that he has solved all these desync issues on his map though - I believe the issue is just that you cannot assume that `GetHandleId` will return the same result across every client. That means you can't use `GetHandleId` as a key for maps, or for any other situation that requires things to be in sync. Perhaps in 1.31 GetHandleId was synced, but in 1.32 it no longer was, causing this issue.

This discovery means it's probably not that hard to fix the desync issue in the code linked above. I probably won't be doing it, but I'd welcome it if anyone did.
 
Level 4
Joined
Mar 8, 2006
Messages
27
Hey, this is unavailable on Github, did something happen?

I put it back to private, going to try to fix the desync and _possibly_ pursue it further. Might go back public later though, we'll see. I really want to keep it open even if I develop it for real, however I'm not sure how I'd prevent spin-offs or sketchy fake versions if I did that. I might try anyway. We'll see.

If you need a clone of it let me know, happy to share a zip or something.
 
> What problems came up with Lua, particularly concerning 1.32? I've been coding a map in Lua and I've heard vague things like this from a couple different sources but nobody has said what those issues actually are.

The map worked fine in 1.31 but desynced in 1.32. 1.32 removed `collectgarbage` which was what a lot of people suspected to be the issue. @TriggerHappy recently posted in discord that he has solved all these desync issues on his map though - I believe the issue is just that you cannot assume that `GetHandleId` will return the same result across every client. That means you can't use `GetHandleId` as a key for maps, or for any other situation that requires things to be in sync. Perhaps in 1.31 GetHandleId was synced, but in 1.32 it no longer was, causing this issue.

This discovery means it's probably not that hard to fix the desync issue in the code linked above. I probably won't be doing it, but I'd welcome it if anyone did.

While the handle IDs can vary across clients they still point to the same agents/objects in the game. That means you can still use handle IDs as keys, as they won't affect the game state in a way that isn't in sync, because they still return the same objects. What you cannot do is iterate over handle IDs, as they might not return the same agents/objects in the iteration.
Just wanted to clarify this.
 
Last edited:
Level 12
Joined
Oct 10, 2009
Messages
438
LazZ is correct, I'm using HandleId's as keys in my maps an no desync. Just don't use them for any syncing natives essentially.
Do you happen to have your open source code lying around anywhere? I'm particularly interested in seeing how you've set up your UI. Examples on how to make hot, slick things are far and few between
 
Level 4
Joined
Mar 8, 2006
Messages
27
I made it open source again @Boar - shouldn't really have taken it off public anyway, should have just forked it if I wanted to continue progress.
 
Level 4
Joined
Mar 8, 2006
Messages
27
I don't know why, but I was bored so I spent a bunch of time debugging and eventually fixing the desync. If anyone is curious, it was a combination of 3 issues (which is why it was so hard to track down):

1. The GC module (Remove GC module · mashlol/wc3-orpg@c07542e). This was known that it would be an issue since GC is not synced, and it'll remove handles when lua does GC. This will obviously cause sync issues.
2. Iterating through tables using handle IDs as keys. This was also a known issue, as discussed above. My fix was to just synchronize the handles when the objects get created, see wc3-orpg/compile/header._lua at master · mashlol/wc3-orpg. Not ideal since we'll eventually overflow but realistically it'll probably never happen.
3. The difficult and weird one was that you don't seem to be able to just create a timer and invoke a method from war3map.lua. It works, but when you do it, you'll eventually desync, and I have no idea why. The fix for this was to just wrap all the custom code in a function and invoke it in the existing main() function inside of war3map.lua. Probably a good idea to invoke it after stuff like InitBlizzard() gets called.

The fixes are pushed to the repo linked above.

After all of that, the map no longer seems to desync, but it does seem to crash/freeze wc3 at some point. Not sure yet if I'll spend the time tracking that one down...
 
Top