Wing Commander Prophecy: Unlimited

gr1mre4per

Rear Admiral
Hi All,

As you may have seen in @DefianceIndustries WCP:MUP thread I have been working on extending or removing some of the upper limits in the Vision engine.

It all started when I seen that DefianceIndustries was working on high definition models and slicing them in to parts to stay within Visions mesh detail limits. This method, although ingenious, has some issues, especially when working with cap ships, so I decided to try and find out why the game crashes when models are too detailed. After finding the cause and creating a fix I decided to expand to other limits that are hit when pushing the engine.

The idea is this dll can be used in new or existing mods to enhance the experience. The dll is compatible with Prophecy, Secret Ops CD and Secret Ops web release. Let me know if you are interested.

So far this is what I have:

* Maximum normals (NORM/VTNM) per mesh increased from 1024 to 9999999
* Maximum renderable objects increased from 256 to 30000
* Maximum number of different types of objects increased (ships, bullets, asteroids)
* Memory Management modified to allow the limit increases
* Frame rate can be changed via config file
* Frame rate counter can be enabled via config file

The intention is to continue to develop this patch, not only to extend limits as they're found, but to be able to modify options via the config file that were previously not configurable through IFF files. Ideas and suggestions welcome.

Here's an image of what this patch is able to do.

shot0000.bmp


60,000 triangles and running at 140 fps. This engine has a lot to give.

Special thanks to @HCl for his dll patching tutorial and @DefianceIndustries for helping with early teething problems with the dll.
 
Last edited by a moderator:
What you're describing is everything, literally everything I aspired to do after hitting limit after limit with the engine. Very, very, very good work. From what I gather you're gonna need to ship out a modified Secretops.exe (and Prophecy.exe for obvious reasons) that loads up your new unlimited .dll file, plus the .dll file and any config files you created associated with it.

When and if you do, I'll be very happy to open it up and take a look at how it ticks. You succeeded where I failed and I'd really like to see how.

My only suggestion would be to extend the draw distances for things like capships, asteroids, and (optionally) ships like Piranhas and Morays. There's a example of how to do this in Unknown Enemy's released .dlls so you can copy it over and change it however you need to. I don't recall if Standoff had a modification that made it so all ships only had one LOD at all times, as well.

Again, really, really great job.
 
Great stuff! Strong potential to make the Vision engine just a little bit less obsolete :).

I would certainly love to integrate this into UE, as it could help make the update quite a bit more interesting - not so much for Standoff, where it's best to leave the graphics as they are.

Now, if only we could somehow implement animations, so that those extreme polycounts could be used to create live-rendered cutscenes with people... :)
 
My only suggestion would be to extend the draw distances for things like capships, asteroids, and (optionally) ships like Piranhas and Morays

I second that. If we could configure LOD 0 draw in distances in the config file, it would be huge. Watching the Midway draw in a section at a time is agonizing. :)
 
Awesome work! I personally won't be able to make use of it but I can't wait to see what fan mods come from this.
 
A battlestar in wing commander now there is a carrier that can fight

My intention is to laden the Galactica with a full complement of turrets including the point defence. This does require extending the current limit of 32 turrets per cap ship which may be possible in the near future. I've only had a small investigation and found the memory is pre-allocated and not dynamically allocated so needs some thought for a solution.

My only suggestion would be to extend the draw distances for things like capships, asteroids, and (optionally) ships like Piranhas and Morays. There's a example of how to do this in Unknown Enemy's released .dlls so you can copy it over and change it however you need to. I don't recall if Standoff had a modification that made it so all ships only had one LOD at all times, as well.

I second that. If we could configure LOD 0 draw in distances in the config file, it would be huge. Watching the Midway draw in a section at a time is agonizing. :)

There are a few things to look at here.

In Prophecy @HCl's wcphr.dll already deals with the sky box range. This is where the ship seems to appear from behind an invisible wall. I can easily put in SO.

The next is the LOD ranges. Standoff easily deals with this because all of the models only have one detail level. The different mesh detail levels are part of the mesh iff files and are visible depending on the values in the RANG or SUPR chunks. @DefianceIndustries MUP will also only have one detail level in the mesh so will be fine. For WCP's stock models I should be able to intercept the code that looks at the RANG and SUPR chunks and fool it in to always using the highest level. Again I think HCls wcphr.dll may already do this.

Finally there is the FAR chunk. This is for fighters and is the range at which the mesh disappears and becomes a dot on the screen. A simple interception of the code should be able to ignore this.

What you're describing is everything, literally everything I aspired to do after hitting limit after limit with the engine. Very, very, very good work. From what I gather you're gonna need to ship out a modified Secretops.exe (and Prophecy.exe for obvious reasons) that loads up your new unlimited .dll file, plus the .dll file and any config files you created associated with it.

When and if you do, I'll be very happy to open it up and take a look at how it ticks. You succeeded where I failed and I'd really like to see how.

Yes it will need new exe's. For Prophecy I modified HCl's enhancement pack exe to include my dll and modified both the CD and Web versions of secret ops. The pack I sent to DefianceIndustries has it all. The config file is automatically created with the default values already set in the exe (which could be modified by wcphr.dll).

