ThatFrostyy / Survival

A complex text based survival game.
https://github.com/ThatFrostyy/Survival
GNU General Public License v3.0
5 stars 1 forks source link

Crafting System #3

Open ThatFrostyy opened 8 months ago

ThatFrostyy commented 8 months ago

A crafting system would fit the game well and should probably be added, I have the idea that the player should be able to see what they can craft based on the items they have. If they have 1 stick it would show all the items that can be made or use a stick in the craft. The command should also be able to be done anywhere besides combat of course. And it should be made in such a way that allows for adding new recipes if needed easy later on. Another thing to consider to adding to it would be crafting tiers, which could be based on the players level/xp. Now those two are not implemented yet and have no idea if they will but that's just one way a tier crafting system could work. There should also be a delay when crafting some items take longer some less, some might drain your food or hunger. As well as crafting success/failure it should be randomized as the most of the game is, the % should depend on the item being crafted. As for the GUI sticking to text only for crafting and recipes would be the easiest option of course. But there could be a GUI which lets you see all the recipes and what you need for each item to craft it would probably be opened using a button that then shows a dataGridView like the inventory and shop use. While the actual crafting would remain in text.

ohinson01 commented 8 months ago

Hi Frosty,

I saw this as I was looking through the different repositories I have worked on. Mind if I take a look at it?

ThatFrostyy commented 8 months ago

Hi Frosty,

I saw this as I was looking through the different repositories I have worked on. Mind if I take a look at it?

Yea sure I just got back home and will start working on the shop and finishing it. After I'm done ill get on board to help I just left this here if someone wanted to help to speed things up.

ThatFrostyy commented 8 months ago

@ohinson01 I have gone ahead and added you to the Survival Project. So now you should be able to edit the stuff there, I also edit the README.MD for more info about the project so you can know what it's actually about. So when you check that you can feel free to put any notes to implement something you think will be good, or fix, remove, finish, etc.

ohinson01 commented 8 months ago

Ok. Sounds good! I need to do some other things first before looking into this, but I will definitely get around to it and update you on anything. I will also be on the lookout in case you have some code implemented before I get around to this.

ohinson01 commented 8 months ago

Looking into this now.

ohinson01 commented 8 months ago

Do you have any crafting recipes for me to add to the dataGridView? I was thinking of showing the different recipes you can create in a dataGridView, but not sure what you were thinking of.

ohinson01 commented 8 months ago

Is this what you had in mind with how crafting should show? When a user clicks the Craft button, the window pops up. I was thinking of showing the recipes in that separate window in a dataGridView.

image
ThatFrostyy commented 8 months ago

Do you have any crafting recipes for me to add to the dataGridView? I was thinking of showing the different recipes you can create in a dataGridView, but not sure what you were thinking of.

Sorry for the late reply.

Yep I was thinking like that, I have a few in my head that we could add, but your also welcome to put any you want here are the ones I was thinking of. Some of the items might not be in the game but we will add it in the future.

ThatFrostyy commented 8 months ago

Is this what you had in mind with how crafting should show? When a user clicks the Craft button, the window pops up. I was thinking of showing the recipes in that separate window in a dataGridView. image

Yep exactly that.

ThatFrostyy commented 8 months ago

Il think of more recipes and fix some issues I found.

ohinson01 commented 8 months ago

Sorry for the late reply.

Yep I was thinking like that, I have a few in my head that we could add, but your also welcome to put any you want here are the ones I was thinking of. Some of the items might not be in the game but we will add it in the future.

  • Campfire: 5x Branches, 3x Rocks
  • Spear: 3x Branches, 1x Rope

No worries. I started looking into this but then got distracted with adding things to GitHub. My brain is everywhere today. Thanks for the reply! I will go off of that for now. Since we do not have any icons yet to display the crafting recipes, I will just leave the icon column blank or not add an icon column yet.

ohinson01 commented 8 months ago

Il think of more recipes and fix some issues I found.

Ok. Sounds good.

ThatFrostyy commented 8 months ago

Il think of more recipes and fix some issues I found.

Ok. Sounds good.

More recipes:

Il find the icons for everything that we need, also these costs are subject to change as we add the functions to items. I gotta go to sleep now its pretty late but ill get working as soon as I am up.

ohinson01 commented 8 months ago

Ok. I will most likely continue after I get off work the next few days, so will be a bit slow in replying and implementing the system. I can send over my code changes tonight so that you can also work on it.

ThatFrostyy commented 8 months ago

Ok. I will most likely continue after I get off work the next few days, so will be a bit slow in replying and implementing the system. I can send over my code changes tonight so that you can also work on it.

Yep send any, every time you change some stuff if you have time to of course.

ohinson01 commented 8 months ago

Sent you a pull request

ThatFrostyy commented 8 months ago

Sent you a pull request

Merged.

ThatFrostyy commented 8 months ago

I have gone ahead and added all the new icons we need for those recipes.

ohinson01 commented 8 months ago

When adding rows and columns to the dataGridView, what names would you like for the columns? Would you want it to be something like this?

