Reverse Engineer Game.dll

Level 12
Joined
Mar 13, 2012
Messages
1,121
Unfortunately, I don't know what you can do with it :(
Could have to do with Windows 10 or DirectX 12? Or maybe Avira Antivir?

Hopefully that doesn't discourage you, would be happy to see progress!
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
Disabled Avira, no effect.

No idea how to run an .exe in compatibility mode from command line.
edit: Ok, disabled Avira and set compatibility of Sharpcraft.exe to Windows 7, hoping that the start by command line also uses this setting -> still the same problem.

edit2: I think we're coming close!

First mind that all screenshots and experiments so far were done with a copy of my main wc3 folder.
I started Sharpcraft(Multicraft) in my main Warcraft 3 folder and it wanted to know where the war3.exe is, so I directed it to the main folders war3.exe.

After trying to start RenderEdge in the copied folder again, the error is a bit different. Notice how it somehow tries to find Nirvana.exe in the wrong folder (namely my main wc3 folder which has none of those mods in it). Is there a registry setting or something comparable that Sharpcraft uses?

edit3: Ok, the normal Sharpcraft seems to use the InstallPath in "(Current User)Software\Blizzard Entertainment\Warcraft III" or if not found "(Local Machine)SOFTWARE\Wow6432Node\Blizzard Entertainment\Warcraft III". I changed it temporary to the copied experimental wc3 path and everything works now!

That means it was/is a problem with SharpCraft. Imo it should only check whether there is a war3.exe in it's parent folder and not via registry keys..
 
Last edited:
Level 19
Joined
Dec 12, 2010
Messages
2,067
not to speak WC3 works on single core and can't do parallel calculations. it will have greatly less speed than modern games which actually support multicore systems.

but even on single core it's speed amazingly high, if you ever know about jass. nowaday games hardly optimizied and can lag even on NASA computers, regardless core amount.
 
not to speak WC3 works on single core and can't do parallel calculations. it will have greatly less speed than modern games which actually support multicore systems.

but even on single core it's speed amazingly high, if you ever know about jass. nowaday games hardly optimizied and can lag even on NASA computers, regardless core amount.

What does Jass have to do with it? Warcraft 3 was coded in C++.
 
Level 8
Joined
Nov 29, 2014
Messages
190
Now I understand what's wrong with the lighting and why don't work the standard shaders, the answer here. So you will get similar problems with lighting:

Snimok.png



But this problem can be avoided by importing .3ds/.fbx /.x mesh instead of using the standard .mdx models.
Based on the first conclusion, I redid the ParallaxOcclusionMapping effect. Now POM works fine, but only on flat objects.

Nirvana_2015-09-12_19-45-26-07.png

Nirvana_2015-09-12_19-52-39-31.png



Also, you can download the new version and see everything by yourself.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Now I understand what's wrong with the lighting and why don't work the standard shaders, the answer here. So you will get similar problems with lighting:

Snimok.png



But this problem can be avoided by importing .3ds/.fbx /.x mesh instead of using the standard .mdx models.
Based on the first conclusion, I redid the ParallaxOcclusionMapping effect. Now POM works fine, but only on flat objects.

Nirvana_2015-09-12_19-45-26-07.png

Nirvana_2015-09-12_19-52-39-31.png



Also, you can download the new version and see everything by yourself.

