Sie sind auf Seite 1von 8

COMPRO2

Machine Problem

Release Date
Due Date

:
:

SIMPLE ROGUELIKE DUNGEON GENERATOR/CRAWLER


Roguelikes are dungeon crawling video games that have procedurally generated semi-random levels which are
created on the fly. Inspired by table-top role playing games like Dungeons and Dragons, a roguelike game often
incorporates a high-fantasy theme, with monsters and treasures scattered in an ever expanding and almost
infinite landscape. Since the levels are generated on the go, no two playthroughs are exactly alike.
The term Roguelike is derived from the 1980s game Rogue, one of the first roguelike games and arguably the
one that popularized the sub-genre. A favorite among UNIX systems, in this game the player assumes the role of
an adventurer out to explore an unmapped dungeon. Starting from the top-most floor, the player must work his
way lower and lower down the dungeon, fighting monsters and collecting treasure. The goal is to retrieve the
ultimate treasure of all, the Amulet of Yendor. In this game, the treasures and monsters are represented as single
characters, and the game is played in a turn-based fashion.
One famous modern day descendant of the roguelike sub-genre is Torchlight and its sequel Torchlight 2. The
game follows a very similar premise; explore dungeons, fight monsters, kill the final boss monster, collect
treasures and progress the story. There are also savepoints and shops in cities scattered in between the levels,
allowing the player some reprieve from the action and a chance to upgrade their weapons and armor, which in
turn allows them to fight even harder enemies and explore even more far-flung dungeons.
For this machine project, you are going to make a roguelike game called Xiprogg C1X (but you can change this
to whatever name you want, more on this later). Xiprogg C1X is set in a post-apocalyptic cyber-punk world in
the year XX72, where after countless alternating eras of war and peace have ravaged cities and took its toll on
civilization. Set in an era of peace, descendants of the survivors of the last Great War have taken refuge in
bubble cities, using forgotten technology to survive. However, the resources in these bubble cities are limited at
best; if they even have enough resources at all to feed its growing population. This has led bubble cities to send
raiders against other bubble cities in a desperate attempt at survival, using whatever lost technology they have
against each other in a brewing power struggle that threatens to send civilization into another Great War.
The seeds have been sown.
In response to this growing threat, the bubble city of Xiprogg C1X has sent salvagers to look for lost technology
in the web-like underground labyrinth connecting the bubble cities, in itself another lost technology, a legacy of
a bygone era. The passageways of this labyrinth were rumored to be replete with weapons and other resources.
However, centuries of isolation from the surface world and exposure to lost technology has morphed its flora
and fauna, turning them into hunters and predators, each more viscous than the last. Xiprogg C1X sends many
salvagers, but only few of them ever return, and those few return with soulless eyes and broken bodies.
There are rumors among salvagers, however, that one of the seemingly infinite rooms of the underground
labyrinth is different from every other. This room, according to the hopeful myths, contains the key to
preventing another Great War. The ultimate lost technology, this room contains the collective memories of all
civilizations from the past eras, in an effort to send them off to the future in the hope that they will serve as a
warning for future civilizations; if found, this room could stop the impending Great War, and usher in an infinite
era of peace for the whole world.
Page 1

SYSTEM COMPONENTS ROOMS


Rooms and room generation are two of the major components of this machine project. Each room has a
maximum of four exits and a minimum of one exit, and can either contain a monster, a treasure (lost
technology), a weapon or be empty. The player can also set-up a surface link (save point and shop) on any
empty room; this surface link will be left in the room and should remain in the room when visited again later.
Defeating a monster or collecting treasure, weapon or armor will turn an otherwise occupied room empty, in
which case, you can set up a surface link on it.
A room can look like this:

T
P

This room has three exits, one on the east, west and south sides of the room. There can only be one exit per side
of a room (hence why a room can have up to four). This room also contains a treasure (labeled as T), with P
indicating the player location. From here, you may have the player approach the treasure to collect it, or go
through any of the three exits to make the player leave the room.
It is up to your discretion if you want to display the rooms adjacent to the current room the player is in, or to
only display the room the player currently is in. It is important however that once a room has been generated,
its configuration must NOT be changed. Exits, unencountered monsters, uncollected treasure, weapon or armor
and surface links that were previously set up must remain where they are. Remember also that defeating a
monster or collecting treasure, weapon or armor will make the room it occupied empty, if I leave the room and
return to it again, it should remain empty.
What this means is, if I find a monster in a room with a north and south exit, then I head north (avoiding the
monster), if I head back south I should be back in the room with the monster and with a north and south exit. If I
defeat the monster and head south, then head back north, I should be back in the room, this time the room will
be empty but will still have a north and south exit. If I set up a surface link and head north, then back south
again, I should once again be in the same room, this time with a surface link and a north and south exit.
Of course, it goes without saying that exits and entrances must make sense. What this means is that rooms must
be connected, with an exit to one room being connected to the exit of another room; I should be able to
backtrack to previous rooms I have already visited. The rooms need not make sense in 2D space, however.
Finally, after one hundred rooms are generated (this number of rooms should be easy to change), the next room
generated should be the mythical room mentioned in the project description. Entering this room should trigger
the victory of the player, and should take the player to a victory screen.

Page 2

SYSTEM COMPONENTS PLAYER


In this machine project, you control a salvager, which you will have to name at the start of one game session.
This salvager will serve as the players avatar throughout his or her adventure through the labyrinth. At the
start of the game, the player is given 7 points which he or she may distribute freely to any of the following stats:

LVL determines how much the player has progressed, and starts at 1 plus any points distributed to
this stat by the player. This is raised as the player defeats enemies or encounters treasure. The amount
of treasure or enemies required to raise the level is equivalent to 30% of the players level rounded up.
DMG determines move much damage the player deals to enemies. This value by default is equivalent
to 80% of the players level rounded up plus any points distributed to this stat by the player, and is
increased by the DMG value of the weapon the player is currently using.
DEF determines the amount of damage mitigated when the player takes damage. This value by default
is equivalent to 20% of the players level rounded up plus any points distributed to this stat by the
player and is increased by the DEF value of the armor the player is currently using.
HP determines how much damage a player can take before dying. The maximum value of this is
equivalent to the players LVL plus any points distributed to this stat by the player and is increased by
the HP value of the armor and the HP value of the weapon the player is currently using. Changing
weapon or armor does not restore HP, it merely increases the players maximum HP. HP is only
restored fully when using surface links. Should the players HP drop to 0, the game is over.
CON determines how much health the player regains after defeating a monster or encounters treasure.
This is equivalent to 20% of the players HP rounded up plus any points distributed to this stat by the
player.

Note that the player only distributes points when the salvager is created (i.e. when the salvager is named). No
other points are distributed to the stats as the game proceeds.
The player also maintains an inventory of items. These items are composed of treasure, weapons and armor,
and the player is permitted to carry as many items he or she can collect. The player, however, can only equip
one weapon and one armor at a time, though he or she may freely switch weapons or armor at any time.
Finally, a player has an amount of credits, which will serve as the players points. A high score table must be
maintained for the game, which contains the top ten points and the names of the players who got them. Victory
in the game is not necessary to achieve a high score, once the end of the game is reached either via victory or
defeat, the players score is considered for the high score table.

SYSTEM COMPONENTS ITEMS (TREASURE, WEAPONS AND ARMOR)


As mentioned, a player may carry as many treasures, weapons and armor as he or she wants. There is no limit
to the players inventory, but a player may only equip one armor and one weapon at a time. Items can be
collected by moving into the item. This will cause the player to move onto the item and the item will be added to
the players inventory.
Treasures are items that cannot be equipped to the player, but serve other purposes. All treasures have a name
and an equivalent value. Primarily, treasures allow players to set up surface links, doing so will destroy the
treasure used to set up the surface link. From a surface link the player may save the game and sell any items the
player wants to get rid of. Remember that accessing a surface link restores the player back to full health, and
that a surface link may only be set up on an empty room. Selling a treasure will increase your credit amount
Page 3

