📜 ⬆️ ⬇️

Abnormal programming. IF game development

Game development



Who has not dreamed of trying to develop their own game. We will create a game in the style of interactive fiction. The plot I took on the site of one of the programming systems RTADS . The system is localized in Russian and contains a complete set of tools and manuals for programming. But ... We will program in another system Inform7 I like it more, because I love English. So the plot.

Plot


... As an example, we will develop a game whose action will take place at a small airport. Our airport will have a terminal, a central hall, as well as exits to the aircraft.

In addition, one of the exits will be an airplane. In the terminal there will be a ticket counter and a metal detector, through which it will be possible to pass to the central hall. In the central hall there will be a buffet and a locked door leading to the service area. In the hall with access to the aircraft will be located several such exits, as well as a locked shield. Here is a preliminary map of our game.

This map has a couple of closed zones, which is very convenient when creating puzzles. In addition, the metal detector is useful to us, since it will not allow the player to carry some objects through it. The plane can also be used for the puzzle, because usually you need a ticket to get on the plane. Plus, access to the cockpit is allowed only to flight personnel.

Let the ultimate goal of the segment of the game unfolding at the airport be to leave the airport. The player will start the game in the building of the main terminal, but he will not be able to leave the airport - we will come up with some reason, such as a crowd of people crowded at the entrance to the airport, through which not to get through. (Of course, if it were a complete game, a part of the game world would probably be located outside the airport, and we would not use such a far-fetched reason to restrict the player’s movements. But for this example, we will use it so that, as they say, " do not crawl without need). The only other possible way to leave the airport is to fly by plane; so let it be the goal of our game.
')
To raise the plane in the air, the player will need to get into the cockpit. (Our example will end on the fact that the player has penetrated there; in the full-size game we probably would have allowed the player to fly somewhere). However, only flight personnel are allowed to enter the cockpit - the flight attendant does not allow passengers into the cockpit. So we need to find a way to get past the flight attendant. One such way is to distract her for a long enough time to slip past her into the cabin; in our game, however, the player will need to find the form of a pilot.

Where is it logical to place the pilot's uniform? For example, in the flight room of flight personnel; Well, we will place in this room a suitcase in which the form will lie. Fortunately, the rest room is hidden behind a locked door, which automatically creates another auxiliary riddle. To get into the closed service area and take the form from there, the player will need a magnetic key card to unlock the corresponding door (by inserting the card into the reader slot located next to the door).

We will place the magnetic card in an easily accessible place - at the ticket counter in the terminal. However, we will not allow the player to carry it through the metal detector - the alarm will work and the security officer will select the card (and put it back on the rack so that the player can try to carry it again). To bring the card through the metal detector, you will need to disable it.

We will put the switch in the cleaning room, locked with a key. The key to this room will be placed in the toilet of the aircraft along with some other items of cleaning equipment - a bucket, a rag, and a garbage bag, so that the player by association can guess that the key lying there is also likely to be from the cleaning room.

To get to the toilet on the plane, you need a ticket for this plane. We will make it so that a ticket can be detected relatively easily: we will hide it in a newspaper that was forgotten by someone in the buffet. As soon as a player picks up a newspaper, a ticket will fall out of it.

That's the whole game: you go to the buffet, take a newspaper and find a ticket. Taking a ticket, you board the plane, go to the toilet and take the key from the cleaning room. Go with this key to the cleaning room, unlock it, go in there and turn off the metal detector. Then you return to the ticket counter, take a magnetic card, go to the service area and unlock the door leading there using the card. You go into the rest room of the flight personnel, take out the uniform of the pilot from the suitcase and dress it. Then again go to the plane and pass into the cabin past the stewardess.

Now we can draw a new map, marking on it with information about the most important objects and actions, of which, in fact, the game will consist.


Card implementation


In accordance with the rules of the Inform language (which is practically natural English), we look at the map and write:

Section 1 Map

The Terminal is a room. "It is a large hall with many people.".
The Ticket Counters is east of the Terminal. "Some people choice the direction here and buy the ticket.".
The Security Gate is north of the Terminal.
The metal detector is a door. It is open. It is north of the Security Gate and south of the Concourse.
The Snack Bar is east of the Concourse.
The wood door is a door. It is lockable and locked. It is east of Security Area and west of the Concourse.
The Pilot Lounge is south of the Security Area.
The Security Centre is west of the Security Area.
The Gate Area is north of the Concourse.
The metal door is a door. It is lockable and locked.It is east of the Gate Area and west of the Maintance Room.
The Gate 1 is northwest of the Gate Area.
The Gate 2 is north of the Gate Area.
The Gate 3 is northeast of the Gate Area.
The Jetway is east of the Gate 3.
The Front of Plane is east of the Jetway. Stewardess is a woman in the Front of Plane.
The thin door is a door. It is south of the Cockpit and north of the Front of Plane.
The Rear of plane is south of the Front of Plane.
The Bathroom is south of the Rear of plane.

Do not be surprised this is a real programming language. The platform is based on the principles of Literary programming . Compile, select the tab Index -> World, we get:

Very close to the text. You can walk on the map (tab Game):
airport
An Interactive Fiction by AlexChin
Release 1 / Serial number 091013 / Inform 7 build 5Z71 (I6/v6.31 lib 6/12N) SD

Terminal
It is a large hall with many peoples.

>n

Security Gate
You can see a metal detector here.


Implementation of items


We add the code:
Section 2 Items

The Ticket Counters contains counter. On the Counter is a ID card.

The electric switch is a switched on device in the Maintance Room. The electric switch is switched on.

The brass key unlocks the metal door. It is in the bathroom. The pail, sponge, garbage bag are in the bathroom.
The News Paper is in the Snack Bar. "You can see a News Paper here." It is closed, not transparent container. The description of it is
"You read a few articles, and promptly become depressed.
The federal deficit just went up by another twenty billion dollars, but it's
all off budget, so it doesn't really count. The economy had yet another downturn, but the
President says he's confident that the recovery is just around the
corner and picking up steam.".

The Boarding pass is in the News paper. The description of it is "Boarding pass. Luht franza board 0923. Place A. Row 25. Class B".

The slot is a container. The description of it is "Ordinary slot at wall".It is in the Concourse.
The suitcase is the openable closed container. It is in the Pilot Lounge. The Pilot uniform is in the suitcase. IT is wearable.


Implementation of special reactions


Section 3 Special Behavior

Before opening the thin door:
if player wear the uniform:
say "Second pilot! Welcome on board!";
continue the action;
otherwise:
say "For staff only!";
stop the action.

After going to Cockpit:
end the game in victory;

After going through the metal detector:
if player carry id and electric switch is switched on:
end the game in death;
otherwise:
continue the action.

After taking the news paper:
Now the boarding pass is in the location;
say "The piece of paper fall down at the floor";
continue the action.

Carry out inserting something into the slot:
if noun is id:
say "Click!";
now the wood door is unlocked;
otherwise:
remove the noun from play.

Report inserting something into the slot: say "[if noun is not id][The noun] falls out of sight, and you know you will never see it again."

Instead of giving pass to Stewardess:
now Stewardess carries pass;
say "All Right, Please find your place rear of plane".

Instead of going from Front of Plane to Rear of plane:
if Stewardess carries the Boarding pass:
continue the action;
otherwise:
say "Stop. Give me pass";
stop the action;


Conclusion


We wrote the skeleton of the game. You can play it, but of course there is not enough literary descriptive component. Although there are enough experiments in it. You can play with the slot or go with the ID card through the metal detector.

References:


Abnormal programming. Maybe God wrote so?
Competition Games Interactive fiction Competition 2009

Source: https://habr.com/ru/post/72310/


All Articles