Skip to content

Unnamed Game is a fun game without a name (yet)! And you, the bravest explorer, are given the job to find the name for this game!

Notifications You must be signed in to change notification settings

HelloElwin/UnnamedGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📢 More maps are coming out in May! (Sorry, this is fake news.)

Unnamed Game

demonstration

Team members

Li Han (3035845954) @Kelios1556

Ye Yaowen (3035845344) @HelloElwin

Introduction

"Unnamed Game is a fun game without a name (yet)! And you, the bravest explorer in HKU, are given the job to find the name for this game! The name is hidden in a secrete room in a world of ice and flame, and your journey starts from a certain point in this world. At the end point lies the entrance of the secrete room and your ultimate goal: name for the Unnamed Game!"

This is a keyboard-based adventure game for one player controlled by wasd. The player is suggested to kick in a way to travel to the destination.

A list of features including portals, gravity switches, world converters etc., are designed to assist the travel. Two properties, ice and flame, are attached to the player, elfins and grounds. Under opposite properties, elfins and grounds may be dangerous to the player.

[Video Demonstration in Google Drive] [Video Demonstration in this repo]

Quick Start

Start the game with these commands!

Move the character with wasd and select with g. [Sample I/O]

make clean
make main
./main

The game is tested in HKU CS academy11 server. However, we strongly recommend you to run the game locally since the network latency may affect your gaming experience.

Element description

Air

The player will fall/float according the direction of gravity.

Elfin

It can move in horizontal directions with a property of ice or flame. An elfin will move towards the player when the player arrives at the same level. If the player holds the same property as the elfin, the elfin is harmless. It will chase after you, or bounce around you, or fly towards you. Otherwise, if the player holds the opposite property as the elfin's, direct contacting means Game Fails.

Gravity Switch

When the player reaches a Gravity Switch, the direction of gravity will be changed.

Inner World

When the player enters a World Converter from the external world, the player will arrive in the inner world, and vice versa. The properties of some features (e.g., player, elfins, property grounds) may convert upon player's arrival.

Portal

Portals, appearing in pairs, are distinguished by colors. When the player enters a portal from one side, the player will be sent to the same side of another portal with the same color.

Property Ground

They differd from normal grounds as their specified properties. They may be attached with ice or flame as their own property, which might convert to the opposite properties in the inner world. If the player is with the same property as the ground, it can be treated as the normal ground. Otherwise, walking on the ground with the opposite property will result in Game Fails.

World Converter

World converters usually have similar shapes with portals except that they do not appear in pairs. It means that if there's no other portal that is with the same color as this "portal", then it is a world converter. When it is a necessity to pass a block of property ground with the opposite property, or when facing the coming attack from a elfin with the opposite property, the player can enter the external/inner world through these world converters.

Features

  1. Generation of random game sets or events

    • We use random seeds to decide the color of Portals and World-Converters. [link]
  2. Data structures for storing game status

    • We design a class Map to store the information of the map. [link]
    • We design a class Block to store the information of blocks, i.e. ground, portals etc. [link]
    • We design a class Player to store the information of the player. [link]
    • We design a class Elfin to store the information of elfins. [link]
  3. Dynamic memory management

    • We use a vector to store all the elfins in a specific map. When initializing a map, we push the elfin to the vector one by one. At the end of the game, we release all the stored elfins from the vector. [link]
  4. File input/output

    • Before the game, the player needs to choose a map available. The program will read the choice, and the corresponding map file will be loaded from /lib/maps. [link]
    • When the program initializes a map, the corresponding templates of different blocks (E.G., portals, gates, grounds) and the elfin are loaded to fill the content of the map. [link]
    • After the player wins a game, the success record will be saved to pass.txt. [link]
  5. Program codes in multiple files

    .
    ├── main
    ├── Makefile
    ├── README.md
    ├── src
    │   ├── *.cpp
    │   ├── *.h
    ├── bin
    │   ├── *.o
    ├── lib
    │   ├── blocks
    │   │   ├── *.txt (block models)
    │   └── maps
    │       ├── *.txt (maps)
    │       ├── conio.h
    │       ├── description.txt
    │       ├── format.txt
    │       ├── pass.txt
    ├── test
    │   ├── *.py/cpp (test programs)
    ├── pics
    
  6. Implemented functions for game features

    Map initialization

    void Map::init(int map_num);

    Map print

    void Map::print(void);

    Map update

    void Map::update(Player u);

    Map content fill

    void fill(int overall, int *cont, int state);

    Gravity inversion & portal and world-converter delivery

    void Map::check(Player &u);

    World Conversion

    void Map::converter(Player &u);

    Player initialization

    void Player::init(int x0, int y0, int h0, int w0, int s0, int cont[][2], int proty);

    Game status check

    bool Player::alive(Map& map);
    bool Player::success(Map& map);

    Player move

    void Player::move(char direction, Map& map, bool& moving);

    Elfin initialization

    void Elfin::init(int x0; int y0, int h, int w, int cont[][6], int proty, int lel);

    Elfin move

    void elfin_move(Map& map, Player& player, bool& touch, bool& moving);

    Window size reminder

    void sizecheck(void);

Non-standard libraries

  • termios.h is used to monitor keyboard input

    #include <termios.h>
    struct termios;
    int txgetattr(int, struct termios *);
    int tcsetattr(int, int, struct termios *);
  • sys/ioctl.h is used to get the row and column of the window

    #include <sys/ioctl.h>
    struct winsize;
    ioctl(int, usigned long, struct winsize *);
  • conio.h is used to determine whether a key has been pressed or not

    #include <conio.h>
    int kbhit(void);

About

Unnamed Game is a fun game without a name (yet)! And you, the bravest explorer, are given the job to find the name for this game!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages