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

Define Start-Goal Points #2

Closed
SSebigo opened this issue May 3, 2023 · 10 comments · Fixed by #3
Closed

Define Start-Goal Points #2

SSebigo opened this issue May 3, 2023 · 10 comments · Fixed by #3

Comments

@SSebigo
Copy link

SSebigo commented May 3, 2023

Is there a way to automatically or manually define start-goal points, where for example the start point would be represented by a "S" and the goal by a "G" on the ASCII map?

@unrenamed
Copy link
Owner

Hi @SSebigo. Thanks for your question.

So, the idea of yours is to randomly or manually set the coordinates of the entry and exit doors in the maze. The way I see it, this can be done by carving two walls on different sides of the maze field:

#########
..#...#.#
#.#.#.#.#
#.#.#...#
#.#.###.#
#...#...#
#####.###
#.......#
#######.#

What you're suggesting looks to me like this:

#########
S.#...#.#
#.#.#.#.#
#.#.#...#
#.#.###.#
#...#...#
#####.###
#.......#
#######G#

Is this what you're looking for? What do you think about the first approach?

I'm also curious what do you like to build such a map for if I may ask?

@SSebigo
Copy link
Author

SSebigo commented May 7, 2023

That's exactly what I'm suggesting, in my use case I need to parse a file (for a game), if the start-goal are just dots in walls it's requires a bit of work on my end to find them but if they're S-G, then I can just search for these letters.

So far, I've been generating mazes and placing the letters manually, it would be better if it could be generated directly with the maze, so the pipeline would be fully automated (generate -> solve -> test with bot).

@unrenamed
Copy link
Owner

@SSebigo I see. This sounds interesting 👍

I think I can get it done. Perhaps, it can be a part of the public API of the GameMap struct. Thus both the lib and CLI can provide the feature to generate the start-goal positions. By the way, from what you said I'd hazard a guess you're using the CLI for generating mazes, aren't you?

@SSebigo
Copy link
Author

SSebigo commented May 7, 2023

Yeah, I generate the maze into a file, then read the file inside Godot.
But I was considering using Godot Rust plugin to use knossos directly into the engine.

@unrenamed
Copy link
Owner

@SSebigo That's great. I'll look into it this week

@unrenamed unrenamed linked a pull request May 14, 2023 that will close this issue
@unrenamed
Copy link
Owner

@SSebigo Hi. I've managed to implement an MVP version of the feature you requested. Before I move further to covering new logic with unit tests and documenting the API changes, I'd be happy if you take a look at the changes I've made so far. It'd make a lot of sense if you actually integrate the new feature of knossos with your game and test them together so that you can suggest any improvements or changes you need.

How to test?
You have two options here: either using the CLI or the lib API as a plugin you mentioned.

CLI:

  1. Clone the new branch
  2. Build the binary via cargo build --release
  3. .target/release/knossos generate -W 4 -H 4 game-map --with-start-goal --output-path=maze.txt to run the CLI in your terminal

Lib:

  1. Add the following to your Cargo.toml
[dependencies]
knossos = { git = "https://github.com/unrenamed/knossos.git", branch = "2-define-start-goal-points" }
  1. Use GameMap::new().with_start_goal() to format a maze into a map with "S" and "G" points

If you encounter any issues or bugs, please let me know.
If you've decided to use another repository or library for generating mazes, I'd be happy to know too.

@SSebigo
Copy link
Author

SSebigo commented May 21, 2023

I've tested the CLI and that's exactly what I had in mind. Haven't tested the lib yet, but if it used the same code as the CLI it should be good to go.

@SSebigo SSebigo closed this as completed May 30, 2023
@unrenamed
Copy link
Owner

@SSebigo Hi, this is great that you were able to test it and verified the results. The CLI uses the library public API, hence you can try using it for your plugin as well.

I can see you've closed the issue, though the PR isn't merged yet and the new feature isn't covered with unit tests. I feel OK with finishing this feature and release a new minor version. I just need some time to do that. Simply put, we can reopen this and close once the PR is merged. WDYT?

@SSebigo SSebigo reopened this May 30, 2023
@SSebigo
Copy link
Author

SSebigo commented May 30, 2023

@unrenamed my bad, I forgot this feature was not on the main branch. Take your time, I'll work with the feature branch for now np.

@unrenamed
Copy link
Owner

@SSebigo Great! I'll let you know when it's ready.

By the way, how's the progress with your game? Have you already tried using the Godot Rust plugin to make knossos generate mazes directly in the game engine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants