uchicago-cs / chiventure

A text adventure game engine developed in UChicago's CMSC 22000 - Introduction to Software Development
40 stars 13 forks source link

Write test cases for spawning NPCs in room and creating a movement path corresponding to them. #629

Open shayna-k opened 4 years ago

shayna-k commented 4 years ago

We have added the framework and initial implementation for spawning NPCs in rooms and are working on setting movement paths for them. We thought of adding some test cases that would combine these features and test them.

shayna-k commented 4 years ago

It is a little late in the sprint to create an issue but we will try our best to wrap up implementation and testing soon. Our current implementation for these two functions is as follows:

/* Struct that contains all the npcs in a given room with room_id */
typedef struct npcs_in_room {
    /* hh is used for hashtable, as provided in uthash.h */
    UT_hash_handle hh;
    char *room_id;
    npc_hash_t *npc_list; //hash table storing the npcs that are in the room
} npcs_in_room_t;

typedef struct npcs_in_room npcs_in_room_hash_t;

/ the struct for the indefinite path movement for npcs / typedef struct mov_indef { path_llist_t npc_path; time_in_room_hash_t room_time; } mov_indef_t;

/ the main struct that deals with the movement of an npc / typedef struct npc_mov { char npc_id; npc_mov_types_u npc_mov_type; mov_type_e mov_type; //an enum saying which type of movement the npc is doing, this is purely to simplyify the implementation char *track; } npc_mov_t;



The test cases should be such that they account for all possible creations and movement paths. This issue depends on prior code being completed, and hence, will be moves to the fourth sprint as needed. Updates shall follow.
shayna-k commented 4 years ago

We are almost finished with our implementation for the types of movements and the NPC movement feature. We have been committing new changes to our files and structs and updating the wiki as well. We will simultaneously begin writing test cases for the movement feature and then gauge if it is feasible to complete this task in this sprint or close it and take it up in the subsequent sprint.

shayna-k commented 4 years ago

We completed all basic implementation specified in the wiki for NPC spawning in rooms ( #555 ) and movement paths ( #572 ) . We have also written test cases for each of these features individually.

We will be implementing more complex features of the NPC movement through rooms, which will account for actually moving NPCs around the world. We have submitted a pull request for the newest movement feature. We also thought it would make more sense to think about testing both the features when the second feature has been implemented completely, since that would lead to us accounting for a broader class of test cases.

Since we are at the end of this sprint and our implementation took a little longer than we anticipated, we will be closing this issue for this sprint. We will gauge the need for taking up a similar issue as this, in the subsequent sprint.

shayna-k commented 4 years ago

Update: This task has been reopened since it seems to be something that should be explored nonetheless. We will be moving this to the fourth sprint and since we were not able to get to it in the third sprint, we will aim to get to it in this sprint.

shayna-k commented 4 years ago

We had a holdup with code from the precious sprint, which was on NPC movement itself, and decided to work on that since the testing of the features would happen collectively after their implementation is complete.

Seeing that we will not be able to implement these tests during the fourth sprint, I will be moving this to the backlog since it would be good to test out this functionality.