Check out our discord at https://discord.gg/3u69jMa 

Writing Native Code: Difference between revisions

From SWRC Wiki
Jump to navigation Jump to search
Created page with "Note: Some C++ and UnrealScript knowledge is required. === Introduction === Native coding in the Unreal Engine refers to code that is written in C++ instead of UnrealScript. This C++ code can be called from a script to execute tasks that are either too slow in UnrealScript (about 20 times slower than C++) or are not possible at all due to the limited features of the language. Native coding is only officially supported by Unreal Tournament from 1999 since it is the onl..."
 
No edit summary
Line 1: Line 1:
Note: Some C++ and UnrealScript knowledge is required.  
Note: Some C++ and UnrealScript knowledge is required.  


=== Introduction ===
== Introduction ==


Native coding in the Unreal Engine refers to code that is written in C++ instead of UnrealScript. This C++ code can be called from a script to execute tasks that are either too slow in UnrealScript (about 20 times slower than C++) or are not possible at all due to the limited features of the language. Native coding is only officially supported by Unreal Tournament from 1999 since it is the only game that has its native header files publicly available for download. Epic never released the headers for newer versions of the engine due to licensing issues with third party code. However, after countless hours of work it was possible to modify the UT99 headers in such a way that they're usable with Republic Commando. This offers a lot of new opportunities to modders or people who just like to experiment with old games like me.
Native coding in the Unreal Engine refers to code that is written in C++ instead of UnrealScript. This C++ code can be called from a script to execute tasks that are either too slow in UnrealScript (about 20 times slower than C++) or are not possible at all due to the limited features of the language. Native coding is only officially supported by Unreal Tournament from 1999 since it is the only game that has its native header files publicly available for download. Epic never released the headers for newer versions of the engine due to licensing issues with third party code. However, after countless hours of work it was possible to modify the UT99 headers in such a way that they're usable with Republic Commando. This offers a lot of new opportunities to modders or people who just like to experiment with old games like me.


The way native coding works in Unreal is that you compile your scripts into a .u package and then when you write your C++ code you compile it as a dll with the same name as your package. When the game is loading an UnrealScript class and detects that it was declared as native, it also looks for a dll which contains the native code for this UnrealScript class.
The way native coding works in Unreal is that you compile your scripts into a .u package and then when you write your C++ code you compile it as a dll with the same name as your package. When the game is loading an UnrealScript class and detects that it was declared as native, it also looks for a dll which contains the native code for this UnrealScript class.

Revision as of 11:39, 19 May 2024

Note: Some C++ and UnrealScript knowledge is required.

Introduction

Native coding in the Unreal Engine refers to code that is written in C++ instead of UnrealScript. This C++ code can be called from a script to execute tasks that are either too slow in UnrealScript (about 20 times slower than C++) or are not possible at all due to the limited features of the language. Native coding is only officially supported by Unreal Tournament from 1999 since it is the only game that has its native header files publicly available for download. Epic never released the headers for newer versions of the engine due to licensing issues with third party code. However, after countless hours of work it was possible to modify the UT99 headers in such a way that they're usable with Republic Commando. This offers a lot of new opportunities to modders or people who just like to experiment with old games like me.

The way native coding works in Unreal is that you compile your scripts into a .u package and then when you write your C++ code you compile it as a dll with the same name as your package. When the game is loading an UnrealScript class and detects that it was declared as native, it also looks for a dll which contains the native code for this UnrealScript class.