I didn't look at your mod and you didn't show any code, but actually one normal per vertex is enforced on the GPU level (not the best way to describe it, but I don't want to get into vertex attributes and GPU shaders). If some software allows you to have multiple normals, it's because it has multiple vertices behind the scenes.
With that said, I don't see how this should be any issue if your code is written properly, since every game model ever has exactly one normal per vertex.

Also your second image isn't showing.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
What do you mean not agree? I wrote that this constraint is there not just for WC3, but literally for every game or software ever.

If you want to use models with formats like OBJ that share data, you will need to flatten all of the shared data. Again, if it just seems to work in software (e.g. 3D modeling tools), that's because this is hidden behind the scenes.
 
Level 8
Joined
Nov 29, 2014
Messages
190
Sorry, I just didn't understand you at first.

I think the adding support of .3ds/.x meshes is not difficult. I recently found a graphic modification for the game Gothic: Transfer render of games with Direct3D7 to Direct3D11. It was also supports .3ds hi-poly meshes.
 
Level 8
Joined
Nov 29, 2014
Messages
190
Update
  • Correctly lighting:
    - New BumpMapping effect;
    - Working Specular;
    - Avoid unification of normals;
    - Tangent calculation;
  • Added water effect;
  • Added support of Point and Spot light;
  • Solved the problems associated with lighting.

Problems

  • Strong freezes caused by the transfer of data from the original to the new vertex buffer in real time.

Screenshots

Nirvana_2015-09-26_17-12-48.png

Nirvana_2015-09-26_17-13-55.png

Nirvana_2015-09-26_17-17-45.png

Nirvana_2015-09-26_17-25-58.png

Nirvana_2015-09-26_17-27-35.png

 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Strong freezes caused by the transfer of data from the original to the new vertex buffer in real time.

What kind of hackery do you use to take rendering control from the engine? If you have direct access to the models, you should handle rendering yourself with shaders (which you probably already do), and do hardware skinning in the vertex shader, assuming that's the reason you update the buffers.
 
Level 8
Joined
Nov 29, 2014
Messages
190
in real time
Lags appear only when the frame is a lot of primitives.
Later I will do the transfer of data only at the beginning, during the loading. Or I will not use the standard models of wc3 that will be better and easier.

I get information of WarCraft primitives and data of vertices, do calculation of tangents and transfer of data to new vertex buffer then wc3 calls DrawIndexedPrimitive8 method. If you want to know more and watch to code, see last post from here.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
Thanks for the update!

Maybe it's only me but the water doesn't look too good (though it's probably just an example). Somehow like an ocean from birds view or a blanket made of plastic.

If you are taking the rendering from wc3 and doing some of it in your own thread does this mean that you could achieve something similar as in sc2 (separating graphics and gameplay in two parallel threads) and improving not only graphics but also performance?

Man hopefully we will be able to look at some github code someday!
 
Level 8
Joined
Nov 29, 2014
Messages
190
Yes, it's simple ocean effect, water is only an example, it not working correctly, but only now, later I will fix it.

If you want to know more new information, see 90 and 92 post from XGM (sorry there are a lot of words, so I don't translate it).

I do not know if I can do separating graphics and gameplay in two parallel threads or not, but now there is good performance.

Open source code will come after I finish that planned, so everybody will be able to make it better.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 60
Joined
Jan 18, 2005
Messages
26,837
and why's that
Scene complexity and number of actors. Although modern RTS games can give you good quality graphics they cannot give the same scope that an RPG/FPS engine would because they have to function very differently. Where as RPG/FPS engines can reduce scene complexity to within the scopes of what your character is doing, RTS games cannot and need to be managing all state context all the time.

The best example would be standing in the middle of a 480*480 sized WC3 map and looking towards one of the corners. Assuming an angle of view such that you can see exactly a quarter of the map that would be 115,200 triangles per frame to compute just for ground geometry. Sure Z far clipping will greatly improve performance but then your game will look like it is from 1995 as you want it to feel open and expansive. Modern RTS games like SC2 improve on this with some form of rough level of detail system so that terrain not near the camera is rendered at a lower quality best seen in the editor when zooming far out. RPG/RTS games on the other hand specifically optimize to get such views that look as good as possible and perform as well as possible, to the point that more expensive assets might be removed or modified to enable the view to be viable

Sure modern RTS like SC2 are capable of impressive graphics. You must remember that they were built from the ground up to be able to perform them. Something a hacked version of WC3 was not. Trying to get WC3 to do the same thing will likely perform a lot worse than SC2 because it has not been as well optimized or designed around such features.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
for first, put these giant images into hidden tag. Also, I think(and I noticed you posted here multiple times before) this is very bad place for you to post these, I dont really think this has much to do with reverse engineering the game.dll(game.dll is probably not really related to rendering the game too much either, but I could be wrong)
 

Dr Super Good

Spell Reviewer
Level 60
Joined
Jan 18, 2005
Messages
26,837
Googling for pseudocodes and game.dll might lead to a site that leads to another site that leads to a file that may or may not be interesting...
Google results are different for everyone and vary depending on region so that is not really helpful.

So people know, WC3 uses the fixed pipelines to render which limits the maximum quality/performance one could achieve.
 

pyf

pyf

Level 31
Joined
Mar 21, 2016
Messages
2,986
Google results are different for everyone and vary depending on region so that is not really helpful.

So people know, WC3 uses the fixed pipelines to render which limits the maximum quality/performance one could achieve.

This is the page for which I hinted :
http://www.d3scene.com/forum/warcraft-3-hacks/109852-game-dll-1-27a-1-26a-pseudocodes.html

Now, I am new here. I do not want to go against the rules of the Hive Workshop, nor upset Blizzard.

Googling for pseudocodes "game.dll" and filtering results within the last month, gives only the link provided above, at least for me.
 
Level 8
Joined
Nov 29, 2014
Messages
190
I was not planning to write here the news about my project before its release, but since A Void asked, I finally decided to write the latest news.

After I wrote the last comment in this topic, a lot of things changed in RenderEdge:
  • Added Physically Based Standard Shader;
  • Support of majority model formats, such as .obj, .3ds, .dae and .blend;
  • Soft Cascade Shadow Mapping;
  • HDR Rendering and post-processing;
  • Atmospheric Scattering;
  • AntTweakBar integration.

VbZdCwW.png

babC4CG.png

YMdd7mD.png

kYYcxtL.png

hNYJePP.png

0kjf3PQ.png

cAscrZH.png

Gm8EERp.png

3akxEdQ.png

JSVRaG7.png

zM6gFbA.png

7Ry3hek.png

dxb1wRf.png

8kAGQyS.png

NvTWFT7.png

aFJYjJ8.png

0fY6kIP.png

YOvEX3m.png

mWaR2g6.png




The first version I made to improve my skills and understand what's inside WarCraft. Now I started to create the second (main) version of RenderEdge.
Features:
  • Vertex Lighting replaced by Per-Pixel;

    LuNzPea.jpg

    OpFzRDZ.jpg

  • Linear value of Ambient Lighting replaced by values from Irradiance CubeMap;

    OpFzRDZ.jpg

    XjpT7VJ.jpg

    kqVTBML.png

    O7DAZfY.png

  • Maybe Normal Mapping;
  • Soft Shadow Mapping;
  • HDR Lighting and post-processing;

    IZvzxyA.jpg

    kN60S5J.jpg

  • GUI Rendering System;

    k4O68gx.jpg

    2pIOs6B.jpg

    IgXs5SA.jpg

  • Data exchange between my library and WarCraft. Calling library functions by Jass;
  • The possibility to completely hide standard interface.

    Tia6n1d.jpg


I'm working on new version together with Alexander (his mod and an article on how to add your own functions to WarCraft without using custom natives).
I completely abandoned SharpCraft, since implemented most of its functionality at my library (sorry MindWorX).
Alpha version will be released after I will complete GUI System and add the possibility to call the functions by Jass.
Now only implemented Input System, which works on jass. To call other functions from library, I have to add custom natives, but it is not yet implemented.

And video (although it's the first version of RenderEdge, combined with the standard rendering of WarCraft):
 
Last edited:
Level 12
Joined
May 20, 2009
Messages
824
Oh my god. Who knew this thread I made nearly a year ago would achieve something like this. How well does this perform? I have a particularly low to mid-grade PC that can barely can to not be able to at all play modern games. With this would I get shit performance?

What else have you been working on, as well?

Also, what Visual Studio version does your mod/the version of Nirvana you're using use? I get VCRUNTIME140D.dll and ucrtbased.dll missing. (I don't have the 4.0 that Nirvana requires. It'd be a pain to downgrade.)

So how would that work in the end? We replace the game.dll with a modified version and get all the goodness or is it *way* more complicated than that?

Because I have to say this looks amazing!

I'm not totally sure what they're doing. It looks like they're hacking multiple things together. A lot of the stuff they're doing here is definitely handled by Game.dll and they're taking direct control over it. So I think it's relevant to this thread.

And yes, that was the idea for this thread. A game.dll to replace the current one WC3 uses is built by the community. This way, we can directly work with a source code to modify existing WarCraft III content, instead of having to search through Assembly/Machine Code to change what we want to change (Like say for instance, changing the position of the idle worker button or the hero icons, which are built in game.dll). While this would be an extensive project, it would result in something that'd be much easier to work with for modders that don't have extensive experience in Assembly
 
Last edited:
It's not game.dll it's a custom .exe and a custom library that .exe injects into Warcraft 3 (like SharpCraft or Reinventing the Craft). Official multiplayer will not be possible and it will have a huge performance drop on older computers.

New interface is drawn on top of the old one, since old one can't be removed (or edited) and black bars were removed by rendering the game screen using ZUKMAN's hack that the author modified in his library. Basically this will be good for single player projects. :)

Edit: It would be great to have GUI functions after you complete creating the natives.
 
Level 8
Joined
Nov 29, 2014
Messages
190
Yes. I've already implemented feature for adding custom natives in WarCraft. I also almost completed the development of GUI system, but still need to get rid of a few bugs (for example, when resizing GUI controls with .blp texture, they become transparent) and add some more features.
At the moment added these custom natives:
JASS:
native int  GetMouseX();
native int  GetMouseY();
native float GetMouseTerrainX();
native float GetMouseTerrainY();
native float GetMouseTerrainZ();
native bool IsMouseOverUI();
native int  GetWheelDelta();
native void SetMousePos(int x, int y);
native void TriggerRegisterMouseWheelEvent(trigger trig);
native void TriggerRegisterMouseMoveEvent(trigger trig);
native void TriggerRegisterMouseEvent(trigger trig, int iButton, int state);

native int  GetTriggerKey();
native bool IsKeyDown(int iKey);
native void TriggerRegisterKeyEvent(trigger trig, int iKey, int state);

native float FPS();
native float DeltaTime();
native int  GetWindowWidth();
native int  GetWindowHeight();
native void TriggerRegisterWindowResizeEvent(trigger trig);
native int  COLOR_ARGB(int a, int r, int g, int b);
//native void ShowCursor(bool isShow);
//native void EnableDebug(bool b);

native void CtrlCreateInstance(int id, int left, int top, int width, int height);
native void CtrlSetText(int id, bool autoResize, string text, int argb);
native void CtrlSetColor(int id, int argb);
native void CtrlSetTexture(int instID, string filename);
native void CtrlSetRect(int id, int left, int right, int top, int bottom);
native void CtrlSetPosition(int id, int x, int y);
native void CtrlSetCallback(int id, trigger trig, int iButton, int state);
//native void CtrlDelete(int id);
native void CtrlShow(int id, bool isShow);
native void CtrlSetInteractive(int id, bool isInteractive);
native int  CtrlGetSelectID();
And now I'm trying to implement a widescreen support such as in W3Arena:

0c7b3bfe0c20493b875716f5a2467e18.png

a4c2c6eaae9c4801874f0cf31f002289.png

 
Last edited:
Level 8
Joined
Nov 29, 2014
Messages
190
black bars were removed by rendering the game screen using ZUKMAN's hack that the author modified in his library.
No, it's not ZUKMAN's hack, it's my own solution. ZUKMAN changes the aspect ratio of the projection matrix while maintaining original proportions of the playing area, while I stretch it under the game interface.

it will have a huge performance drop on older computers.
No, you're wrong. Performance does not be affected. This is only possible due to the fact that I have not yet found a way to use normal maps, besides transferring the data from the original vertex buffer into a new in real time, but I will fix it.

New interface is drawn on top of the old one, since old one can't be removed (or edited)
No, now it is not so, I can easily change the order of rendering and draw new GUI elements under the old interface. I did so, that the GUI rendering occurred before drawing the cursor and game menu, so the new GUI elements became almost integral with the originals. Standard interface can also be changed, for example, you can move or resize the minimap.

Also, what Visual Studio version does your mod/the version of Nirvana you're using use? I get VCRUNTIME140D.dll and ucrtbased.dll missing. (I don't have the 4.0 that Nirvana requires. It'd be a pain to downgrade.)
I use Visual Studio 2015. And I no longer use Nirvana. I rewrote the mod from scratch using ReShade d3d8to9 converter as a basis.
 
Last edited:
Level 4
Joined
Sep 6, 2010
Messages
86
No, now it is not so, I can easily change the order of rendering and draw new GUI elements under the old interface. I did so, that the GUI rendering occurred before drawing the cursor and game menu, so the new GUI elements became almost integral with the originals. Standard interface can also be changed, for example, you can move or resize the minimap.
:vw_death: This already goes beyond my expectations ...
Greetings...(Great contribution ENAleksey, hehe, war3 still has for more. :smile:)
Note: A question, is it possible to change the position of the UI within of the game and change your skin on time real?
 
Last edited:
Level 8
Joined
Nov 29, 2014
Messages
190
By the way, the alpha version is ready and you can already download it!
This version doesn't show the final result and can contain a lot of bugs. Release version will probably contain a very large changes in the things that have already been implemented.
A separate topic on the Hive will be created, but later.
  • Download RenderEdge (you can extract a folder anywhere on your computer);
  • Download example map with simple implementation of custom UI rendering
war3 2016-06-12 21-57-13-45.png

An indicator that the mod was successfully launched is label "RenderEdge v0.0.1a" in the upper left corner of the screen. If it doesn't appear, restart mod, this sometimes happens.
If nothing changed or an error occurs during startup, you may have not spelled the path to your WarCraft folder in the registry (RenderEdge search it here: Software\\Blizzard Entertainment\\Warcraft III\\InstallPath or InstallPathX).

You also can add new tab in your JNGP to launch RenderEdge easier by editing wehack.lua:
  • Add this code before testmap function:
Code:
-- # begin RenderEdge #
haveRenderEdge = grim.exists(path.."\\RenderEdge.exe") and grim.exists(path.."\\RenderEdge.dll")
if haveRenderEdge then
    RenderEdgeMenu = wehack.addmenu("RenderEdge")
    RenderEdgeEnabled = TogMenuEntry:New(RenderEdgeMenu,"Run with RenderEdge",nil,true)
end
-- # end RenderEdge #
  • Add this code in beginning of testmap function:
Code:
if haveRenderEdge and RenderEdgeEnabled.checked then
    local pos = string.find(cmdline, ".exe")
    cmdline = string.sub(cmdline, 5 + pos)
    cmdline = path .. "\\RenderEdge.exe " .. cmdline
end
 

Attachments

  • RenderEdge.rar
    673.6 KB · Views: 141
  • [RenderEdge] Test Map.w3x
    54.9 KB · Views: 159
Last edited:
Level 8
Joined
Nov 29, 2014
Messages
190
I tried it, but there are some problems, for instance meshes cast shadows only on themselves. In the future I will try to fix it.

BTW, there is current TO-DO list:

  1. GUI Rendering System:
    • (+) Base system;
    • (+) Jass handling;
    • (-) Controls sorting by depth;
    • (-) Multi-line text;
    • (-) TTF fonts support;
  2. Post-processing:
    • (-) HDR rendering;
    • (-) Post-effects;
    • (-) Jass handling;
  3. Advenced Lighting:
    • (-) Per-pixel lighting;
    • (-) DDS support for .mdx/.mdl;
    • (-) Ambient cubemap generation;
    • (-) Shadow mapping;
    • (-) Normal mapping;
 
Last edited:
Level 4
Joined
Sep 6, 2010
Messages
86
If you mean the custom interface, then yes. The standard interface can be hidden, and then it can be recreated using custom functions, after that it is possible to dynamically change it during the game.
Great, this I commented as they could do something like this, playing only with the user interface:
00d40c370cb5ab25bc2e66a23a146a0bo.jpg
(Although it is only an image XD , this could be done)

Although it is an alpha, it is very powerful what you can do with this tool, great contribution. :cool:
Greetings... (Yet not I know if this will work for multiplayer, the good news is that almost all the requests on the wish list for new patches warcraft 3 with respect to the UI, would be marked as possibly achievable. :D)
 
Last edited:
Level 39
Joined
Jun 23, 2007
Messages
4,058
No it doesn't require SharpCraft, "I completely abandoned SharpCraft, since implemented most of its functionality at my library". But maybe it still compatible with SharpCraft.

I know it doesn't require it. I said it used to.

Anyway I tried this out and it said it couldn't find my War3 path (yes i have a registry key for it).
 
Top