Player Level Item Ingredients
3 Campfire 5 Branches, 3 Rocks
4 Spear 3 Branches, 1 Rope
5 Box 3 Branches, 2 Rope
6 Makeshift Backpack 3 Cloth, 1 Tarp, 1 Rope
7 Tent 3 Tarp, 2 Rope

I was also thinking that when a user selects a row, then a button should pop up to say "Begin Crafting" if they have the correct items or be grayed out to let the user know they cannot craft until they get the necessary items. Was that how you were thinking of creating this, too? I am sure it is possible to select from the dataGridView on the object you want to craft, but will need to dig into a bit of research on that front. If this option is not possible, then I can always use a textbox like you have implemented at the start of the game and type in the option from there. Let me know your thoughts on this.

At the moment, I am outlining how the crafting system should work and everything.

ThatFrostyy commented 8 months ago

When adding rows and columns to the dataGridView, what names would you like for the columns? Would you want it to be something like this?

Player Level Item Ingredients 3 Campfire 5 Branches, 3 Rocks 4 Spear 3 Branches, 1 Rope 5 Box 3 Branches, 2 Rope 6 Makeshift Backpack 3 Cloth, 1 Tarp, 1 Rope 7 Tent 3 Tarp, 2 Rope I was also thinking that when a user selects a row, then a button should pop up to say "Begin Crafting" if they have the correct items or be grayed out to let the user know they cannot craft until they get the necessary items. Was that how you were thinking of creating this, too? I am sure it is possible to select from the dataGridView on the object you want to craft, but will need to dig into a bit of research on that front. If this option is not possible, then I can always use a textbox like you have implemented at the start of the game and type in the option from there. Let me know your thoughts on this.

At the moment, I am outlining how the crafting system should work and everything.

Yep exactly like that, I think it should be possible as it is to select a row but how to check it not sure. I have tried looking into the saving and loading system as well but there is an issue if we want to serialize all the data. We really cant because of the itemDic specifically the dataGridView object in the dictionary, as its not serializable. At least from the stuff I found out. https://github.com/ThatFrostyy/Survival/blob/3bbd67186ebf39f9af0202078e467a9b90ab0c88/Player.cs#L24

ohinson01 commented 8 months ago

Ok. Great! I will not be coding yet until I figure out the coding structure for this, so will be a while before I get around to actually implementing it.. I made a minor change with how naming Form2 should be and will send a pull request shortly. It is only renaming Form2 to be CraftForm to differentiate that from Form1 since Form1 is the MainForm for the application.

ThatFrostyy commented 8 months ago

Ok. Great! I will not be coding yet until I figure out the coding structure for this, so will be a while before I get around to actually implementing it.. I made a minor change with how naming Form2 should be and will send a pull request shortly. It is only renaming Form2 to be CraftForm to differentiate that from Form1 since Form1 is the MainForm for the application.

Alright, yep its always better to plan out before. Lol learned that the hard way before, I'm gonna work on some stuff tonight when I'm home.

ohinson01 commented 8 months ago

Ok. Sounds good. Yes, it is very hard when you do not plan out anything haha. I am a visual person, so I usually need something in front of me to get the complete picture in my head. Also, nevermind about the pull request. I am getting a lot of conflicts and it will not do it until those conflicts are resolved. Going to look into it. Might not get it to you until sometime after I get off work.

ohinson01 commented 8 months ago

Ok. Figured it out. I just deleted the entire folder in my local drive and re-cloned the whole project. Easiest fix so I do not have to deal with it so early in the morning haha. Pull request sent.

ThatFrostyy commented 8 months ago

Ok. Figured it out. I just deleted the entire folder in my local drive and re-cloned the whole project. Easiest fix so I do not have to deal with it so early in the morning haha. Pull request sent.

Alright thanks, Il accept it as soon as I finish levels.

ThatFrostyy commented 8 months ago

@ohinson01 There was some issue when I pushed my changes. I pulled yours but It did not actually pull them and when I pushed mine it overwrote the ones on GitHub. So the Crafting form is called Form2 again lol.

Anyways I added levels and a lot of other stuff.

ohinson01 commented 8 months ago

No worries! I can just make the changes again. If you ran into a similar issue as I did this morning, I always find it easier to delete the project in my local drive and then clone the repository again. Or you could also create a different folder to store the project in.

Ok. Nice! I will take a look at the changes you did sometime so I know what levels will be available and what else is available.

ohinson01 commented 8 months ago

Whenever you get the chance, sent a pull request with updates to crafting system.

ThatFrostyy commented 8 months ago

Whenever you get the chance, sent a pull request with updates to crafting system.

Alright, it has been merged now 👍

ohinson01 commented 8 months ago

Sent another pull request.

ThatFrostyy commented 8 months ago

Sent another pull request.

Merged as well.

ohinson01 commented 8 months ago

Sent another pull request.

ThatFrostyy commented 8 months ago

Sent another pull request.

Merged, can you explain in a little more detail of what each script will do, etc here in the comments so I know how to start. I wanna get on board to help you.

