Legedith / Dungeons

Learn Linux terminal commands through a text based adventure game
MIT License
15 stars 5 forks source link

Add more terminal commands #1

Open Legedith opened 4 years ago

DevLokCodes commented 4 years ago

hey can i try to work on it could you assign it to me

Legedith commented 4 years ago

Sure! Just tell me which commands do you plan to add and how.

DevLokCodes commented 4 years ago

I could add commands like grep, echo, chmod, ping, wget, history.

DevLokCodes commented 4 years ago

I haven't worked on a project such as yours, but I can always figure out looking at the codes from the repositories. I would be happy to work on such a project it has a good learning curve

Legedith commented 4 years ago

Let's try one at a time. If you go through the current code, you'll find each command is accompanied by a small mission/riddle/task for which you need the command. What story/tasks do you have in mind for the commands you specified?

DevLokCodes commented 4 years ago

the player would come across various robots, routers, satellites or something similar which will help them to clear that level or move forward in the story

so the logic would be the player has to ping to various machines to check which one is connected / not dead (live) and get ping data from the same and then use it to progress further

Still figuring out how other commands can be used as a part of the story

am401 commented 4 years ago

Hello @Legedith and @DevLokCodes - I was looking at this game / tutorial last night and found it great. I forked it and went through phase one to test things out. It's definitely a cool project and I have previously done something similar, however using a virtual environment so clean up was slightly easier when meddling with users and groups for example.

I like the idea of using grep for searching files for keys. I have previously implemented this where a user had to grep through a log file for a phrase which would reveal an ascii art item.

find would be a valuable tool to have as well. Could look at creating a specific file within a subdirectory such as .hidden.key that the player would need to locate with something like:

find . -type f -name "*.key"

The specific scenario could be something along the lines of:

You have entered a room. There is a door on the opposite side, which is locked.
You must find the key to advance forward. Use 'ls' to see what's in the room.

When the user enters the room the game can create a number of directories:

chest
book
chest of drawers
...
etc

The hidden.key can be added to one of the directories to be found. It can then contain a message that can be cat'd out to reveal the next step forward.

I did want to note that figlet doesn't unfortunately return anything for me as the module / function doesn't exist. I've previously got figlet running with pyfiglet. So for example when I exit the game I see this at the end:

sh: figlet: command not found

as opposed to the farewell message intended with os.system('figlet -c FAREWELL')

Update

I did some further testing - I was testing the game on an OSX platform however do note that figlet as a system tool does seem to come with other *nix based OS'.

An idea would be to look at implementing pyfiglet - albeit this may require a requirements.txt file, or do an OS check of sorts within a banner function in order to handle users running OSX

DevLokCodes commented 4 years ago

i noticed the same thing with figlet, i am using Windows 10 as my main machine, and found the same error with other commands showing command not found

Legedith commented 4 years ago
  • For Ping

the player would come across various robots, routers, satellites or something similar which will help them to clear that level or move forward in the story

so the logic would be the player has to ping to various machines to check which one is connected / not dead (live) and get ping data from the same and then use it to progress further

  • For Grep

more like the scene from the harry potter movie where harry has to find the correct key from a bunch of keys to open the door the scene mentioned above just for reference

  • For History

probably something on the lines of coming across a used machine by someone and you have to read all the commands from that machine and deduct something from it

These are all awesome ideas and align with the narrative as well.

Legedith commented 4 years ago

Hello @Legedith and @DevLokCodes - I was looking at this game / tutorial last night and found it great. I forked it and went through phase one to test things out. It's definitely a cool project and I have previously done something similar, however using a virtual environment so clean up was slightly easier when meddling with users and groups for example.

I like the idea of using grep for searching files for keys. I have previously implemented this where a user had to grep through a log file for a phrase which would reveal an ascii art item.

find would be a valuable tool to have as well. Could look at creating a specific file within a subdirectory such as .hidden.key that the player would need to locate with something like:

find . -type f -name "*.key"

The specific scenario could be something along the lines of:

You have entered a room. There is a door on the opposite side, which is locked.
You must find the key to advance forward. Use 'ls' to see what's in the room.

When the user enters the room the game can create a number of directories:

chest
book
chest of drawers
...
etc

The hidden.key can be added to one of the directories to be found. It can then contain a message that can be cat'd out to reveal the next step forward.

That would be an awesome way to implement the grep and find commands. It would surely make the game way more interesting.

Legedith commented 4 years ago

I will have open two separate issues. @DevLokCodes you can work on the Ping and History commands (#2 ) while @am401 works on the Grep and Find (#3 ).

Just comment on the issues so I can assign it to you guys.

Legedith commented 4 years ago

i noticed the same thing with figlet, i am using Windows 10 as my main machine, and found the same error with other commands showing command not found

I should have specified in the documentation, Dungeons was made primarily for Linux based systems and Figlet can be installed using sudo apt install figlet toilet.

If you are using Windows, you'll have to simulate the Linux terminal for the commands to work. I personally use WSL.

Legedith commented 4 years ago

An idea would be to look at implementing pyfiglet - albeit this may require a requirements.txt file, or do an OS check of sorts within a banner function in order to handle users running OSX

That's a great idea. Once we know the OS, we can also switch the commands. For example if the user is running Windows, we can change the ls command to dir command. It would be a little tricky though as not all commands will have an equivalent.

Would you like to work on this too?

am401 commented 4 years ago

I would like to get the grep and find elements out of the way first and also trying to see about getting things ironed out for the *nix version. I don't know how you feel about the pyfiglet recommendation, it shouldn't be too difficult to do a check at the beginning ie in pseudo code:

import libraries / modules
check if pyfiglet is present
if present then configure a function to print banners in a specific way
else use normal print statement

The above could be called by a second function checking whether the system is Linux/BSD where figlet is present or OSX (Darwin) where pyfiglet would be necessary