Original:
http://udn.epicgames.com/Two/UnrealScriptLanguageReference.html Place game logic in a sandbox (Sandbox) like a script to protect environment client calls to prevent program crashes Unreal script is: Java-like without pointers, automatic garbage collection mechanism than C + + more advanced time, State, properties and network engine programmers use C + + Write function module, and use the script encapsulated into the script accessible object method, The script programmer writes the logical code according to the game logic requirement, and exposes the properties which can be debugged and set up, the editor can easily edit and modify these properties the function that takes time to do things is called the delay function, similar to sleep Finishanim moveto etc. A delay function can only be invoked in the state function, not as a normal function. Ordinary functions can only be executed when the delay function is suspended Unreal only simulates the threading concept of Windows rather than copying it, and Windows threads are inefficient. All illusory object script execution is parallel, and object-independent all objects are inherited by objects Actor (inherited from Object) define some columns such as controllable movement, interaction, and influence behavior pawn (inherited from Actor) An object class (inherited from Object) with high level AI and player control levels defines a class of objects (distinct from the C + + Class) definition modifier: Native: Indicates that it is supported by the C + + background, if you have a class for Native Robots, Unreal will need to find Robots.dll on disk to implement scripting functionality, provided that C + + classes must provide IMPLEMENT_CLASS macro definitions Abstrat: abstract class, similar to C + + interface classes, the interface class itself cannot be instantiated, subclasses must implement their methods to instantiate. There is a pawn class in the illusory script that itself can be instantiated GUIDs (A,B,C,D) only with a similar brute class: This is not being used at this stage and will be added to the illusion in the future when COM is supported Transient: shows that thisClasses do not have to be saved to disk, which means that the class is not used permanently, but is temporary. Similar to Players,windows Config (section_name): Some variables that need to be saved, global variables. A class is an INI file The name type of a phantom script can be a predefined name for a function, state, or class, and so it differs from a string in that a string can be modified dynamically, and name once determines that the variable modifier is no longer modified: Input: A variable that can be identified by an illusory input system, similar to mapping the input of a keyboard or handle to a variable Native: from C + + Load or save type Unreal supports only 1-d arrays, multidimensional arrays please implement function modifiers Static: and C + + The difference is: Illusory script static functions can only access static functions, some of the default values of variables, can not call non-static, instantiated functions. and cannot be overloaded Singular: A modifier that prevents a function from being called recursively. When you write a actor collision with another actor logic, the recursive function call will cause a stack overflow. When this modifier is added, the function that has been called is not called repeatedly. Latent: delay function: Call a delay function in the state, after a certain tick, the function will be returned Iterator: defines a function as an iterator for using foreach to traverse a actor list simulated: When a actor is a simulation agent (simulated proxy) or an independent agent (autonomous proxy Determines if a function is run on the client Operator: and C + + similar Event: is just a compiler modifier, and you can use Unreal-make–h to match the script event function to the C + + connection code. The event touch in the script (Actor other) {...} in the list source is void Touch (class aactor* other) { FName N ("Touch", fname_intrinsic); struct {class aactor* other;} Parms; Parms.Other=Other; processevent (n,&parms); } Status illusory scripts are the only benefit of language usage states that support State at the language level: can easily write state based functions (logic) , some functions and logic can be shared by different states, and their execution results are determined only by what actor actually doing. The state can use the delay function, which is a special type of function, C + + and Java are not implemented. For example: You can implement the following logic: Open a door, wait 2 seconds to play the sound effects then open another door, release some of the strange, let them play the player, you can be very common, linear logic to write the code. and concrete details will have the unreal bottom to realize 3 main delay functions sleep: Pause script execution for a period of time after continuing execution Finishanim      &NBsp; waits for the currently playing animation to complete and continues execution. Using this function can be very convenient to write animation-driven logic, AI logic is strict animation drive (different from time driven), smooth animation control is an AI system key Finishinterpolation waiting for the current tea call action to continue after the completion of State Process Control: Use goto statement to switch between different sections of code auto State mystate {Begin: Log ("MyState has just begun!"); &n bsp; Sleep (2.0); Log ("MyState has finished sleeping"); Goto Begin; Use GoToState to execute a status instance//This is the automatic state to execute. Auto State Idle { /A touched by another actor ... function Touch (acto R Other) { Log ("I am touched, so I ' m going to attacking"); gotostate (' attacking '); Log ("I have gone to the Attacking State") ; } Begin: log ("I am Idle ..."); sleep (10); Goto ' Begin '; } //attacking state. State attacking {Begin: Log (' I am executing the attacking state code '); &nbs P //... } Run results I am idle ... I am Idle ... I am Idle ... I am touched, so I ' m going to attacking I have gone to the attacking state I am executing the attacking state code Status inheritance and visual rules //Parent class Myparentclass expands Actor; //non-state functions function Myinstancefunction () { log ("executing Myinstancefunction "); } //A status state mystate { //a status function function mystatefunction () { Log ("Executing mystatefunction"); }//Begin label begin: Log ("beginning MyState"); //Subclass Implementation Class Mychildclass expands myparentclass; //overloaded non-state functions function Myinstancefunction () { Log ("executing Myinstancefunction in the Child Class "); } //redefining State, and overloaded function mystate { //overloaded functions & nbsp; function mystatefunction () { Log (" Executing mystatefunction "); }//tags are overloaded Begin: Log ("Beginning mystate in Mychildclass"); } Rules: 1. If the object is a state, no matter how many times it has been defined, the last overloaded class will be executed 2. Otherwise, by the number of overloads, and the non-state version of the function is executed State can also use expand to inherit state//Base attacking states. State attacking { } //upper segment Attack State Meleeattacking expands Attackin g { } //Long range attack. State Rangeattacking expands attacking { } Use ignores to specify ignored functions state retreating { //Ignore calls to the following functions & nbsp; ignores touch, Untouch, MyFunction; } Default properties: Default properties you can give a preset value for a column when an object is in the editor or created. This is a good scalability performance and code specifications of the standard technical details: Unreal garbage collection and Java Virtual machine similar tree follow way (tree-following), the collector uses Uobject serialization functionality to obtain recursively what objects reference other objects Illusory scripts are based on bytecode, and when compiled, scripts are compiled into virtual machine code like java. This allows it to be conveniently cross-platform Unreal scripts are 2 passes, the first pass determines variables, states, and function definitions, The second compilation is P-code. This mechanism enables complex loops to rely on logical inheritance structures that can be fully compiled and linked recoverable player status: Unreal can save all actor status and run to disk at any time during the game and recover if necessary. Because its state and function execution is only run at the low-end of the virtual machine, the results are only dependent on the stack data, so the save stack data is a very critical unreal package: This is a binary format package that contains the index, serializes the dump and the details of the object. It is similar to a DLL and can have a list that references other packages. This makes it easy to put predefined packages on the Internet to provide downloads, and downloaded packages will not download to reduce download times (manifest mechanism) Development Strategy C + + scripts can execute 50 million instructions per second, The unreal script can execute 2.5 million instructions, the difference is 20 times times, the entire game, the script execution needs to spend CPU 5~10% time. Use illusory scripts to do some of the time you are actually interested in, or you need to customize the part. Instead of rewriting some of the underlying mobile code, the physical system can do everything for you. A lot of use of delay functions, if the time-driven traditional way of writing such logic will be inefficient code writing to reduce the occurrence of infinite recursion: In the move command execution, actor will collide, and then call the Bump function, If there is still a move instruction in bump, infinite recursion will be formed. Infinite recursion and Dead loop is a place where unreal scripts can't be solved (all languages are-_-!). Tim is too modest) creating and destroying actor will be a very resource-intensive operation on the server side, especially in online games where the contract is needed to destroy and destroy.Occupy a certain amount of network bandwidth. Use object-oriented features as much as possible. When writing new features as much as possible overload existing functions and state to make the code refreshing, easy to modify, easy to integrate with other people's results. Avoid using traditional C techniques, similar to using a switch to determine the state of a actor and perform different operations. Such an operation prevents you from adding new classes and modifying something.