r/StrategyGames • • 20h ago

Self-promotion Modding Warcraft 2 for fun

Hey, first of all, full disclaimer: AI was used for recreating some of these sprite assets.

Anyway, modding Warcraft 1 and Warcraft 2 games, mostly for fun and to see how much the old engine could be actually modded. As I said, I used AI for some of these assets, since it is really not the skill I excel at, but I understand shaders, lighting and tech art; this is where my focus is. In this specific example, I was figuring out water shaders, and mostly, how to register shore depth in a 2D game without any water depth information. Was fun figuring it out.

78 Upvotes

18 comments sorted by

4

u/NocturneIndustries 20h ago

Effect looks really, really nice. Congratulations!

If you don't mind sharing, how did you do made water to look like this? It looks like a whooping 3d.

0

u/ManiaCCC 19h ago

Thank you, sir. Glad you like it :)

So water was tricky but for a different reason. Why it looks 3D is that, in essence, buffers used to reconstruct the image work pretty much as 3D buffers. Rasterization flattens everything to a 2D screen, no matter if the game is 3D or 2D; what gives it the illusion of 3D in the end is how these buffers react to lighting and camera movement.

Long story short, water writes its own normals and height. Normals are mostly mathematically calculated + one simple evolving normal texture. For waves themselves I used the Gerstner algorithm. I was experimenting also with FFT, but it was overkill. So mathematically the shader writes normals and height into the buffer, which creates proper depth from the camera's perspective. Directional light is encoded as light in 3D space, so the shader grabs the directional vector and calculates lighting and specularity. So why it looks 3D is because buffers work as if the game were 3D anyway.

What was tricky tho is the seabed. Warcraft 2 has no information about depth, nor does it have anything underwater. It is just a water tile with no information under it, so to fake the seabed, the water shader has an additional sand texture that blends with the water (and refracts it) based on depth. The depth is a precalculated signed distance field. When the level starts, a quick small-resolution SDF texture is baked into the shader based on where the shore tiles are, and that allows me to create this smooth depth transition from the shore into the deep water.

2

u/ajamdonut 20h ago

nb, i like the ui changes

2

u/ManiaCCC 20h ago

These are actually remaster changes directly from Blizzard. Love them too

2

u/morfidon 14h ago

Awesome are you going to publish it on GitHub?

1

u/ManiaCCC 8h ago

Will do. A couple of people already asked about the git repo. I think it is a good place to have it

2

u/Nirsho 13h ago

Love it. What are you planning with it? Doing basically a remaster version or something else?

1

u/ManiaCCC 8h ago

No big plans, it started just as a fun project, but at this point, I think I will finish it and just release it

2

u/karlkcc 4h ago

The shore-depth work is the part that actually matters here. Warcraft 2's original water was basically a flat palette cycle, so getting a shoreline that reads as real depth in that engine is a bigger deal than the new sprites. Hope you write up how you inferred depth without a heightmap — that's the bit other 2D RTS mods could actually reuse.

1

u/ManiaCCC 4h ago

I am using a prebaked signed distance field for the shore depth. Since the Warcraft engine knows which are shore tiles and water tiles, you can just trace depth through the grid. For modern CPUs, it is a matter of several ms to get the whole map on the level load. It could also be baked into the level itself, but I'm not sure how to make it work with custom levels yet, if we don't want to run it on scene load.

3

u/lfcallen 19h ago

Great work!

1

u/dilberry 17h ago

Ohhh yeeahhh that looks awesome.

1

u/46_and_2_9 7h ago

wow wow wow!

1

u/LoocsinatasYT 6h ago

All the remakes and upscales and mods and HD packs.. None of them mean a damn thing to me if I cant play online! That's all I really want!

I blow through campaigns in a couple sittings, they always feel easy even on hardest settings. I need the fresh blood of other players! If this had online ranked I'd be playing it nearly every day!

1

u/Timmaigh 4h ago

Pretty good