NERPs

From RRU Knowledge Base
Revision as of 15:52, 18 September 2017 by Jessietail (talk | contribs)

This article is an unfinished work in progress or contains transferred information that needs to be rewritten or reformatted to fit our standards. Please excuse the mess and do not mark for deletion.

NERPS is a scripting system created by Data Design Interactive which is used in LEGO Rock Raiders.

It consists of a bytecode language that is stored in NPL files, each level then has a NERPFile parameter in the Lego.cfg file that tells it which script to use. This script is called at regular intervals by the game engine, unknown how often but presumed to be once per game tick, 25 times per second. It will run to completion on each execution, only stopping when the function named "Stop" is called.

The source code of a NERP script is a NRN file, which is then processed through a C Preprocess to generate a NRM file. This file can then be compiled into bytecode using the appropriate tool.

Each operation in the bytecode is a double word, where the top word designates the opcode and the lower word designates the operand. Of course this is stored in little endian format in the file itself.

The opcodes are as follows:

Value Opcode Function
0x0000 Constant Load an integer constant, operand is the value
0x0001 Compares Comparison operators, operand is the comparator function.
0x0002 Function Calls a function, operand is the functions ID
0x0004 Label definition Defines a label that can be jumped to, operand is just an ID number
0x0008 Goto Jumps to a bytecode offset, operand is address to jump to

Also involved are a couple of register named R0 to R7, the contents of which are saved between executions. There are also four timers, Timer0 to Timer3. The function of these is unknown at this time.




Symbols

There are only five symbols that are known to be used in the game's mission objective script. Like other hex-strings, when encoded in NPL files, they consist of four character pairs. Symbols end in 01 00.

The five symbols and their strings are:

? - 04 00 01 00

> - 05 00 01 00

< - 06 00 01 00

= - 07 00 01 00

!= - 0A 00 01 00

shoving this on this page for now because it didnt really need its own page