Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement and create a context struct for the generation algorithm #538

Closed
edward3-uchi opened this issue May 11, 2020 · 5 comments · Fixed by #617
Closed

Implement and create a context struct for the generation algorithm #538

edward3-uchi opened this issue May 11, 2020 · 5 comments · Fixed by #617
Assignees
Labels
x/rpg-openworld RPG feature random world/room generation
Milestone

Comments

@edward3-uchi
Copy link
Contributor

This context struct will hold the information necessary for autogenerating rooms. As of right now, it will hold just a few things: 1. int level (mock for player-stats) 2. room generation info 3. npc generation info. Later this will hold more info like a linked list of open rooms to be generated and previously generated rooms.

@edward3-uchi edward3-uchi added the x/rpg-openworld RPG feature random world/room generation label May 11, 2020
@edward3-uchi edward3-uchi self-assigned this May 11, 2020
@edward3-uchi edward3-uchi added this to the 2020/Sprint 3 milestone May 11, 2020
@edward3-uchi
Copy link
Contributor Author

edward3-uchi commented May 18, 2020

After meeting today, there have been quite a few changes to the structs for the generation algorithm. First, the context struct (gencontext_t) will contain the following fields:

  • path_t *path: the given path that we need to connect our room to.
  • int level: the level of the player which automates the level of the generated room
  • int openpaths: the number of open paths that should be generated into the new room
  • int numnpcs: the number of npcs that should be generated into the new room
  • speclist_t *speclist: a list of roomspec_t. roomspec_t holds the necessary specifications for making a new room.

Second, the roomspec_t struct holds the values necessary for making a new room and looks like this:

  • char *short_desc: holds the short description for a room.
  • char *long_desc: holds the long description for a room.
  • item_hash_t *items: the items in the room
  • path_hash_t *paths: the paths connected from the room.

All of the roomspect_t's that will live inside a speclist_t will need to be hardcoded.

Lastly, the speclist_t struct will contain the following fields:

  • llist *speclist;

this linked list will contain all of the hardcode roomspec_t's

@bryan22lee
Copy link
Contributor

bryan22lee commented May 18, 2020

See test_autogenerate.c to see tests for the functions that manipulate the context struct defined in gen_structs.h by @edward3-uchi . autogenerate.h creates and adds a desired room to a game based on a given context struct. Currently a work in progress, but plan to have all tests written by Wednesday.

@edward3-uchi
Copy link
Contributor Author

Pull Request was made and updated. The final speclist_t struct was changed to contain double linked list functionality and synonymously updated to be defined as the rest.

typedef struct speclist{
roomspec *spec;
struct speclist *prev;
struct speclist *next;
} speclist_t;

@edward3-uchi
Copy link
Contributor Author

Pull Request was approved this past weekend. Genstructs underwent many changes throughout this sprint. The gencontext struct now looks like this:

typedef struct gencontext {
path_t *open_paths;
int num_open_paths;
int level;
speclist_t *speclist;
} gencontext_t;

roomspec changed as well:

typedef struct roomspec {
char *short_desc;
char *long_desc;
item_hash_t *items;
} roomspec_t;

These new changes remove definitions that won't be of use anymore. In the future, gencontext and roomspec may be subject to change. The new NPC pull request found here is visualizing some of those future changes from the NPC teams once we implement there code into our generation module.

@dwahme
Copy link
Contributor

dwahme commented Jun 10, 2020

Issue Score: ✔️+

Comments:
Great job! Here are a few things you may want to improve in future issues:

An issue should have the goal of producing something tangible, such as code or documentation, which must be specified in the summary, not just the title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x/rpg-openworld RPG feature random world/room generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants