Continuing from the last blog, I will be contribute dungeon again. I find the project to be very high level (using tools like Travis CI, Maven), but there is only one maintainer for the code. I wanted to work on bigger well known projects but with other courses (SPO600 taking the most amount of time) to handle I have little time to branch out.
Sadly, I had some problems with building the project. Previously, I was working on this project on a different computer but I accidentally wiped that computers hard drive (Luckily, I didn’t lose anything that important). Installing the correct programs needed for the project and running the commands I thought the project would build fine but I was present with this error during the command
Failed tests: testResourcesFolderContainsTheSplashScreenFile(org.mafagafogigante.dungeon.io.ResourcesFolderTest): Resources file should be a directory testResourcesFolderContainsTheCorrectNumberOfFontFiles(org.mafagafogigante.dungeon.io.ResourcesFolderTest): Resources file should be a directory testResourcesFolderContainsTheCorrectNumberOfJsonFiles(org.mafagafogigante.dungeon.io.ResourcesFolderTest): Resources file should be a directory
I never seen this error before, and I am pretty sure I did not edit the resource folders. There’s been another merge from a different contributor since I last work on this project but looking through the pull request nothing there suggests a change of resource folders. I decide to run this test on
Travis CI. I have never used Travis CI before so this was a really good learning experience. Running the test on Travis CI passed so I decided to ignore the issue and continue with implementation. Updated: I later found out that this issue is because one of my directories had a space in it, which causes this error. Reference this issue for more details.
Looking through the issues, most of them seem to require a lot of effort and will probably take more than the allotted time to complete. Luckily, I found an issue that I feel like I would be able to implement. I had some ideas on how to implement it but the issue still seemed to be challenging.
The issue I chose was to implement a map legend for the game. Currently, while the player is traveling there’s not much indication of where you are or what’s around you unless you use the
map command. It would be really usefully if there was a map legend on the bottom right corner of the screen to give some idea where you are on the map.
Ideas for implementation
I initially had two idea on how to implement the solution once I saw this issue.
The first solution would be to add another text area box at the bottom right screen of the window. This means using Java Swing which I have done before with my Second pull request for Hacktoberfest. In my blog I mention how difficult it is to code with Java Swing since the layouts are troublesome to learn. Overall I think the second solution is better.
The second solution would be to add the map to the already shown text area itself and make sure it shows on the bottom right corner of the screen. This may be more work, I have to count the amount of lines that already in the text area, and work out where to place my map text on the bottom right corner of the screen. Below are the images of the game and a mock-up of what I want the final result to be:
What the game looks currently:
map command looks like:
Mock-up of map legend using paint:
Commenting on the issue to ask if this is what the maintainer want, to my surprise it wasn’t. Turns out I mistook map legend with mini-map, what he actually wanted is for the symbols to be defined like so:
I also had many ideas with how I would implement this but as I was implementing it I ran into many problems. I decide to reuse some existing functions but the result is not exactly what I wanted:
On first examination it seems to be fine but I listed out the problems here on my pull request, where I ask for aid.
mvn test and fixing code convention errors I decide to upload this commit to get feedback and potential help from the maintainer.
Asking for help in my Pull Request
I commit my changes and create a pull request. The purpose of the pull request was to address some of the problems I had and see if I can get some help. I will continue to keep working on the issue on my own, but I wanted some feedback to know if I am going in the right direction. Update: After getting really good feedback from the maintainer I decide to take his suggestion and ideas and keep working on the problem. For more information see the pull request
Another pull request
Creating a new pull request with his suggested ideas and changes from the previous pull request . I would explain my thought process but the pull request already does that. The finally result looks something like this:
I really do want to branch out to more well known projects but I truly am busy with other courses. Hopefully if I get a breather I can try to branch out to a new project but if not I will probably be contributing to this project again.
- My GitHub: https://github.com/ImmutableBox
- Another pull request for hacktoberfest: https://paulopensourceblog.wordpress.com/2019/10/30/another-pull-request-for-hacktoberfest/
- dungeon: https://github.com/bernardosulzbach/dungeon
- Issue#112: https://github.com/bernardosulzbach/dungeon/issues/112
- Pull request#423: https://github.com/bernardosulzbach/dungeon/pull/423
- Pull request#424: https://github.com/bernardosulzbach/dungeon/pull/424
- Travis CI: https://travis-ci.org/
- Maven: https://maven.apache.org/
- Java Swing: https://docs.oracle.com/javase/7/docs/api/javax/swing/package-summary.html
- Second pull request for Hacktoberfest: https://paulopensourceblog.wordpress.com/2019/10/10/second-pull-request-for-hacktoberfest/