equivalent to the value of the treasure. Collecting a treasure instantly restores HP to the player equivalent to the
players CON (though this must not cause the players HP to exceed its maximum value).
Treasures are randomly generated whenever a treasure room is encountered for the first time (thought once
collected, the room will become an empty room). It is up to you how you will generate the name of the treasure,
but its value is computed via the formula:
(

Each salvager always starts with a Sentimental Necklace, which has a value of 10.
Weapons are offensive items a player may equip to help him or her deal with the enemies encountered in the
labyrinth. Each weapon has a name, a DMG value, an HP value and an equivalent value. Weapons are randomly
generated whenever a weapon room is encountered for the first time (thought once collected, the room will
become an empty room). It is up to you how you will generate the name of the weapon, but its value is
computed via the formula:
(

Its DMG value is computed via the formula:


(

))

And its HP value is computed via the formula:


(

Each salvager always starts with a Standard Issue Forceblaster, which has a value of 2, a DMG value of 1 and
an HP value of 1.
Armors are defensive items a player may equip to help him or her deal with the enemies encountered in the
labyrinth. Similar to weapons, each has a name and an HP value but instead of having a DMG value, armors have
DEF values. Armors are randomly generated whenever an armor room is encountered for the first time
(thought once collected, the room will become an empty room). It is up to you how you will generate the name
of the armor, but its value is computed via toe formula:
(

Its DEF value is computed via the formula:


(

))

And its HP value I computed via the formula:


(

Each salvager always starts with a Standard Issue Salvager Uniform, which has a value of 3, a DEF value of 1
and an HP value of 2.
If the players items arent converted to credits (and thus to points), they wont count towards the players final
points.

Page 4

SYSTEM COMPONENTS ENEMIES AND ENEMY ENCOUNTERS


Enemies are hostile encounters you will have while playing the game. An enemy is spawned every time an
enemy room is encountered for the first time (though once defeated, the room will turn into an empty room).
Each enemy has a name and the following stats. It is up to you how you will name these monsters, but their stats
are generated randomly when they are first encountered (and do not change should the player leave the room
and return to it later).

DMG is the amount of damage the enemy will deal when approached. This value is computed as:
(

HP is the amount of damage the enemy can take before being defeated. This value is computed as:
(

))

Boss monsters have 3 times the HP as a normal monster (its HP is computed using the same formula as a
normal monster, but is multiplied by 3), and will turn into treasure after being defeated (the treasure is
generated the same way you will generate a normal treasure).
To fight a monster, a player would simply have to issue a move command that moves the player to the monster.
Doing so will not move the player but will instead cause the monster and the player to deal damage to each
other simultaneously. Damage dealt is computed using the following formula (note that enemies do not have
DEF, and so their DEF value is 0):
(

Once the HP of the monster has been reduced to 0, depending on whether the monster was a boss or a regular
monster, one of the two may happen:

If the monster was a boss monster, the monster will turn into a treasure, generated as if you were
generating a normal treasure. Moving onto the treasure will collect it.
If the monster was a regular monster, the monster is removed from the room, and the room becomes an
empty room.

SYSTEM COMPONENTS SURFACE LINKS


Surface Links allow the player to save their adventure, sell their items and heal up. Surface Links may be used as
many times as the player wants, it does not expire once used, and thus, once placed, cannot be removed from a
room. A Surface Link may only be placed on an empty room.
To use a Surface Link, the player must issue an action that moves the player to the Surface Link. This will not
cause the player to move, but instead will use the Surface Link. Using the Surface Link immediately restores the
HP of the player back to full, thus healing the player. The player may then either Save the Game, Sell Items or
Close the Link. Saving the Game saves the players current items, equipped items, stats and all the rooms that
have already been explored into a file so they can be loaded back at a later time. It is up to you how many save
slots your game may have, but it is required that you at least have one save slot for your game. Selling items will
bring up another menu where the player may select an item to sell or go back to the main menu of the Surface
Link. Selecting an item here will sell the item, giving the player an amount of credits equivalent to the value of

Page 5

the item in exchange for losing the sold item. Finally, Closing the Link will bring the player back to exploring the
labyrinth (again, the Surface Link itself is not destroyed; it can be accessed again later).
PLAYER ACTIONS, MP PHASES AND DELIVERABLES
At the start of the game, the player will first be asked whether he or she would want to load an existing game or
start a new game.
If the player chooses to start a new game, the player will be asked to name the salvager he or she will be using
for the game session. Then, he or she will be asked to distribute 7 points to any of the players stats (see the
Player section for more information on this).
If the player chooses to load an existing game, the chosen game is loaded and the player may continue playing.
Afterwards, the screen is cleared (you may use the statement system("cls"); to achieve this) ,the player will
be placed in an empty room with four exits. From here, the player may choose any of the following actions:

MOVE moving will prompt the user to input a direction (if you dont want to implement it this way,
you may choose a different implementation), then the player will move one space towards that
direction. The direction choices are North, South, East and West. Note that moving into treasure,
weapon or armor will collect the item, and moving into a monster will fight that monster.
CHECK INVENTORY this action will clear the screen and display all the contents of the players
inventory. Doing so will bring up a numbered list of items, and will prompt the user to either go back to
the game (which will bring the player back to the room he or she was in) or enter a number from the list
of items. Doing so will clear the screen and display the details of that item. The player may then exit the
display and go back to the numbered list of items in the inventory.
SET UP SURFACE LINK this action will clear the screen and display a numbered list of all the treasures
in the players inventory. Selecting one of these treasures will trigger the setting up of a surface link, and
the surface link will be placed in the center of the room the player currently is in. Note that a player may
not select this action if the room was not empty.
EQUIP WEAPON this action will clear the screen and display the players stats and the currently
equipped weapon of the player, followed by a numbered list of all the weapons a player may equip
(taken from his or her inventory). Selecting a number will swap the weapon in the players inventory
with the weapon the player is currently equipping, and will take the player back to the room where he
or she was in.
EQUIP ARMOR this action will clear the screen and display the players stats and the currently
equipped armor of the player, followed by a numbered list of all the armors a player may equip (taken
from his or her inventory). Selecting a number will swap the armor in the players inventory with the
armor the player is currently equipping, and will take the player back to the room where he or she was
in.
CHECK SELF this action will clear the screen and display the players current stats. The player may
then go back to the room where he or she was in.

The availability of these commands, however, is dependent on the MP Phases. The following is a run through of
the MP phases and what you need to prepare for each.

Page 6

Phase 1
For phase 1, the player can only MOVE or CHECK SELF, which behaves similarly to how they were described but
with a few changes.
If the player heads north of the starting room, the player encounters a room with a regular monster (the
monster will be generated randomly) with only one exit (the south exit), and may fight the monster. Once
defeated, the room becomes empty. If the player leaves the room and re-enters, a new regular monster is
generated.
If the player heads west of the starting room, the player encounters a room with a treasure with only one exit
(the east exit), which the player may collect. Collecting the treasure follows the regular procedure for collecting
treasure, but instead of the treasure being stored in the inventory of the player, the treasure is sold
immediately. Leaving and re-entering the room generates a new treasure in the room.
If the player heads east of the starting room, the player encounters a room with a weapon with only one exit
(the west exit), which the player may collect. Collecting the weapon follows the regular procedure for collecting
weapons, but instead of the weapon being stored in the inventory of the player, the weapon is equipped
immediately. Leaving and re-entering the room generates a new weapon in the room.
If the player heads south of the starting room, the player encounters a room with armor with only one exit (the
north exit), which the player may collect. Collecting the armor follows the regular procedure for collecting
armor, but instead of the armor being stored in the inventory of the player, the armor is equipped immediately.
Leaving and re-entering the room generates a new armor in the room.
As you might have noticed, the rooms are not generated at random for phase 1.
Phase 2
For phase 2, you are expected to complete the whole machine project as specified in this document, along with
all the actions and random room generation.
Deliverables
For both phases, you are expected to submit the source code of your machine project as an attachment to your
instructors email, along with the function specifications document (see the separate section on this function
specifications document). Use the subject [COMPRO2] Machine Project Phase <phase number> - <last name>,
<first name> and send it to dimaunahan.ryan.dlsu@gmail.com on or before the specified deadline in your
syllabus.
Function Specifications Document
The format of the function specifications document is as follows. This document is basically a table form
explanation of the functions you used for your program. Take note that failure to follow the format specified will
merit a 0 for your machine project. Failure to submit this document would likewise merit a 0.
Function Name
move

Description
This function moves direction
the player in a certain
direction
*pRoom

Input Parameter
the direction the player is
heading to
a pointer to the current
room

Return Data
This function returns the
address of the new room
the player is heading to.

Page 7

GENERAL REQUIREMENTS
The following general set of guidelines should be followed:
1. The implementation of this project will require you to use C (not C++) to be compiled and ran with
DevC++, or the command prompt compiler.
2. You are required to create and use functions whenever possible. Make sure to modularization principles
properly. No brute force solution.
3. The above description of the program is the basic requirement. Any additional feature will be left to the
creativity of the student. Bonus points would be awarded depending on the additional implemented
features. These additional features could include more logical items and monster generation, better
combat mechanics, etc.. Depending on the scale of the new feature, additional points will be awarded to
the student. However, make sure that all the minimum requirements are met first; if this is not the case
then no additional points will be credited despite the additional features.
4. For the minimum requirements of this MP all features specified in the document should be present and
working. A text based interface would do.
5. Do not forget to include internal documentation (comments) in your code. At the very least, there
should be an introductory comment before every method.
6. Statements and methods not taught in class can be used in the implementation. However, these are left
for the student to learn on his or her own.
7. Submission of the project is on the indicated submission deadlines. Late submissions WILL NOT BE
ACCEPTED.
8. Any instruction not followed will incur deductions (or a 0.0).
9. This project is individual. Copying other peoples work and/or working in collaboration (i.e. sharing
code) with other students are not allowed and are punishable by a grade of 0.0 for the entire COMPRO2
course and a case may be filed with the Discipline Office. In short, do not risk it; the consequences are
not worth the reward. (Also, what is a measly passing grade compared to a life-long conscience
burden?)
10. During the MP demo, the student is expected to appear on time, to answer questions in relation to the
output and to the implementation (source code) of the project, and/or to revise the program based on a
given demo problem. Failure to meet either of these requirements could result to a grade of 0.0 for the
project.
11. It should be noted that during the MP demo, it is expected that the program can be compiled
successfully and will run. If the program does not run, the grade for that phase is 0. However, a running
program with complete features may not necessarily get full credit, as implementation (i.e., code) will
still be checked.

Page 8

Das könnte Ihnen auch gefallen