ohinson01 commented 8 months ago

Sure. So, here is what I am thinking for each file.

Craft.cs This is the main file where we would run the crafting system. So when I call this file in the CraftForm.cs file, then this is where I would call the methods (similar to how Form1.cs is being used). I would display the items in this file and create each item in Craft.cs.

Recipes.cs This file will be used to store each recipe for the crafting table. I haven't thought on how this would work yet, so feel free to implement anything to get started.

Ingredients.cs This will retrieve the player's inventory to get the ingredients to create the crafting recipe. I haven't thought on how this would work yet, so feel free to implement anything to get started.


This is a rough draft of my main idea I had in my head, but please feel free to change anything that doesn't make sense to you. I haven't pinpointed the exact functionality, but I thought to give a head start, we could start with this. I usually like splitting up my Parent and Child class when creating C# applications and then using a Main class (Craft.cs) to output everything. Feel free to also implement your own ideas. As I said, this is a very rough draft of what the code structure should look like in the end so it is open to any changes that may be needed.

I hope I explained this well so you understand the intention behind each file.

If you have any additional questions, please ask.

ThatFrostyy commented 8 months ago

Sure. So, here is what I am thinking for each file.

Craft.cs This is the main file where we would run the crafting system. So when I call this file in the CraftForm.cs file, then this is where I would call the methods (similar to how Form1.cs is being used). I would display the items in this file and create each item in Craft.cs.

Recipes.cs This file will be used to store each recipe for the crafting table. I haven't thought on how this would work yet, so feel free to implement anything to get started.

Ingredients.cs This will retrieve the player's inventory to get the ingredients to create the crafting recipe. I haven't thought on how this would work yet, so feel free to implement anything to get started.

This is a rough draft of my main idea I had in my head, but please feel free to change anything that doesn't make sense to you. I haven't pinpointed the exact functionality, but I thought to give a head start, we could start with this. I usually like splitting up my Parent and Child class when creating C# applications and then using a Main class (Craft.cs) to output everything. Feel free to also implement your own ideas. As I said, this is a very rough draft of what the code structure should look like in the end so it is open to any changes that may be needed.

I hope I explained this well so you understand the intention behind each file.

If you have any additional questions, please ask.

Yep I got it all now thanks!

And yea I agree with you I also like to do that with child classes.

ohinson01 commented 8 months ago

Thanks for assisting with this! Work has been a bit hectic lately and when I come home, I try to look into this but am also handling multiple things at once at the moment. So appreciate it!

ThatFrostyy commented 8 months ago

Thanks for assisting with this! Work has been a bit hectic lately and when I come home, I try to look into this but am also handling multiple things at once at the moment. So appreciate it!

Yea no thank you for contributing, really hard finding people.

ohinson01 commented 8 months ago

@ThatFrostyy

Hi Frosty. Just wanted to check in to see if you made any progress since we last spoke? I am now able to give my assistance and wanted to see if you have any code updates.

ThatFrostyy commented 8 months ago

@ThatFrostyy

Hi Frosty. Just wanted to check in to see if you made any progress since we last spoke? I am now able to give my assistance and wanted to see if you have any code updates.

Hi unfortunately I wasn't able to I was constantly busy the whole week, but I will be working on some stuff today and tomorrow i got a bunch new ideas trough the weekend so expect a commit tomorrow.

ThatFrostyy commented 8 months ago

Actually I might also just do some commits tonight. I am CET btw.

ohinson01 commented 8 months ago

Ok. Sounds good! Oh, wow. I am EST.

ThatFrostyy commented 8 months ago

Ok. Sounds good! Oh, wow. I am EST.

Well it shouldn't be a problem now if it wasn't before.

ThatFrostyy commented 8 months ago

@ohinson01 I have stumbled upon a small issue would you mind helping me? For some reason PlayerMethods is always null in the ShopMethods.

ohinson01 commented 8 months ago

Sure. I can look into it. Please create an issue in Git explaining what is happening. You can assign it to me when you have created it.

ThatFrostyy commented 8 months ago

Sure. I can look into it. Please create an issue in Git explaining what is happening. You can assign it to me when you have created it.

Done but wont let me assign you for some reason, cant find u in the list.

ohinson01 commented 8 months ago

Strange but no worries. Will still look into it. Will look into it sometime tomorrow.

ohinson01 commented 8 months ago

Just as an update, I am working on setting up the crafting system.

ohinson01 commented 8 months ago

PR #10 - Updated crafting system outline in case you wanted to assist and so that we do not overwrite each other's progress.

ThatFrostyy commented 8 months ago

PR #10 - Updated crafting system outline in case you wanted to assist and so that we do not overwrite each other's progress.

Alright it has been merged.

ThatFrostyy commented 8 months ago

@ohinson01 I have questions, I see some stuff is commented out can you explain why as when I'm going trough this don't know what I should touch or leave you know. This reminds me we should probably put comments for each other over commented code or just remove it fully (if its not used).

Also did you mean playerLevel? in Materials.cs?