[Coding] Native coding for UT2004

Anything about UT2004 mapping, Uscripting & more
Izumo_CZ
Posts: 8
Joined: Sat 14. Jan 2012, 17:43
Description: LDG Retired Admin

[Coding] Native coding for UT2004

Postby Izumo_CZ » Mon 7. Jan 2019, 04:52

Hi there,

I thought I'd share this for people to play with albeit it's useful only for coders (I was doing coding stuff for LDG before retiring from UT2k4). It is possible to create native packages for UT2004, albeit severely limited since the headers weren't published and are instead based off UT v432 headers and modified further to work with UT2004 (but only Object, Interaction, Actor classes (actually Volume as well) - I wasn't bothered adapting it for other classes or to compile onslaught etc.).

We've used this on LDG for our music downloader mod (which is IMO pretty much the only feature of the game that's worth to implement as a client-side native mod) and I included a heavily stripped version of it in the source code (which you can compile). You can compile it for 32-bit version using Microsoft Visual Studio .NET 2003 or for 64-bit version using Microsoft Visual Studio 2005. Both of them work fine (64-bit version executable is statically linked but it still exports required symbols and you can link against it - the only limitation I noticed is that you have to use numbered native functions, otherwise it has the same capability to load the corresponding DLL). To test, compile the packages & DLL, place it to your System directory and add the mutator. Then use in-game console "CmdDownloadMusic http://www.someurl.com/somemusic.ogg somemusic" to interactively download music.

The source code I've stripped from LDG version is the in-game installer of the DLL for 32-bit version (kinda obvious reasoning here) and Anti-TCC "graceful" bypass (= will only whitelist itself without disabling any checks). Everything is also renamed to prevent any collisions. The attached code is only however an example (yes, you WILL get kicked by Anti-TCC if you have it loaded :) ).

While there's not much to do for client-side it may however serve more purpose if there's something to improve on the server, provided it's running Windows (Linux is a whole different story ._.) .

Download link: https://www.4shared.com/zip/uqGiQ_Dxgm/UT2004-NativeSDK.html

User avatar
Miauz55555
Posts: 1396
Joined: Sun 7. Jun 2015, 22:12
Location: Germany

Re: [Coding] Native coding for UT2004

Postby Miauz55555 » Mon 7. Jan 2019, 21:57

Thank you Izumo.
Could you may upload it somewhere else?

Greetings over the ocean.
Image

User avatar
Pegasus
Posts: 1085
Joined: Wed 4. Nov 2009, 23:37
Description: ONSWordFactory
Location: Greece

Re: [Coding] Native coding for UT2004

Postby Pegasus » Mon 7. Jan 2019, 22:16

Had to create a 4shared account with a throwaway email to get it myself since I wanted no social media "interaction" with the site, so already ahead of you there with the same issue, Miauz. Anyway, with that done, nobody should need go through that same hassle again, so it's now also uploaded to the more straightforward Sendspace: UT2004-NativeSDK.zip (1.24MB, probably live for a month or so, until Feb. 7th).

The implications of modifying or extending UT2004 on a level below Uscript and how this SDK & documentation might affect active UT servers' security is what mostly concerns me about all this, given how the game's old and no longer supported or patched by its dev. Aside from that though, it'll certainly take same time before I've fully wrapped my mind around what's offered here (not a software dev myself and a good part of what's in this archive is outside my field of expertise), but I'm certainly interested in ideas and concepts for how this type of modding could solve longstanding problems or otherwise improve the game for the remaining active UT community.

Thanks for taking the time to put this together, Izumo, and here's hoping it sparks further helpful convos about such topics across the places you posted it.
Image

Izumo_CZ
Posts: 8
Joined: Sat 14. Jan 2012, 17:43
Description: LDG Retired Admin

[Coding] Native coding for UT2004

Postby Izumo_CZ » Tue 8. Jan 2019, 08:58

Attached the SDK to the post.

I perhaps wouldn't be worried that much about security, as there're many limitations to create a client-side native mod and honestly aside from music download, a useful feature missing from UT2004, I can't really think of anything in particular that you could do that would be really useful with no other option to be done in C++ code. Given the limitations, you're somewhat restricted to opt-in mods for clients (for the music downloader the loader package checks if it's installed - if it is, it will download the ".ogg" file to the music directory and play it, if not, nothing happens). In fact, feel free to get the packages from LDG (LDGMusicDownloaderLoader, LDGMusicDownloaderR01 / LDGMusicDownloader64R01) for the music redirect (needs some custom code to use the loader, but it has the same interface as the example).

However it can be more useful for server-only side (or anything gameplay related achievable with C++ code on server only). It makes integration with other software just much easier (like using SQL). If you're running multiple servers, they will be able create a mod to have common configuration files (i.e. server 1 changes and server 2 immediately sees it) etc.

And of course, enthusiasts can play on their own. I myself was curious about programmable blocking volume via UScript (i.e. UScript handler to block an actor). Implemented a sample - reason why it never was in UT2004? First, it's very expensive and the handler was called a LOT. Second, karma uses it's own subsystem for vehicles and it never worked for them.
You do not have the required permissions to view the files attached to this post.


Return to “The Creative Corner”



Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests