intfiction.org

The Interactive Fiction Community Forum
It is currently Sun May 26, 2013 1:56 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Jun 17, 2012 6:11 am 
Offline

Joined: Sun Oct 02, 2011 4:05 am
Posts: 46
Node-X is the system and NodeScript is the code which I developed and which I use to create my CYOA/Multiple-Choice adventure games. It has been used as a DOS beta in my first game "Project Delta" (see IFComp 2008), as a DOS/Linux release version of Generation 1 in my second game "Trap Cave" (see IFComp 2009) and as a Windows beta of Generation 2 in my third game "Dead Hotel" (see IFComp 2011).

Beta versions of my Node-X system are usually called "internals" and release versions are called "externals". Project Delta and Dead Hotel are internals, because you can run the games, but you can't write your own adventures for the system/engine, because engine and game are both compiled in the exe file. Trap Cave is the only external so far, because you may run the game or not, but most important of all, you can code and write your own CYOA adventures for Node-X Generation 1, because the engine reads external game files, interpretes them and converts them into program code.

Trap Cave (incl. Node-X Generation 1)
http://www.ifarchive.org/indexes/if-arc ... pcave.html

Trap Cave NodeScripts (*.nx)
http://www.ifarchive.org/indexes/if-arc ... XGame.html

Now after 2-3 years I have decided to publish a de-obfuscated reference manual for NodeScript in this forum. Obfuscation is known as a method to confuse or express something in a way that it can only be understood by insiders.

For a more detailed definition of "Obfuscation" see these two wiki links:
http://en.wikipedia.org/wiki/Obfuscation
http://en.wikipedia.org/wiki/Obfuscated_code

So I made the NodeScript look obfuscated. I did this, not to confuse anyone or hide anything, but simply because I hadn't coded any editor for my Node-X system. I had to type everything manually in a text editor. And I didn't want to type or copy+paste the long names of variables and ENUMs every time when I coded my Trap Cave adventure. That's why I replaced everything with very short abbreviations and made the Node-X engine understand those when a NodeScript file (*.nx) was read.

Now my fourth and upcoming CYOA/MCA game in 2012 is most likely to be an external version again, using the newer Node-X Generation 2 this time. The second generation has been showcased to a certain extent in my third game Dead Hotel. The fourth game will not only be a game release, but an editable system release aswell, using NodeScript as interpreter code in external game files.

Thus I'm releasing this de-obfuscated NodeScript reference manual for any CYOA author out there who may be interested to code custom Node-X adventures for generation 1 (included in Trap Cave download) and upcoming generation 2, and wants a better understanding of the script. This reference manual may also be helpful for experienced programmers on how to code a more advanced system or engine for CYOA/MCA games. And because I'm going to keep abbreviations in NodeScript. It not only creates smaller game files, although this is less of a problem in these modern days, but it is also faster to edit NodeScript with a text editor, because you don't have to type so much.

Here we go...

Code:
[NX.NodeScript]
Gen = Generation
EC = EngineClass (see classes below)
TE = TextEncode (see encodes below)

[FI] = FileInfo
D = Date
T = Time

[GI] = GameInfo
T = Title
A = Author
V = Version
L = Language

[NI] = NetInfo
E = Email
U = URL

[GIF] = GameInterface
CS = ColorScreen
CT = ColorText
CTi = ColorTitle
CL = ColorLocation
CN = ColorNode
CK = ColorKey
CC = ColorChoice
CLi = ColorLine
LS = LineStyle

[FIF] = FileInterface
SF = SaveFile

[Inv] = Inventory
EC = ElementColor
EN = ElementName
SEN = SubElementName
SLN = SubLeftName
SRN = SubRightName
SLA = SubLeftAbbreviation
SRA = SubRightAbbreviation
EV = ExamineVerb
PV = PutVerb
PVA = PutVerbAdditive
CI = ColorItem

[PS] = PlayerStart
bInv = bInventory (Inventory bool flag, true or false)
N = StartNode
LI = StartLeftItem
RI = StartRightItem

[Ls] = Locations

[NTx] = NodeText x

[ATx] = AlternativeText x

[ITx] = ItemText x (Item Description)

[Cs] = Choices

[Qs] = Questions (yes/no type)

[Nx] = Node x
bNF = bNodeFlag (true or false)
PCA = PreCallAction (see actions below)
PCF = PreCallFlag
PCJ = PreCallJump
L = Location
NT = NodeType (see types below)
T = NodeText
NC[x] = NodeChoice[x]
NJ[x] = NodeJump[x]
GQ = GateQuestion
GJK[x] = GateJumpKey[x]
NI = NodeItem
bIF = bItemFlag (true or false)
FSC = FlagSetChoice
FUC = FlagUnsetChoice
AT = AlternativeText
AC = AlternativeChoice
AJ = AlternativeJump

[Ix] = Item x
IT = ItemType (see types below)
IN = ItemName
T = ItemText
CT = CombineTag
CI = CombineItem
CV = CombineVerb
CVA = CombineVerbAdditive
bIU = bItemUndo (undo bool flag, true or false)
UV = UndoVerb
UVA = UndoVerbAdditive
UMI = UndoMasterItem
USI = UndoSlaveItem


EngineClasses (EC)

NJ = NodeJumper (default cyoa engine)
NL = NodeLinker (not yet implemented)


TextEncodes (TE)

R13 = Rot13
R47 = Rot47
2R = 2Rot/DoubleRot (combination of Rot13+Rot47)


PreCallActions (PCA) ENUMs for Nodes (things that happen before a node is called / a cyoa page is displayed)

none = PRE_None
HI = PRE_HideInventory
SI = PRE_ShowInventory
TI = PRE_TakeItemFromPlayer
GI = PRE_GiveItemToPlayer
AS = PRE_AutoSaveHere
IJ = PRE_ItemJump
AIJ = PRE_AnyItemJump
FJ = PRE_FlagJump
AF = PRE_AlternativeFlag
UF = PRE_UnsetFlag
SF = PRE_SetFlag
TF = PRE_ToggleFlag
IF = PRE_ItemFlag
CIF = PRE_CombinedItemFlag
UIF = PRE_UndoItemFlag
LIF = PRE_LeftItemFlag
RIF = PRE_RightItemFlag


NodeTypes (NT) ENUMs for Nodes (specific behaviour of a node / cyoa page)

DN = NT_DeadNode (a node with no choices, used for game over and end pages)
JN = NT_JumpNode (a node with no choices, but with one destination to jump to next)
GT = NT_GateNode (a node with a yes/no choice, gate question)
PN = NT_PathNode (a node with a number of choices and destinations, your regular cyoa page)
FN = NT_FlagNode (a node with choices, flag-controlled)
IN = NT_ItemNode (a node with choices, and a specific item to be either picked up or placed)


ItemTypes (IT) ENUMs

ST = IT_Standard (your regular item)
MC = IT_MasterCombiner (a master item which requires a slave item to create a new item)
SC = IT_SlaveCombiner (a slave item for a master item to create a new item)


- Comazombie / Emilian Kowalewski


Last edited by Comazombie on Tue Jun 19, 2012 12:51 pm, edited 3 times in total.

Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 11:41 am 
Offline

Joined: Sat Dec 22, 2007 9:44 pm
Posts: 180
The documentation you just provided is pretty sparse. What exactly does PreCallJump mean, for example? What sort of arguments does it take?

It might be more useful to:
1) Finish the translation of Trap Cave into English.
2) Fix the bugs in Trap Cave.
3) Add comments to the Trap Cave source to explain what you're doing.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 2:04 pm 
Offline

Joined: Sun Oct 02, 2011 4:05 am
Posts: 46
ralphmerridew wrote:
The documentation you just provided is pretty sparse.


That's because it's a quick reference guide for understanding the abbreviations used. It's not a tutorial or anything like that. It will follow in the future.......

People say they have to be patient and things will come natural to them.

Quote:
What exactly does PreCallJump mean, for example? What sort of arguments does it take?


PreCallJump (PCJ) takes numbers, ranging from 1 to 255. The number corresponds with the number of the Node to jump to instead, depending on the PreCallAction (PCA) type.

Quote:
It might be more useful to:
1) Finish the translation of Trap Cave into English.
2) Fix the bugs in Trap Cave.


Haha. Right, I should hurry up, because people in 2012 are dying to play Trap Cave 2009 in English. Nobody notified me that I had Diablo 3 status anyway. ;)

But thanks for the hint. I may consider it on a more serious level and when I have more time...