The fix for the detailed mesh was simple in the end but the real difficulty was pinning down the actual problem. I knew it was something to do with the NORM/VTNM chunk but that was about it. My first test was a simple six sided box but made with tens of thousands of triangle. The VTNM count was 11 and the model loaded fine without any modification to the game. I then started stepping through the code and found that detailed models were loading fine but were crashing during render. With the help of the WCP_DEV and ShadowForce source code I was able to find out that during render time a dot product calculation is done on all of the normals, but there was only enough memory statically allocated for the dot product results on 1024 normals. Models with more than 1024 normals caused a buffer overrun that corrupted the stack and crashed the game. The fix was to allocate new and bigger space in the DLL and change the codes in the exe to point to the address of the new space instead of the old space. There were four codes to change.

The same technique was used for the 256 render limit.

Thanks for the positive comments and suggestions. Going to take a small breather and get on with the additions in a week or so. Need some family time.
 
I don't know what kind of hardware Defiance is using, but if you want to test your patch with a measly Windows XP running a Pentium (R) 4 CPU 2.53 GHz with 738 mb of ram, I'm your guy. :p
 
I don't suppose you have something like a dropbox link for the "beta" patch so we can test it and bugsmash it further?
 
Excellent work. What I'd like to know is, since the Vision engine has been reverse engineered/extended so thoroughly. How close to being able to rewrite the engine accurately are we? I mean at some point we're hitting limits on texture resolution and computer screen resolutions. Eg on a 4K monitor, a 32-bit 3d engine is going to struggle to push the textures to look good. Has anyone looked at spinning off the 3d rendering into 64-bit code, or re-writing the engine if that's not possible? How far can you push 32-bit code? is it possible to add PAE support to use more than 4gb ram for example? Executable hacking falls outside my knowledge area so I'm not sure exactly what's possible. I'm thinking mainly of 4K texture support at least 3840x3840x6 textures for skyboxes....
 
2 systems to test with:

AMD Phenom 9950BE@2.9 GHz, 4 GB DDR2, 560 Ti, Vista x86.

&

I7-5920k@4 GHz, 16 GB DDR4, 980 Ti, Windows 10 x64.

Ever since I saw the xwaupgrade project I dreamt of having high-poly models of WC ships in a WC engine. Glad to see the Vision engine is capable of so much more.
 
Excellent work. What I'd like to know is, since the Vision engine has been reverse engineered/extended so thoroughly. How close to being able to rewrite the engine accurately are we? I mean at some point we're hitting limits on texture resolution and computer screen resolutions. Eg on a 4K monitor, a 32-bit 3d engine is going to struggle to push the textures to look good. Has anyone looked at spinning off the 3d rendering into 64-bit code, or re-writing the engine if that's not possible? How far can you push 32-bit code? is it possible to add PAE support to use more than 4gb ram for example? Executable hacking falls outside my knowledge area so I'm not sure exactly what's possible. I'm thinking mainly of 4K texture support at least 3840x3840x6 textures for skyboxes....
We haven't even scratched the surface. You can forget 64bit or PAE but even pushing the current limits with wcpunl, RAM usage doesn't break 200MB making it pointless.

4k textures are potentially possible already and is up to the renderer to use although it will still be 256 colours. The problem is vision doesn't preload everything and 4k textures would almost certainly cause 'load lag' when, for example, ships jump in.
 
here's an interesting thought: (interesting to me at least) have you done any experimentation with vibrant cell shading style textures? I wonder if the key here is to make everything look like a live action cartoon and better make use of a 256 color palette? obviously not for pre-existing mods.. but seems to me like it might be worth giving the old vision engine another go-around on the modding scene? :D
 
here's an interesting thought: (interesting to me at least) have you done any experimentation with vibrant cell shading style textures? I wonder if the key here is to make everything look like a live action cartoon and better make use of a 256 color palette? obviously not for pre-existing mods.. but seems to me like it might be worth giving the old vision engine another go-around on the modding scene? :D

Not something I've looked into but it may be something that can be done by the renderer/OpenGl patch.
 
Update:

Here's a few things I've been working on since the initial post. It's now not just limit increases now, but functionality changes also. All functionality changes will be default when installed but modifiable via config:

  • FastList::add increased from 44 to 126. I can make it higher but there is a performance hit which may need more in-depth updates. The FastList seems to be a "Who is targeting me" list that all ships have.
  • Max number of fighter turrets increased from 6 to 32.
  • Max number of capship turrets increased from 32 to 256 - You can finally give that Hvar'kann all 38 pairs of its teeth or the Vesuvius all of those extra documented turrets you never see in game. (not quite there, get an occasional crash. I have to update 30+ locations so one is probably a little wrong somewhere)
  • Can control which guns do damage capship components.
  • Can control which guns make a shield impact like most guns, or a hull impact like plasma guns.
  • Can let AI ships know it has gun capable of component damage so they can target them. In doing this I can see why AI Devastators never target capship components with the plasma gun.
  • Found an unused function that allows guns to ignore fighter shields and/or armour.
  • Can control missile turret refire delay (refire delay is based on difficulty level)

Plans for the future:
  • Use the bullet refire delay for turrets instead of being fixed at one second.
  • Look into the possibilities of WC3 style, WC4 style and Privateer2 style turret firing.
  • WC3/WC4 style fighter guns.
  • See if I can find out why capship turrets fire at dead capships.
Edit:
  • Look at making all fighters available in the simulator including different variants.
  • Look at the possibility of increasing the number of ships, bullets and missiles the engine allows.
 
Last edited:
Hello!
What do You mean under WC3/WC4 style turret firing and WC3/WC4 style fighter guns?
 
Back
Top