Page 1 of 2 1 2 LastLast
Results 1 to 20 of 29

Thread: Compiling and modifying the SDK source code on Windows

  1. #1
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Compiling and modifying the SDK source code on Windows

    Hi,

    I've had a bit of trouble with modifying and compiling the game's source code for a mod so I thought I'll just share this here, because the coding part of the ModWiki barely exists.

    Of course first you need the retail game v1.5 with SDK.

    Here is an absolutely necessary tutorial https://modwiki.xnet.fi/How_to_build_the_SDK_on_Windows.

    It says that you need Visual Studio 2005 C++. What you need to know is that you need the full ISO version and not the Web Installer which needs you to register the product on a dead link after 30 days.
    Here is the official ISO from Microsoft.

    You can dismiss the compatibility warnings on Windows 8.1, it works fine (I suppose same for earlier Windows).

    You also need to install the platform SDK for Windows Server 2003 like it is said in the tutorial.

    After that you can open VS2005 and load the solution. It will not build yet, you will have errors.
    What you have to do is to tell VS2005 to go look for the Platform SDK libraries.

    You need to go to "Tools-->Options" then go in "Projects and Solutions-->VC++ Directories".
    In "include files" you need to add a new line pointing to where you installed The Windows Server 2003 platform SDK. For example :
    Code:
    C:\Program Files (x86)\Microsoft Platform SDK\Include
    You need to do the same for "library files".
    Code:
    C:\Program Files (x86)\Microsoft Platform SDK\Lib
    At this point, the code should compile.
    Now, the tutorial given at the beginning of this post tells you to do this :

    You will need to add the following lines to ‘SDK 1.5/source/framework/BuildDefines.inc’:
    Code:
    #ifndef SD_PUBLIC_BUILD
        #define SD_PUBLIC_BUILD
    #endif
    Actually, you also need to #define SD_PUBLIC_TOOLS. If you don't you will get an error dialog box about "wrong API_VERSION" when you try your code with the SDK exe.

    So, my "BuildDefines.inc" file consists of this :
    Code:
    // Public defines go here 
    #ifndef SD_PUBLIC_BUILD
    	#define SD_PUBLIC_BUILD
    #endif
    
    #ifndef SD_PUBLIC_TOOLS
    	#define SD_PUBLIC_TOOLS
    #endif
    To test that the DLL is actually loaded ingame, we will add one line of code in Game/Entity.cpp inside the spawn function (taken from here) :
    Code:
    // ...
    /*
    ================
    idEntity::Spawn
    ================
    */
    void idEntity::Spawn( void ) {
    	gameLocal.RegisterEntity( this );
    
    	const char* classname = spawnArgs.GetString( "classname" );
    	if ( *classname ) {
    		
    		const idDeclEntityDef *def = declHolder.declEntityDefType.LocalFind( classname, false );
    		if ( def )
    		{
    			gameLocal.Printf("Hello %s!\n", classname);
    			entityDefNumber = def->Index();
    		}
    	}
    // ...
    }
    // ...
    Now, your DLL is "SDK-ready", you can build the code and get the DLL from the build output.

    Now, you have to go to your SDK1.5 root folder and rename "gamex86.dll" to something unusable like "gamex86.dll.old" (to have a working backup).

    Now, copy your freshly made DLL to the SDK1.5 root folder (to replace the old one that you have renamed).

    This info is from the SDK readme.txt :
    - You can find the final gamex86.dll in source\build\win32\<configuration name>\
    Copy it to the same folder as your etqw.exe and the game will automatically load your new dll.

    - We recommend setting up a post-build event to automatically copy the dll to the game folder.
    As suggested, you can use XCOPY or change the build output directory to avoid copying the DLL manually every time.

    Now, you can use the SDK launcher to launch the game and, for example, launch the Valley map.

    To display the console : Ctrl+Alt+~

    Then you can set "com_allowconsole" to 1 so that later only "~" key will be needed to display/hide the console.

    Now, in the console, type : "devmap valley". You might need to set "si_rules" to "sdGameRulesObjective" if it doesn't work because the game expects a campaign and not a single map by default.

    Now, you can do : "spawn vehicle_husky" and see what happens.

    msg.JPG

    As you can see, the message "Hello vehicle_husky!" appears in the console. It works! Wuhu!

    I hope this helped you, if you have anything to add or any remarks, feel free to say it here!
    Last edited by BackSnip3; 2nd Mar 2016 at 21:41. Reason: added screenshot, corrected typo
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  2. #2
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    I've implemented double jump functionality in ETQW as a first test of "real new feature".


    I will post modified source code if people are interested.
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  3. #3

    Re: Compiling and modifying the SDK source code on Windows

    Quote Originally Posted by BackSnip3 View Post
    I will post modified source code if people are interested.
    How does it works with the usual movement, like CSJ? Would like to see a video of that.
    "Your bręking me hard!"

  4. #4
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Sorry but...what does CSJ stand for?
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  5. #5

    Re: Compiling and modifying the SDK source code on Windows

    Circle Strafe Jumping


    Operating System: Windows 10 Enterprise 64-bit
    Processor: Intel Core i7 5820K @ 4.4 GHz
    Memory: Corsair Dominator Platinum 32 GB @ 3200 MHz
    Graphics: Nvidia GeForce GTX 980 Ti @ 1469 MHz | 388.13 (30th October 2017)
    Monitor: Dell Ultrasharp 2407WFP @ 1920x1200 (16:10)
    Sound: Creative X-Fi XtremeGamer Fatal1ty Pro
    Peripherals: K70 RGB 'Sails'; Mionix Naos 8200; Ergodex DX1

  6. #6
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Oh, like trickjump? I actually already changed a variable which prevented players from jumping more frequently than every 850ms. So now you can jump instantly after you land, so you do gain speed over time with the many jumps.
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  7. #7

    Re: Compiling and modifying the SDK source code on Windows

    Very neat BackSnip3! I tried compiling the files using Microsoft Visual 2010 a while ago and came to the conclusion that 2005 was needed but couldn't get it working. I may have to revisit the code and try recompiling! :-) Do you know also how to do linux and mac builds? What made you want to play around with the source code? Thanks again for sharing your experience with this!

  8. #8
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    I scratched my head for days with more recent versions of Visual Studio and I just gave up on it.
    It compiles fine in VS2008 but then it crashes when I load a map. It won't compile with 2010+, even when using old platform toolset.
    I think you couldn't figure it out because you didn't have the windows SDK installed.
    I really wanted it to work with VS2013 for the syntax highlighting and GitHub support but I can't figure it out.
    I haven't tried compiling with Linux yet. I expect even more problems with it. I hope I'm wrong.
    I haven't got a mac so can't try the mac build.

    Well, I'm a student software engineer so I thought I should dig in some real code and thought of ETQW. Also because for the Wolf:MP mod we never had a programmer so I thought I'll handle this part of the mod.
    I'll be glad if you started coding too, maybe we could achieve something cool!
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  9. #9
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Found out something right now : I couldn't launch a custom map from the SDK. It wouldn't display it in the map list when I typed "map" or "devmap".
    This behavior only occurs with custom gamex86.dll. I wonder what else is broken...

    To fix it, you need to add a map declaration in the SDK base folder in pakmeta.conf.

    Code:
    mapMetaData maps/test {  
    	"pretty_name" "Test Map" 
    }
    As simple as this. I need to investigate more to know why it actually works without this using the shipped SDK DLL.
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  10. #10
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Quote Originally Posted by Runeforce View Post
    How does it works with the usual movement, like CSJ? Would like to see a video of that.
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  11. #11

    Re: Compiling and modifying the SDK source code on Windows

    Nice videos, mate! Good to see you working again

  12. #12

    Re: Compiling and modifying the SDK source code on Windows

    Quote Originally Posted by BackSnip3 View Post
    Found out something right now : I couldn't launch a custom map from the SDK. It wouldn't display it in the map list when I typed "map" or "devmap".
    This behavior only occurs with custom gamex86.dll. I wonder what else is broken...

    To fix it, you need to add a map declaration in the SDK base folder in pakmeta.conf.

    Code:
    mapMetaData maps/test {  
    	"pretty_name" "Test Map" 
    }
    As simple as this. I need to investigate more to know why it actually works without this using the shipped SDK DLL.

    (I used capslock below to emphasize important words, I am not yelling at you)

    Are you saying that when you use the vanilla gamex86.dll and compile a CUSTOM map WITHOUT a pakmeta.conf, that you can run the custom map, but when you use a CUSTOM gamex86.dll and compile a CUSTOM map that you need a pakmeta.conf in order to run the custom map?

    ~Assassin4004

  13. #13
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Exactly. Can u test this behavior?
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  14. #14
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Hi again,

    I successfully built the SDK from Visual Studio 2015 by telling MSBuild to use the Visual Studio 2005 compiler.

    Here is a .pdf with instructions.

    Can anyone test the instructions and tell me if it is working for them? Thank you
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  15. #15
    Senior Member maggol's Avatar
    Join Date
    Jun 2009
    Location
    Jatinangor, West Java, Indonesia
    Posts
    125
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Hi

    I try to follow your tutorial, but it seems i don't have microsoft sdk v6.0No v6.jpg


    Something i miss in following your tutorial?
    Hello, World

  16. #16
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Hi,

    Second person telling me this, I realise I wasn't very clear in my wording...
    You have to create the V6.0 key in the registry, then add a field in it called "InstallationFolder". I hope that helps you. Tell me how it goes. Turns out you might need VS2010 as well and/or Visual Studio 2015 Enterprise (not community). Please let me know
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  17. #17
    Senior Member maggol's Avatar
    Join Date
    Jun 2009
    Location
    Jatinangor, West Java, Indonesia
    Posts
    125
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Quote Originally Posted by BackSnip3 View Post
    Hi,

    Second person telling me this, I realise I wasn't very clear in my wording...
    You have to create the V6.0 key in the registry, then add a field in it called "InstallationFolder". I hope that helps you. Tell me how it goes. Turns out you might need VS2010 as well and/or Visual Studio 2015 Enterprise (not community). Please let me know

    Hi

    Already add v6.0 key in my registry and found another problem,
    no platform.jpg

    i have no "platform folder" in my microsoft.cpp, any advice?
    Hello, World

  18. #18
    Wolf:MP BackSnip3's Avatar
    Join Date
    Mar 2009
    Location
    France,lost in the west
    Posts
    439
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    This is what I feared...
    I need to investigate more to know why this doesn't work. I had same problem with Visual Studio 2013 pro. I think you need Visual Studio 2015 Enterprise version, or you need to have Visual Studio 2010 installed too to make it work (for some reason).
    Also it seems you need to install the different Visual Studio versions in chronological order like 2005, then 2010 then 2015...
    I'm sorry that it doesn't work. Obviously I missed some steps that I don't even remember of anymore :/
    Quote Originally Posted by tomv8 View Post
    omg u genius ty
    Box is pretty - Margus

  19. #19
    Senior Member maggol's Avatar
    Join Date
    Jun 2009
    Location
    Jatinangor, West Java, Indonesia
    Posts
    125
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Ok. Haven't try installing vs 2010 and vs 2015 enterprise edition is too expensive T_T, maybe i just need vs 2010, because i have installed 2005 and 2015 in chronological order. Plus, i have vs 2013 express edition installed. Gonna uninstall and reinstall those VSes.
    Hello, World

  20. #20
    Senior Member maggol's Avatar
    Join Date
    Jun 2009
    Location
    Jatinangor, West Java, Indonesia
    Posts
    125
    Most Recent Awards:

    Re: Compiling and modifying the SDK source code on Windows

    Installed Vs 2010 and bam, there it is, a platform folder
    Bam.jpg

    And after following the tutorial again, i encountered this

    1>------ Build started: Project: idLib, Configuration: Debug with edit and continue Win32 ------
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuil d.targets(297,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.

    TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
    1> Lib.cpp
    1>d:\sourcecode\etqw\idlib\../idlib/LibOS.h(66): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\M icrosoft.Cpp.Win32.Targets(57,5): error MSB6001: Invalid command line switch for "CL.exe". Illegal

    characters in path.
    2>------ Build started: Project: libGameDecl, Configuration: Debug with edit and continue Win32 ------
    2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuil d.targets(297,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.

    TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
    2> precompiled.cpp
    2>d:\sourcecode\etqw\idlib\libos.h(66): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\M icrosoft.Cpp.Win32.Targets(57,5): error MSB6001: Invalid command line switch for "CL.exe". Illegal

    characters in path.
    3>------ Build started: Project: game, Configuration: Debug with edit and continue Win32 ------
    3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuil d.targets(297,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.

    TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
    3> precompiled.cpp
    3>d:\sourcecode\etqw\idlib\libos.h(66): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\M icrosoft.Cpp.Win32.Targets(57,5): error MSB6001: Invalid command line switch for "CL.exe". Illegal

    characters in path.
    ========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========
    and this is the warning

    Success but...jpg
    Hello, World

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •