Skip to content

ZReader

adamdev edited this page Feb 1, 2025 · 2 revisions

Readers are frequently used in the engine to retrieve data from a .RDR file.

Syntax

In the SOCOM engine (and in previous Zipper game titles after DeathDrome), declarations of logic and variables are written to a file with a .RDR extension.

These files can be compiled with a ZRDR compiler, which will then get inserted into an archive. Or, it can just exist on its own as a plain-text file.

The ZRDR syntax is similar to the LISP language. In fact, it is likely Zipper Interactive wrote their own LISP-like compiler/interpreter for their own engine.

Snippet from E3CONFIG.RDR, shipped with a SOCOM public beta.

mp_game_type(FOOTBOMB); Really Footbomb, but we have no type for that yet
  game_time       ( 360 )
  round_count     ( 11 )
	seals(
		players (
			(	type(mp1_seal1)	
				name("Gieger") )
			(	type(mp1_seal2)	
				name("Hutchins") )
			(	type(mp1_seal3)	
				name("Bailey") )
			(	type(mp1_seal4)	
				name("Dimone") )
			(	type(mp1_seal1)	
				name("Thomas") )
			(	type(mp1_seal2)	
				name("Hamilton") )
			(	type(mp1_seal3)	
				name("Jones") )
			(	type(mp1_seal4)	
				name("Peters") )
		)
	)

API

Create An Instance

Before you can access your serialized data, you will have to create a new zrdr instance by retrieving a reader that is already loaded from a ZAR archive.

auto reader = zrdr_read("yourreader.rdr", "path/to/reader", 0);

Find Tags

Variables that are declared in a reader file can be an int, float, string, or an array. A tag is the name of the variable. Tags can house their tags, and so on.

To access a tag, simply call zrdr_findtag, passing in the arguments like so.

auto tag = zrdr_findtag(reader, "tag name");

Cleanup

When you're done with using your reader, make sure to clean up after yourself.

zrdr_free(reader);

Clone this wiki locally