Jump to content

Updating wiki articles


wghost81

Recommended Posts

@wghost81: Alright, I think I've got it. We only have to worry about two tokens when the NativeTableIndex is >255 and requires two bytes, or is an ExtendedNativeToken. So only those tables need to include the both the ExtendedNativeToken and their associated NativeTableIndex column: a dual column "index". In all others, the FunctionToken=NativeTableIndex and is all we need to list one as they are the same.

 

Consequently I believe the PrimitiveCast tokens are also 2-bytes, and follow the same pattern as the other ExtendedNativeTokens? Anyway, that's how I have constructed the table for the moment.

 

Article "Hex values XCOM Modding" updated.

 

-Dubious-

Link to comment
Share on other sites

We only have to worry about two tokens when the NativeTableIndex is >255 and requires two bytes, or is an ExtendedNativeToken.

Yes, but with no "or". If NativeTableIndex of the function is >255 this means that the function is an Extended Native Function and requires two tokens.

Consequently I believe the PrimitiveCast tokens are also 2-bytes, and follow the same pattern as the other ExtendedNativeTokens?

No, this one is one byte of function token (38) + cast token.

 

I think usage examples can explain this better. Like this:

 

Cast tokens are used for primitive cast operations, i.e. if you need to convert int to float, for example, you need to use cast token. Cast tokens are prepended by primitive cast token 38. Example (int to float):

38 3F <IntVariable>

I also think that repeating information about native table index at the beginning of each section should be replaced with usage examples. Like this:

 

UnrealScript Code Table: values from this table are used directly, no additional prepending token is needed. Example (LocalVariable):

00 <LocalVariableReference>

UnrealScript Code Table - Extended Native Functions: values from this table are never used directly, they are used as prepending tokens for calling extended native functions with indexes > 255.

 

UnrealScript Code Table (continued): values from this table are used directly, no additional prepending token is needed. Function call follows this pattern:

<Token> <Params> <EndFunctionParms>

Example (GotoState):

71 <StateName> 16

Extended Native Function 0x61 Table: values from this table require prepending 61 token before function token. Function call follows this pattern:

<NativeFunction1> <Token> <Params> <EndFunctionParms>

Example (Sleep):

61 00 <SleepTime> 16

Extended Native Function 0x62 Table: values from this table require prepending 62 token before function token. Function call follows this pattern:

<NativeFunction2> <Token> <Params> <EndFunctionParms>

Example (CanSee):

62 15 <Pawn> 16

 

Extended Native Function 0x65 Table: values from this table require prepending 65 token before function token. Function call follows this pattern:

<NativeFunction5> <Token> <Params> <EndFunctionParms>

Example (IsZero):

65 DD <Vector> 16

 

Extended Native Function 0x69 Table: values from this table require prepending 69 token before function token. Function call follows this pattern:

<NativeFunction9> <Token> <Params> <EndFunctionParms>

Example (V2DSize):

69 DD <V2DSize> 16

 

Extended Native Function 0x6A Table: values from this table require prepending 6A token before function token. Function call follows this pattern:

<NativeFunctionA> <Token> <Params> <EndFunctionParms>

Example (Multiply_Vector2DVector2D):

6A 24 <Vector2D_A><Vector2D_B> 16

 

Extended Native Function 0x6F Table: values from this table require prepending 6F token before function token. Function call follows this pattern:

<NativeFunctionF> <Token> <Params> <EndFunctionParms>

Example (SetPhysics):

6F 82 <Physics> 16
Link to comment
Share on other sites

Agree those are much better examples.

 

However, if I am understanding correctly: you didn't state but I interpret that the PrimitiveCast tokens are 2-byte NativeTableIndexes; as in your "INT to FLOAT" example the NativeTableIndex would be 0x383F. Just want to confirm to avoid creating confusion.

 

Article "Hex values XCOM Modding" updated. Except for minor corrections, I think we are done with this. Unless you see something else we should add?

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

Thanks, dubiousintent!

 

Here are the last corrections for the article, other than that it looks perfect.

 

UnrealScript Code Table
IMO, this text should be removed as it duplicates the information given above:


If NativeTableIndex is less than 256 (indexes from 0x000 to 0x0FF) then <FunctionToken>=NativeTableIndex and <ExtendedNativeToken> is entirely omitted. So, boolean equal-equal comparison operator with NativeTableIndex=242 is represented by one byte F2 in bytecode.

Package.Class column of the table here should also be removed as it is empty.
Also, for the sake of consistency, FToken header should be added above Dec and Hex columns.

UnrealScript Code Table - Extended Native Functions
Same as above section, I think this text should be removed entirely:

If NativeTableIndex greater than 255 (indexes from 0x100 to 0xFFF) then both <ExtendedNativeToken> and <FunctionToken> are present as two bytes in the bytecode:

And FToken header should be added above Dec and Hex columns.

UnrealScript Code Table (continued)
Same as above tables: FToken header should be added above Dec and Hex columns.

Extended Native Function 0x61 Table

2 byte NativeTableIndex = <ExtendedNativeToken '0x61'> <FunctionToken 'x'>; i.e. 0x6100-0x61FF


It's note quite right. 2 byte NativeTableIndex (i.e. NTIndex) = 0x01 <FunctionToken 'x'> (i.e. 0x0100-0x01FF). And 2 byte Bytecode Value = <ExtendedNativeToken '0x61'> <FunctionToken 'x'> (i.e. 0x6100-0x61FF).

Extended Native Function 0x62 through 0x6F Tables

2 byte NativeTableIndex = <ExtendedNativeToken '0x62'> <FunctionToken 'x'>; i.e. 0x6200-0x62FF
etc.

Same as above, but 0x02 and 0x62 (0x03 and 0x63, etc.).

 

PrimitiveCast Tokens 0x38 Table

This text should be deleted:

2 byte NativeTableIndex = <PrimitiveCastToken '0x38'> <CastToken 'x'>; i.e. 0x3800-0x38FF

Cast tokens are using one native cast function (token 38) and CastToken itself is a "parameter" for this function. Same way, FToken and NTIndex headers should be removed for this table.

Link to comment
Share on other sites

Thanks, dubiousintent, it looks great.

I made minor changes to Extended Native tables:

Values from this table require prefixing the 61 (NativeFunction1 token) before the <Function token>.

IMO, "61 < Extended Native Function token>" is confusing, as one might interpret it as 61 followed by 60 token.

Upd: just noticed that || symbols have disappeared from the Expression column of the table for OrOr_BoolBool token. It probably has something to do with || being used by wiki as column separator.

Edited by wghost81
Link to comment
Share on other sites

I made minor changes to Extended Native tables:

Values from this table require prefixing the 61 (NativeFunction1 token) before the <Function token>.

...

Upd: just noticed that || symbols have disappeared from the Expression column of the table for OrOr_BoolBool token. It probably has something to do with || being used by wiki as column separator.

 

I have no problem with that change. With enough different ways of trying to make the syntax clear, hopefully one will cause things to "click" for everyone.

 

Good catch about that missing (132 dec) expression symbol. Also missing is the (158 dec) single pipe character. Fixed both. Didn't notice any others, but they can be restored by simply bracketing them with "<nowiki>" tags, i.e. "<nowiki>||</nowiki>".

 

-Dubious-

 

Edited by dubiousintent
Link to comment
Share on other sites

I tried to update the voice/sound editing wiki page but I had a lot of trouble with timeouts. I did put together a more complete document/tutorial on creating voice packs, so dubiousintent if you feel like it feel tree to take any useful information/files/screenshots from here and put them up on the Wiki.

 

The tutorial folder is here: https://drive.google.com/open?id=0BylHgRB_52WHflZSVXd4T18xSlU4bjA4bFdTQlpOQUpCWkZWdHBocUhlckNxeEFuZGhiV0k&authuser=0

 

With the main document here: https://drive.google.com/open?id=1prH2gxib8uiTGEy6fdNVayioQXsAn97x_qaomJNNz1U&authuser=0

 

Edit: It's mostly geared toward long war, but the other information in the voice info article and/or thread should hopefully be enough info to enable the custom voices in vanilla too.

 

Finally got around to incorporating your latest tutorial in place of the one you had done previously in the "Sound Files" article. Let me know about any corrections or changes.

 

When you got into "Creating the banks", I noticed that sometimes you used different variations on the bank names: i.e. Bank_01, Bank1, banks 1-4, etc. I think it would avoid confusion of the names were consistent as to with or without "_" or spaces, and leading zeros or not as they can be significant. It's fine if the filename is different than the reference name in the "Content Browser", but we should make the distinction clear in the tutorial.

 

FYI: I was unable to download the JohnnyLump Script from Google Drive, so instead I linked back to that folder. I also did the same for the PowerShell scripts even though I could download them, so they are in only one place if they need updating.

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

  • 1 month later...

Some info on states and latent functions I learned the hard way.

 

"Latent functions" are the functions, which require some time to pass. One of the widely used examples is Sleep(fTime) function, which pauses the code for fTime seconds. A little more detailed description of latent functions can be found here: http://wiki.beyondunreal.com/Legacy:Latent_Function

 

The first thing to learn is that latent functions can't be used outside of states (!). Bytecode is magic and we can put Sleep call into a regular function, but this will be terribly wrong and potentially buggy.

 

Even when used inside a state, latent functions need to be handled carefully. For example, calling Sleep in the middle of foreach loop will do nothing. In most of the cases Sleep is used to pause state execution until something else finishes (like aliens finish all their moves, etc) and if such waiting happens inside foreach loop it will lead to runaway loop error.

 

Judging by the number of google results on the subject ("unrealscript sleep runaway loop") latent functions are magic and mastering them, especially without compiler tracking code errors, can be somewhat hard. :) Anyway, if the game CTDs after you've put a Sleep call somewhere in the code, first thing to do is check your launch.log and see if there is a "runaway loop" error message.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...