You see, this community is not the only one I'm active on. Just because people see me posting here from time to time under my real name and with one of my many nicknames used on the internet, doesn't mean that I can spend all energy and time in here to beat a dead horse, if you know what I mean. Right now I have additional and more promising projects going on in completely different gamer communities, such as FPS modding, which have nothing to do with Interactive Fiction and CYOA at all. So I need to schedule my time accordingly.

I can't even tell at this moment if I'm going to take part in the next IFComp 2012 or not. So bear with me. I have to make some decisions in the next weeks and months to come...

Quote:
3) Add comments to the Trap Cave source to explain what you're doing.


Well, sometimes I don't even know myself what I'm doing here. I just do it and watch what happens next. :mrgreen:
That's my entire masterplan in this community. Just in case you missed it over the last 3 years.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 4:03 pm 
Offline

Joined: Sat Dec 22, 2007 9:44 pm
Posts: 180
Back when Trap Cave was released, I managed to work out the obfuscation methods and deduced most of what you've written here.

And I'm not necessarily asking for Trap Cave, but I do think there's not much point in releasing a system without some sort of example game.

Also consider having your Node-X generate Javascript output. Take a look at The Play and Clod's Quest.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 4:58 pm 
Offline

Joined: Sun Oct 02, 2011 4:05 am
Posts: 46
ralphmerridew wrote:
Back when Trap Cave was released, I managed to work out the obfuscation methods and deduced most of what you've written here.


Good for you.

Quote:
And I'm not necessarily asking for Trap Cave,


Ofcourse you don't ask for Trap Cave, Ralph. Exactly my point. LOL

Quote:
but I do think there's not much point in releasing a system without some sort of example game.


You are really an impatient guy, aren't you. Just what do you think was about to happen next in this thread? Why don't you just be silent, sit back and enjoy.

Or as we Germans say: Immer mit der Ruhe, Junge. Nicht so hetzen. Ein Mann ist doch kein D-Zug. :roll:

Quote:
Also consider having your Node-X generate Javascript output. Take a look at The Play and Clod's Quest.


You know, right now I would rather like to write an example game (or better say tutorial) for other NodeScript authors out there. And I ask you to let me do it now instead of ranting about something which I won't rant with you about, okay? Thank you. Have a nice day and sleep well.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 5:02 pm 
Offline

Joined: Sun Oct 02, 2011 4:05 am
Posts: 46
Alright, cool people and CYOA authors out there. After we sorted this out and Ralph has got his extra info now that there will be no english version of Trap Cave, although that wouldn't be a bad idea, we can now go back to business as usual and let's hope we are not distracted again...


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 5:14 pm 
Offline

Joined: Sun Oct 02, 2011 4:05 am
Posts: 46
So now after I posted the de-obfuscated NodeScript reference guide here, I'm going to continue with a tutorial and an example game in NodeScript now, what I intended to do as a next step anyway, before someone rude in here jumped on me so impatiently about it. Well, patience seems to be a rare quality trade these days. Anyway, let's start, shall we...

NodeScript Tutorial - Example

Ok, before you guys start to write any CYOA game in NodeScript, you should first make a concept of your environment. You could draw a floorplan, for instance. So let us make one now...

Here it is:

Image


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 5:35 pm 
Offline

Joined: Sun Oct 02, 2011 4:05 am
Posts: 46
Now let me explain the floorplan (see above):

So this is just an example game. So we are not doing anything special here, just two rooms connected with a corridor to navigate in, so you guys can get a basic idea how to connect nodes in NodeScript and have basic adventure game layout for later expansion.

The green dots are our nodes. There is a total of 7 nodes for our example game here. As you can see, each of the nodes are connected in a logical fashion. Some of these nodes have so-called one-way paths and other ones have two-way paths. The arrows at each end of a line tell you if there is a one-way or a two-way connection between two nodes.

So far so good.

Now after we have made a floorplan for our example game, we have to define what the goal of the game should be. I won't come up with any super complicated puzzle in this example here. Just a basic and short goal for easier understanding. Let's say the player starts in Room A of the appartment (see Node 1, PS for PlayerStart) and his/her goal is to get out of the appartment. Escape the Appartment game, you get the idea. To leave the appartment the player has to open the door and get out. But the door is locked and the key to unlock the exit door lies on the table in Room B. Easy game. Player has to get the key, use it and open the door, then leave. As a little bonus I've also added a couch in Room B where the player can sit down on to rest. Just a fun bonus feature to make even this simple example game look more interesting.

Okay, let us begin scripting this type of adventure game... 8-)

This can actually be done in a few minutes, but I will take a bit longer however, because I will give you detailed descriptions each time of what I'm currently doing.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 6:46 pm 
Offline

Joined: Sun Oct 02, 2011 4:05 am
Posts: 46
Our first step: We open up a text editor. You can run Notepad in Windows, for example.

First thing we do is setting the so-called "shell" for our NodeScript adventure:

Code:
[NX.NodeScript]
Gen=1
EC=NJ

[FI]
D=06/19/2012
T=01:15

[GI]
T=Tutorial Game - Escape the Appartment
A=Comazombie
V=1.0
L=En

[GIF]
LS=double

[FIF]
SF=tutorial1


Easy start. In the header section [NX.NodeScript] we told the engine that we are coding for Generation 1 and that NodeJumper (NJ) is our EngineClass (EC). I left out TextEncode (TE), because we are writing our adventure in plain text and not in encrypted text (Rot13, Rot47, 2Rot). Note that the Node-X engine is smart enough to notice if a variable was set or is missing in the script. If it's missing the engine will assume that the variable should remain unchanged and thus use the default setting for this particular variable. And the default setting for TextEncode (TE) is none or plaintext in this case. Also note that this is not always the case. Some variables have to be set in the script!

In the second section [FI] (FileInfo) we have manually set the date (D) and time (T) on which we started (or finished) writing our adventure. Simple, isn't it.

In the third section [GI] (GameInfo) we have set the title (T) of our example adventure, the name of the author (A), the version (V) of our game and last but not least, the language (L) in which we write our adventure. Notice that you can use three language types in NodeScript, English (L=en), German (L=de) and Custom (L=insert whatever text here). Depending on the language which you set (english or german) the game interface in Node-X will change accordingly. So if you are writing a german adventure then the interface in Node-X will also be in german language. Try not to mix up those two or you will have a game where the adventure itself is written in the one language, but the interface is in the other language. This will only confuse and even piss off gamers, so pay attention to that! :mrgreen:

In the fourth section [GIF] (GameInterface) we can set the interface colors of our adventure. But in this case we are fine with the default colors, so we leave out the color variables and only set the LineStyle (LS).

You can choose between following LineStyles:
single
double
wave
minus
equal
short
dot


The default LineStyle is single (LS=single).

In the fifth section [FIF] (FileInterface) we can define the name of the SaveFile (SF). When the player saves during a game or when the game itself autosaves (providing that we use the PreCallAction=AS for AutoSave feature) then we want the file to be named like that. You can use any desired name here. The filename should not be longer than 72 characters.

The shell for our example adventure is complete.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 18, 2012 7:42 pm 
Offline

Joined: Sun Oct 02, 2011 4:05 am
Posts: 46
Now that we have build our shell, we have to define one more section before we can start to do the actual scripting of our example adventure:

Code:
[Inv]
EN=Body
SEN=hand
SLN=left
SRN=right
SLA=LH
SRA=RH
EV=examine
PV=put
PVA=in


Inventory Interface Customization! This is actually a very interesting and unique feature in Node-X, because we can customize the inventory interface to our liking. Ofcourse we assume that our game character is a human, so he/she has a body, a left hand and a right hand in which he/she can carry items, he/she can examine items and put an item in the opposite hand. So we will leave it at that.

BUT, and this is the interesting part, you could replace "Body", "hand" and even "left" and "right" with something else. Same with "examine", "put" and "in". This can be useful for non-human or weird game characters. Use your imagination!

Example:
Let's say our game character (in a different adventure than this!) is a robot which looks like R2D2 from Star Wars, but with long elastic tentacles which can grab and carry items. The robot doesn't examine items, he scans them. Then our custom inventory interface would be defined as follows:

Code:
[Inv]
EN=Bot
SEN=tentacle
SLN=left
SRN=right
SLA=LT
SRA=RT
EV=scan
PV=put
PVA=in


The element name (EN) would be "Bot" in this case, not Body. The sub-element name (SEN) would be a "tentacle" attached to both sides of the robot, left and right (SLN, SRN). The robot will not "examine item", but "scan item" (EV) as a choice in inventory mode (press the "I" key during a Node-X ingame session). The robot will "put item in left tentacle" or "put item in right tentacle". That's how the Node-X engine uses all the variables in the inventory interface.

As I said, this way you can define a custom inventory for a specific game character. Again, use your imagination! Maybe you can come up with something really unique and cool.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group