Wing Commander Prophecy: Unlimited

Discussion in 'Fan Projects & Editing' started by gr1mre4per, Dec 31, 2015.

  1. gr1mre4per

    gr1mre4per Rear Admiral

    Messages:
    186
    Likes Received:
    61
    Trophy Points:
    22,285
    Gender:
    Male
    Location:
    Evesham, UK
    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.

    [​IMG]

    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.
     
    ChrisReid, Whistler, Lilja and 3 others like this.
  2. David Wade

    David Wade Ensign

    Messages:
    74
    Likes Received:
    19
    Trophy Points:
    2,135
    Gender:
    Male
    Location:
    Milton Florida
    A battlestar in wing commander now there is a carrier that can fight
     
  3. Lt.Overload

    Lt.Overload Rear Admiral

    Messages:
    668
    Likes Received:
    20
    Trophy Points:
    27,435
    Gender:
    Male
    Location:
    United States of America
    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.
     
  4. Quarto

    Quarto Unknown Enemy

    Messages:
    11,763
    Likes Received:
    231
    Trophy Points:
    69,385
    Location:
    Poland
    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... :)
     
  5. DefianceIndustries

    DefianceIndustries Captain

    Messages:
    741
    Likes Received:
    849
    Trophy Points:
    11,535
    Gender:
    Male
    Location:
    Colorado
    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. :)
     
  6. Lilja

    Lilja Master Chief Petty Officer

    Messages:
    71
    Likes Received:
    31
    Trophy Points:
    1,335
    Gender:
    Male
    Location:
    Sweden
    Move over starwreck, hello wingwreck :p
     
  7. AD

    AD Finder of things, Doer of stuff

    Messages:
    4,936
    Likes Received:
    105
    Trophy Points:
    36,885
    Location:
    BC, Canada
    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.
     
  8. gr1mre4per

    gr1mre4per Rear Admiral

    Messages:
    186
    Likes Received:
    61
    Trophy Points:
    22,285
    Gender:
    Male
    Location:
    Evesham, UK
    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.

    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.

    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.
     
  9. Lt.Overload

    Lt.Overload Rear Admiral

    Messages:
    668
    Likes Received:
    20
    Trophy Points:
    27,435
    Gender:
    Male
    Location:
    United States of America
    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
     
  10. DefianceIndustries

    DefianceIndustries Captain

    Messages:
    741
    Likes Received:
    849
    Trophy Points:
    11,535
    Gender:
    Male
    Location:
    Colorado
    I7 2.5ghz, 16GB RAM, GTX760. FYI
     
    Last edited: Jan 2, 2016
  11. gr1mre4per

    gr1mre4per Rear Admiral

    Messages:
    186
    Likes Received:
    61
    Trophy Points:
    22,285
    Gender:
    Male
    Location:
    Evesham, UK
    I7 4770k 3.8GHz 16GB RAM and Gtx 980
     
  12. Lt.Overload

    Lt.Overload Rear Admiral

    Messages:
    668
    Likes Received:
    20
    Trophy Points:
    27,435
    Gender:
    Male
    Location:
    United States of America
    I don't suppose you have something like a dropbox link for the "beta" patch so we can test it and bugsmash it further?
     
  13. Darkmage

    Darkmage Vice Admiral

    Messages:
    905
    Likes Received:
    18
    Trophy Points:
    31,435
    Location:
    Australia
    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....
     
  14. Whistler

    Whistler Commodore

    Messages:
    848
    Likes Received:
    138
    Trophy Points:
    16,685
    Gender:
    Male
    Location:
    Orbit
    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.
     
  15. gr1mre4per

    gr1mre4per Rear Admiral

    Messages:
    186
    Likes Received:
    61
    Trophy Points:
    22,285
    Gender:
    Male
    Location:
    Evesham, UK
    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.
     
  16. NinjaLA

    NinjaLA Alex Von T.

    Messages:
    1,508
    Likes Received:
    113
    Trophy Points:
    35,235
    Gender:
    Male
    Location:
    Seward, AK
    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
     
  17. gr1mre4per

    gr1mre4per Rear Admiral

    Messages:
    186
    Likes Received:
    61
    Trophy Points:
    22,285
    Gender:
    Male
    Location:
    Evesham, UK
    Not something I've looked into but it may be something that can be done by the renderer/OpenGl patch.
     
  18. gr1mre4per

    gr1mre4per Rear Admiral

    Messages:
    186
    Likes Received:
    61
    Trophy Points:
    22,285
    Gender:
    Male
    Location:
    Evesham, UK
    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: Feb 16, 2016
  19. Mindcrime

    Mindcrime Captain

    Messages:
    468
    Likes Received:
    86
    Trophy Points:
    10,635
    Gender:
    Male
    Awesomely exciting stuff. Keep it up!
     
  20. bulch

    bulch Rear Admiral

    Messages:
    14
    Likes Received:
    2
    Trophy Points:
    21,885
    Gender:
    Male
    Hello!
    What do You mean under WC3/WC4 style turret firing and WC3/WC4 style fighter guns?
     

Share This Page