Chan Sze Wing (UID: 3035745063, Username: adhk852)
Chan Yuen Kwan (UID: 3035781641, Username: jojochan09)
This is a text-based role-playing game which simulate a person surviving on an uninhabited island, inspired by an existing mobile game Draw Card Life and the movie Cast Away.
You are a passenger of a cruise ship, due to a shipwreck you are now stranded on an unknown island. On this island, you will collect resources that can help maintain your life. Meanwhile, different events may happen and can cause danger or bring surprises. In this game, everything is random, so good luck.
-
Your status represented by:
- HP: the value that represents health point, drop if you are
- being attacked or getting hurt
- too hungry (Hunger below 50)
- mentally unstable (Mentality below 50)
- Hydration: the value that represents your thirst, it will drop every day
- Hunger: the value that represent your hunger, it will drop every day
- Mentality: the value that represents your mental status
- HP: the value that represents health point, drop if you are
-
If HP/hydration go to 0, you will die and lose the game
-
Every day starts, you will find 3 resource item
Categories of resources you may obtain:
- Food: increase your Hunger value
- Water: increase your Hydration value
- Medicines: increase your HP or Mentality value
- Weapons: for fighting against attackers
- And some Mystery items
-
All resources will be saved in the Item Pack, you can use them on the same day or later
-
Random events will happen every 3 days, which may affect your status
-
How to Win
- Survive for 50 days, and
- Maintain your HP and Hydration above 0
Dowload as Zip file:
- Download the zip file and extract all its files.
- Open a terminal at the extracted file and input
make
ormake survival
. - After compiling, input
./survival
to start game.
Look like this:
make
./survival
Git Clone:
- Open the terminal and clone the game source by inputing
git clone https://github.com/adhk852/ENGG1340-Project-Group-188.git
. - Input
cd ENGG1340-Project-Group-188
to change directory. - Input
make
ormake survival
. - After compiling, input
./survival
to start game.
Look like this:
git clone https://github.com/adhk852/ENGG1340-Project-Group-188.git
cd ENGG1340-Project-Group-188
make
./survival
Reminder:
*please only input 1 key each time
*please input number only, no letter
*please use X2go academy11 server terminal to execute, do NOT use SSH client
-
Draw Resource
The player can draw 3 random resource items every day, and the cards they have drawn will be stored in the Item Pack for future use.
Coding element:
-
Generation of random game sets or events
The 3 cards drawn will be generated randomly using
rand()
andsrand(time(NULL))
. -
Data structures for storing game status
Self-defined data structure
Item
will be used to store the information of the items, while data structurearray
and data typesstring
andint
will be used in the data structure. Note that data structureItem
is stored instructures.h
. -
Dynamic memory management
The 3 drawn items will be stored in a dynamic array by
new[]
. The memory will then be freed after the cards are saved in the Item Pack bydelete[]
. -
Program codes in multiple files
Codes of all the items' information and the drawing mechanism will be stored in files
data_items.cpp
anddraw_item.cpp
respectively, seperated frommain.cpp
. Whichdraw.cpp
will call the informations of the items fromdata_items.cpp
.
-
-
Random Event
A random event will happen every 3 days.
Coding element:
-
Generation of random game sets or events
The events will be generated randomly using
rand()
andsrand(time(NULL))
. -
Data structures for storing game status
Self-defined data structure
Event
will be used to store the infomation of the events, which data structurearray
and data typesstring
andint
will be used in the data structure. Note that data structureEvent
is stored instructures.h
.
-
-
Fighting Attackers
The event of player being attack and need to fight back.
Coding element:
-
Data structures for storing game status
Self-defined data structure
Attacker
andItem
will be used to store the infomation of the attackers and weapons, which data structurearray
data typesstring
andint
will be used in the data structures. Note that data structureAttacker
andItem
are stored instructures.h
. -
Dynamic memory management
The quantity of weapons the player has will be stored in a dynamic array by
new[]
. The memory will then be freed after the fight ends bydelete[]
. -
Program codes in multiple file
Codes of the fighting mechanism and the attackers are stored in files
fight.cpp
anddata_attackers.cpp
respectively, seperated frommain.cpp
. Whichfight.cpp
will call the informations of attackers fromdata_attacker.cpp
.
-
-
Daily Decrease in Hydration and Hunger value
The player's Hydration and Hunger value will decrease a certain amount when a new day started
-
Generation of random game sets or events
The amount of decreation will be generated randomly using
rand()
andsrand(time(NULL))
. -
Program codes in multiple files
Codes of the function for reducing Hydration and Hunger value will be stored in file
player_status.cpp
(also the function for printing out player status), seperated frommain.cpp
. Whichmain.cpp
will call this function fromplayer_status.cpp
.
-
-
Save and Resume gameplay
Player can quit and save the game and resume it later.
Coding element:
-
Data structures for storing game status
Data structure
array
will be used to store the game status components, including the player status and the quantity of items from different catagories in the item pack. -
Dynamic memory management
All the arrays used to store the game status components are dynamic arrays which are created by
new[]
. The memory will be freed after the player quit the game bydelete[]
. -
File input/output
When starting a new game, datas in the file
new_game.txt
will be inputed as the intial game status. After the player quit the game,game_status.txt
file will be created (if it was a new game) and the game status will be outputed to this file. When the player resume the game,game_status.txt
file will be loaded back to the game. If the player win/lose or started a new game,game_status.txt
file will be removed.
-
ENGG1340.Project.Game.Demo.1.mp4
- used <unistd.h> which allow to use sleep( ) function
- sleep( ): printing the information with delay
- Game Mechanism: Draw Card Life https://www.taptap.com/app/35686
- Item: Survive - Wilderness survival https://play.google.com/store/apps/details?id=com.sandbaygames.survive