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

Randomized map generator #30

Conversation

xone-mi
Copy link
Collaborator

@xone-mi xone-mi commented Dec 21, 2023

Description

Added base classes for map, floor and room
Added manager script to manage said base classes

Related issues

Issue 10 (#10), Issue 6 (#6)

List of changes

Created MapBase, FloorBase and RoomBase classes
Created MapManager script
Created test_map

Tests

Added one test for generation. More tests will be added in the future

Additional notes

Trying this again, everything should be fixed now hopefully but I'll make this a draft too just in case.

… files

- The CardBase applies all effects when played
- The application of effect is done given the card data (parser TODO)
- This application will be done to all targets in the list
- This calls the apply_effect which is done to individual targets
It worked nicely. This card probably won't stay as it is, that would be OP
But it's nice to test that the system is working
@xone-mi xone-mi added the new feature Ask for a new feature label Dec 21, 2023
@xone-mi xone-mi self-assigned this Dec 21, 2023
@Turtyo Turtyo linked an issue Dec 21, 2023 that may be closed by this pull request
Copy link
Collaborator

@Turtyo Turtyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation using Floor was decided against in #6
The implementation should use a 2D array of rooms instead. Changes are needed to remove the use of floors in this implementation

Map/FloorBase.gd Outdated Show resolved Hide resolved
Map/MapBase.gd Outdated Show resolved Hide resolved
Map/RoomBase.gd Outdated Show resolved Hide resolved
Map/MapBase.gd Outdated Show resolved Hide resolved
Map/RoomBase.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Copy link
Collaborator

@Turtyo Turtyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution ! I left comments on points that I felt needed changes. We can discuss if you think some of the changes I suggest shouldn't be made

Map/RoomBase.gd Outdated Show resolved Hide resolved
Tests/test_map.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Map/RoomBase.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Map/MapBase.gd Outdated Show resolved Hide resolved
Map/MapBase.gd Outdated Show resolved Hide resolved
@Turtyo
Copy link
Collaborator

Turtyo commented Dec 21, 2023

i'm also realizing the room doesn't have an EventBase element, but you will need to wait for #29 to be closed to be able to reference that properly (which will also give you access to the list of possible events)

Saplings-Projects and others added 7 commits December 21, 2023 22:34
I'm not sure if I forgot something that was mentionned during the PR or not
* Create Event Parent and Event Child Classes

* Issue 20: Update Event Children with scene string instantiation, Create Events Classification script to hold enums for different events and added it to AutoLoader

* Issue 20: Add comment for test function

* Issue-20: Rename Event classes, remove EventsClassification enum

* Issue-20: Update EventBase to have array of different types of events. Update init() as well.

* Issue-20: Update EventBase Array holding all Events, Add Unit Test for EventBase
Copy link
Collaborator

@Turtyo Turtyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for implementing the idea I gave earlier @multi-arm !
I think it needs some changes.

This would probably be a good thing to test in the map tests also (generate a small map and compare it to a reference we have, to be sure the padding an the rooms all are correctly set)

Map/MapManager.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
@Turtyo
Copy link
Collaborator

Turtyo commented Dec 31, 2023

I'm also seeing you added some typing for functions in the latest commit, could you take a look at these comments i left at the beginning about some missing types ?
#30 (comment)
#30 (comment)

@Tysterman74
Copy link
Collaborator

Sanity checking this, I think we need to sync up map-implementation with main. I see the Contributing.md file has been changed and I believe multi synced up changes with main and is still merging into map-implementation with the new changes.

Static typing changes
Added create_map return type

changed map generation (optimization)

(MapBase.rooms holds arrays of rooms, one for each floor)
create_map now has configurable width for testing
changed test for a small floor (reference)
fixed unintended test changes
@Turtyo
Copy link
Collaborator

Turtyo commented Jan 2, 2024

If it's just for the Contributing.md, I don't think it's really needed to sync main in map (it's not a code dependency for example)

Copy link
Collaborator

@Turtyo Turtyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing the changes ! I think we will soon be done with this PR, that's a good implementation for a basis.
Some parts still need changes imo

Map/MapManager.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Tests/test_map.gd Show resolved Hide resolved
Tests/test_map.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
JonaLam and others added 3 commits January 5, 2024 18:09
…s-Projects#37)

* Cut all of the unnecessary code in CardBase

* Changes to the card resource to make sure they work

* Removed unnecessarily _damage_entirt function

* Removed cards that don't do anything
changed create_map(_layout) > create_map(floors_width)
added room padding to both before and after rooms are generated
changed tests to use a fixed list
* Added a WIP buttom that shows a new scene

* The button now shows a new scene with
a return button to go back to the game.
The game cannot be played while the scene is present.

* The button now shows a new scene with
a return button to go back to the game.
The game cannot be played while the scene is present.

* added Typing

* Added CardScrollUI to see the inside of a CardPile

* Added CardScrollUI to see the inside of a CardPile

* Changed event to input_event and added its type

* Updated the the min size of the CardUI

* Fixed the aftermath of merging

* Added constant for the card.

* Deleted a function that is irrelevant.

* Moved the ShowCardPile into CardPileUISetter

* Deck doesn't need to have a card count.

* resized ScrollContainer to show 5 columns and 2 rows

* Added a button to show cards inside the deck

* Fixed the code that modifies the card and adds it to the container.

* Whitespace be gone

* Changed the settings of GridContainer so cards first show in the center

* Print statement begone

* added the "pile" after deck so it is consistent to the others pile

* Added a test for cardscrollui

* Fixed the test so it gets the proper gridcontainer

* Changed _input function to use a key constant instead of a string.

* Changed the settings of GridContainer so cards first show in the center part 2

* Addressed review feedback from Ty

* Addressed review feedback from Turtyo

* Changed the test so it compares Cardbases

* added a comment to the input function.

* potential fix to errors in test

* amendment for the last commit

* Fixed a function, fixed the test?, and cards not appearing in the UI.

* Fixed the testing scene after the merge

* whitespace be gone

---------

Co-authored-by: Turtyo <49365680+Turtyo@users.noreply.github.com>
Map/MapManager.gd Outdated Show resolved Hide resolved
Tests/test_map.gd Outdated Show resolved Hide resolved
Map/MapManager.gd Outdated Show resolved Hide resolved
Tysterman74
Tysterman74 previously approved these changes Jan 10, 2024
Copy link
Collaborator

@Tysterman74 Tysterman74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll approve since everything looks good from my end, I do have the same comment as Turtyo though.

changed create_map(layout) to create_map(map_floors_width)

changed insert in create_map() to append
changed test error message formatting
added override _to_string() in RoomBase, this will have more added in the future
Copy link
Collaborator

@Turtyo Turtyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will pull in local to test

Tests/test_map.gd Outdated Show resolved Hide resolved
Tests/test_map.gd Outdated Show resolved Hide resolved
#Scenes/TestingScene.tscn Outdated Show resolved Hide resolved
changed assert_not_null(test_map.rooms) to assert_not_null(_room) in map test
@Turtyo
Copy link
Collaborator

Turtyo commented Jan 17, 2024

I pulled in local to test, it loads and all the tests are passing. We don't have any visual for now but the code seems good, and this is a solid basis imo. Thank you @multi-arm !
@Tysterman74 we are just gonna need your approval again since need pushes were made. If you could also squash merge once that is done 👍

@Tysterman74 Tysterman74 merged commit b4d84ad into Saplings-Projects:map-implementation Jan 17, 2024
1 check passed
@Turtyo Turtyo mentioned this pull request Jan 18, 2024
@Tysterman74 Tysterman74 mentioned this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Ask for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Room class structure
8 participants