Creating a Stardew Valley inspired game in Python
A Stardew Valley style game in Python and Pygame. This includes
farming and foraging, a day and night cycle, weather effects
and a merchant. The game was also made in Tiled so you can
expand it yourself.
You can get my Pygame course here: www.udemy.com/course/learn-py...
If you want to support me check out my Patreon: / clearcode
(You also get lots of perks and all my courses)
Social stuff:
Twitter - / clear_coder
Discord - / discord
Project files:
github.com/clear-code-project...
Links to related pygame videos:
Ultimate introduction to Pygame - • The ultimate introduct...
Delta time in pygame - • Understanding framerat...
Masks in pygame - • Understanding Pygame m...
Collisions - • Collisions between mov...
Tiled - • A guide to level creat...
Cameras - • Cameras in Pygame
Timestamps:
0:00:00 - Intro
0:01:53 - Setup
0:10:19 - Creating the basic player
0:29:49 - Importing the player graphics
0:42:59 - Animating the player
0:53:32 - Tool use
1:09:04 - Switching between tools
1:21:27 - Creating the overlay
1:32:20 - Starting the camera and importing the floor
1:50:50 - Importing all elements and faking more 3D
2:18:52 - Collisions
2:42:29 - Working on the trees
3:06:42 - Particles
3:16:32 - Player inventory
3:21:57 - Restarting the day
3:46:00 - Starting the soil
4:12:29 - Soil patch graphics
4:32:51 - Watering logic
4:43:19 - Rain
5:03:36 - Creating the plants
5:24:56 - Harvesting
5:32:53 - Daytime transition
5:41:04 - The merchant
6:23:46 - Audio (+ some final fixes )
Пікірлер: 510
I've learned more theory and code patterns from your videos than in years of studying textbooks. Thank you so much for your excellent content!
@ClearCode
Жыл бұрын
hey, thank you so much! And super happy to hear that the videos are helpful :)
@cowiekmaupa
Жыл бұрын
what have you been reading? html for dummies?
Thank you so much for these tutorials, they have helped me tremendously.
@ClearCode
Жыл бұрын
Hey, thank you so much! You have no idea how helpful that is. Really glad you like the videos so much :)
@GCKteamKrispy
Жыл бұрын
@Clear Code Your videos are veeery helpful, also bought your course😀
@pieterbosch87
Жыл бұрын
Love these game tutorials but how to protect pygames and e.g. sell them? Compiling them to exe or multiplatform. What would be the best distribution posibilities? Perhaps a nice idea for a video:)
@Meletion1
5 ай бұрын
Wow not many replies
Can't wait to watch this after school's over!
@bishnuprasadpahari3780
Жыл бұрын
Lol yez
@Raven-wr4we
Жыл бұрын
damnn, thought it was holidays for all school's atm
@Solomonwo
Жыл бұрын
You can watch it right away, not wait for school being over
@vimwizard
Жыл бұрын
Yoo champ still waiting for holidays or u already watched it?
@vadvenurt
4 ай бұрын
you finished it?
You are the BEST! I can't imagine how much effort you put into this tutorial. Thank you!
Wow, I just finished your Zeldalike tutorial and was thinking it would be easy enough to try making this exact concept, you sure work fast. Looking forward to checking this out in detail as well. Thank you for providing these!
Well… isn’t this just a delight.
Dude seriously, THANK YOU. The fact that you put in all this work to teach us this stuff is amazing. Just goes to show how much you care. I'll support anything you make!
Finished this tutorial today. Just want to say thank you for a great video. Really learnt a lot of really neat tricks, and I think you have cleared up some of my confusion regarding object interactivity and importing. Great video...
If you enjoy this video check out my course: www.udemy.com/course/learn-python-by-making-games/?referralCode=A80FECE8C76096E01111 and my Patreon: patreon.com/clearcode
@help6732
Жыл бұрын
can u upload dis game on playstore? (android)
@vPee-Ton
Жыл бұрын
can you post the raw code so I can just copy and paste it into python so i dont waste time please:D
Can't wait to start this. The other tutorials have given me confidence just to start and this just looks so much more expansive!
Can we like the video 3 thousand times in a row? Dude, I work with written documentation, and I know the amount of fucking work that goes into explaining every single little detail. I've done a couple of explanatory videos before. Nothing comes close to the level of detail and the dedication that you put into your videos. They're very helpful! Thank you very much for putting up this kind of content! It's a blessing for people learning Python and game development in general!
Currently working through your paid course and now I'm excited to finish that to then start on this tutorial. Thanks for the amazing content.
This tutorial is very high quality!! Got to appreciate your work!
@ClearCode
Жыл бұрын
Thank you so much! :)
Just going to toss this into my watch later list for a rainy weekend! Looks great and can't wait to watch.
AWESOME! Top quality content! Thank you!
Thank you so much for all the time and effort you must have put in making and preparing this video!! It was not only helpful in getting to understand pygame, but also more generally how to organize the code with classes. Many thanks, job very well done! :-)
@ClearCode
Жыл бұрын
Thank you so much and glad it helped :)
Thanks so much for this tutorial! I always thought making a game like this would be really difficult, but you've shown me how achievable it is.
This guy deserves much more subscribers! Thank you buddy for all the effort and knowledge you share !!
Amazing! A lot of effort you put into this tutorial Thanks mate!
These videos are awesome. Please never stop.
Actually did it... So many obstacles overcome but I actually got it more or less done. Thank you. I learned so much from this project.
This is awesome!! Your videos inspired me to further my education. For that you have earnt my money sadly I don't have any yet but when I do I wont forget you ClearCode! Thanks again
This is a great video, very clear and easy to follow along. Thank you so much.
doing zelda under your close supervision atm, and then suddenly a new video with even more challenges to overtake! THANK YOU!
it is really nice, I really can't understand how people can create so nice games and so nice videos! You are the best
Your course in Udemy is fantastic, I bump into in your channel and after saw your tutorials I just needed to got the course, congratulations.
I love all these pygame tutorials of yours
It's like a mix of Stardew Valley and Littlewood. Great job!
this channel is insane, hats off dude!
Chris, thanks for the tutorial, my game is running just fine! A lot of the concepts in this tutorial I will use when creating my own projects. God bless you!
Hey clear code! You were a huge help back when I was using pygame and your content quality is amazing. Wondering if you would ever make content about game dev in rust with a framework like bevy
Amazing! These videos are really helpful for learning python
You are making the best tutorials and all free. Thanks bro
Totally awesome guide, thanks for your work!
Absolutely amazing content!
This is why I subscribe to your channel. Amazing content, Keep it up.
ANOTHER GAME YESSSS I LOVE YOU your tutorials helped me so much !!
for those who run into an issue with pygame and mp3 files: from my short dive into it, apparently mp3 is really finnicky on pygame, and some combinations of app versions and OS lead to pygame unable to load mp3s; this was true for my Windows 10 and latest versions of all software. the solution is either skip the mp3s or use/convert to the recommended ogg or wav format (wav didn't cause me no issues).
The quality of your videos is amazing.
Now this is beautiful. Thank you!
Great tutorial! Finished it in 3 days. Excellent
you are honestly the best! thank you for your work❤
Really appreciate the fact that you're making all this for FREE. BTW, your paid Udemy course is very good for the price! Keep up the good work, you're a great YTber!
Thank you so much!! Going to start right after I finish the Zelda tutorial :D
OMG! You are my hero!!!! LOVE THIS!
Wow! Stardew valley is one of my favourite games of all time... Just yesterday I was wondering if I'll be making a clone of it in pygame... And here you are with a video today. Thank you for this!!
@kenna_king100
Жыл бұрын
Me tooo!!
@VickylanceMedia
Жыл бұрын
Although pygame is not suited for a game as large as stardew valley. If you are serious prefer more lightweight and performant engine
@charg1nmalaz0r51
Жыл бұрын
@@VickylanceMedia i disagree, a game like stardew valley isnt that demanding on resources. You can quite happily make most 2d games in pygame without issue. you would have to be doing an awful lot for it to make any sort of performance issue that requires a better language or engine to get the most out of things
Thank you so much for sharing your valuable knowledge
I really enjoy your content for the last year or so that I've been learning python! I did buy your Udemy course too, can't wait to dig into that.
@albertsun8725
11 ай бұрын
I agree
Thanks you for this great video ! I'm at 32:30 and just in case there's too much animations you can use os module to check for any folder name to create the keys for the assets dictionnary. By using dictionnary comprehension you can also fill it and if you add or remove animations the process work by itself ! 😊
I don't even see this kind of master tutorial 🤩 well done brother
Amazing! This video is very helpful
The youtube algorithm threw this at me randomly... 3 hours in and loving it! Thanks for all the effort!
No way!! I was just thinking about this a few weeks ago, I really wanted to make something like this but had no clue how to start. I absolutely love you. Immediately liked the video
Amazing work!!
Amazing series
Unbelievable man! God bless you!
I like that you make really long videos so i don't have to switch between different videos every 10 minutes lol
Just found a gem of a KZreadr 💎 Just liked & subbed.
Awesome tutorial dude!
This channel is a gold mine for python tutorials, amazing!
Great tutorial. Very helpful.
It 100% works now 🎉 was really fun making this. Definitely considering getting the premium assets to really bring this game to have more life
Hey I’ve seen this pack on itch! Fun to see someone using it in the wild
Hey! I just finished the whole thing and thought I'd give some feed back as thanks, for the great Tutorial! First of all, really great Tutorial and it is clear how much effort it must have been! This tutorial was uplaoded in the right moment for me, because I was looking to refresh my python skills and really didn't just wanna go over the basics or work with a fictional Datascience optimization Example. I was recomended this by chance by the youtube algorithm and saw how long it is and first thought, nah that's insane. A couple days later however I thought this would be the right thing, since I've never done anything like this and it looked like a fun project where I could learn a lot and maybe expaned this whole thing with more tutorials later on. Since I didn't watch any of your previouse videos or worked with Pygame I expected this to be though, and sometimes it got though to understand the full logic. However I thought you explained everything very well. I did start getting more and more impatient/unconentraited after the first couple of hours and it did also feel like you started getting slightly impatient as well after like the 3h mark and especially at the end. I did like that you left the mistakes in, where you checked for why the code was not running. It was just minor things like, cuts in the editing of the video, where the code suddenly would change mid writing or you repeating a sentence. Also when you did your fixes in the end I was a bit confused since your first fix, wasn't necessary in my code, so I assume you did fix it before putting the video together and I didn't have the line to delete. Also stuff like, the s21 Files for Daytime were already changed to the state of the next chapter, which confused for a moment when I tried to find a mistake I did. One last thing was the way to loud background music that you added into the game, I had to take down the Video volume to 20% everytime that played, I feel like something went wrong there with the audio editing in the video. Anyway, this is really just nitpicking, especially on a 6h+ Video. All in all I really loved the Tutorial, the chapters, the explanaitons and all the assets you put in one package so people could work alongside. Everytime I had an issue because I forgot a () somewhere or anything similar I downloaded the Chapter files and went line for line, which really helped. I really would love a part 2 where we learn more about implementing a proper Menu and maybe controler support or just in general build out the programm on this foundation. I'll definetly will look more into PyGame, Tiled and other things to expaned on this and try to make it my own little game project on which I work on over time. First thing I'll fix is the way to fast night timer which also keeps running when your in the menu with the merchant. That one bugged me a lot while testing. I thought I'll give a full feedback since really appreciated the work you put in, hope this is not seen as just me complaining!
@dr_frankenmiller2607
Жыл бұрын
Can you help me to find the assets for this build please? A URL or link to your GitHub where I can find the sprite sheets and WAV files please? I want build this game from scratch the GitHub repo he left up there only has text files
hey clear code you should only make the amazing game on this channel you are awesome
Although I am using other engines to create games, this pygame tutorial helps me to deeply understand the basic of 2d game development. Amazing tutorails, thanks so much.
thank u so much bro i hope u can make more pygame next time!
you have earned yourself a subscriber
Thanks a lot for this Contents .. Its really helping me a ton.
Dude, my head exploded with the sprite updates
I've been a software engineer and mainly python developer for over 15 years now, and programming about 25+ years. Fun to watch your videos and your presentation style. I will definitely pass these along
@gooser1
Жыл бұрын
hiii can you help me please, im stuck at animating my character, my “position center” seems to be off to the right bottom and 0,0 is not in the corner even. idk whats wrong
@jjcruz750
Жыл бұрын
@@gooser1 try leet code or something similar. They might be able to help
I love the tutorials and they really help. Like a lot. Could you please make a tutorial teaching us how to code a pinball game in pygame?
I Love this type of videos! But I have a good idea for the next… can you try to make a game like this BUT with online multiplayer? It would be amazing but keep the work up I like it!
Clear Code your videos are awesome, they helped me so much, my request, if you would like to, then please create a video on how to solve problems, implement them in code. Thank You!
This is such a nice game!!
Finally I dig diamond from KZread search , Thank you so much sir🙏🏼.
You re just amazing!
Man you're the best
I have the dumb, your GitHub has the right files. Thank you.
For those who are struggling with walk() function: you probably missed slash or smth. pathlib library is more comfortable to debug so you may want to discover it
Loving it so far! BTW 1:15:15 was such a perfect place to use a modulo (%) : self.tool_index = (self.tool_index + 1) % len(self.tools)
@ClearCode
5 ай бұрын
true! :D
@musicdudejoe263
5 ай бұрын
Was just about to comment this haha.
@Kbu73
Ай бұрын
You can do similarly for the frame_index: self.frame_index = (self.frame_index + 4 * dt) % len(self.animations[self.status])
awesome. find some time to teach us backend development with python too. you are so good.
At 46m09s, for the mechanism to make the frames repeat, instead of using an "if statement" you could use a module operator (%). It is faster (since it wouldn't need to do comparisons all the time) and cleaner (onli one small line of code) Short Example: frame = (frame+dt*4)%len_anim
@kenhaley4
Жыл бұрын
I noticed this as well.
These are great tutorials, and they have taught me much. I do lament not seeing solutions for adding joystick support through pygame as i tried to add this myself on another clear code project only to fail miserably and become so confused on mutilating the main game loop, it became more maddening than anything positive at all. PLEASE INCLUDE number of lives, joystick support, adding expanded levels, second player or even playing 2 player graphic game over network.... most important though is joystick support because NO ONE, and I mean of the 30-40 tuts ive looked at, NO ONE had joystick support that wors with how you seperate your player out into its own class.
Really helpful.
Thank you so much!
You're a good teacher, tnx a loot!!! 👏
Man, I love you
At 1:45:12 I used the following shorter and faster code to display the sprites. The idea is to sort the sprites by layer, then display. This eliminates the outer for loop as well as the need to use LAYERS dictionary. for sprite in sorted(self.sprites(), key=lambda x: x.z): self.display_surface.blit(sprite.image, sprite.rect) Later in the video at 2:17:05, the video shows how to add the sprite's y-position to further control the display order of sprites on the same layer, whidh would seem to require the original nested for loop after all. However, I incorporated the change into the above for loop as follows, keeping it a single loop. (Note that this includes the offset logic for the camera motion which the video added in the meantime): for sprite in sorted(self.sprites(), key=lambda sprite: sprite.z * 10000 + sprite.rect.centery): offset_rect = sprite.rect.copy() offset_rect.center -= self.offset self.display_surface.blit(sprite.image, offset_rect) The idea here is to create an integer key formatted as zzyyyy where zz is the layer number (the z attribute of the sprite), and yyyy is the y-position of the sprite. Now the sprites are sorted by z (the layer) and then by their y-location, drawing sprites in order from top to bottom, resulting in lower sprites appearing in front of higher sprites on the same layer. By the way, ditto to all the other compliments that others have made for this excellent video lesson!!
@pianoplayer1262
Жыл бұрын
In Python, you can gracefully sort by multiple things using tuples! sorted(sprites, key=lambda sprite: (sprite.z, sprite.y)) This sorts first by earlier items in the tuple, then by later items. No need to assume y < 1000, or do any math. Hope this helps
@kenhaley4
Жыл бұрын
@@pianoplayer1262 Right. Why didn't I think of that. Thanks.
@charg1nmalaz0r51
Жыл бұрын
@@pianoplayer1262 Do you have any idea how to make the sprites sort properly. Currently his rabit still appears infront of a flower for example when hes halfway up the stem instead of switching behind it when his feet pass the base of the stem. Its really offputting and i tried to sort based on midbottom of the rect but that had no effect
He make 6 hours gamedev tutorial, amazing
you are amazing dude like wth
Your videos are not good at all their great! Ive learned so much from your videos, Thank you!
Thank you so much for your tutorials!
Fr bro subbing to you was one of the better decisions I've made
Wowww, this is amarzing !!!
best quality content
You honestly deserve so much more recognition
Just completed the tutorial - took me about 16 hours total. Wow! Can't believe something like this is free. Learnt a lot and was really fun to learn something new and see/play the final finished game. Would love to see videos on the following types of games uisng pygame: - card game: yu-gi-oh style - pokemon style game - in particular aspects of changing maps, saving files and the turn based battle styles. - A game which utilies random map generation to build worlds for a top down game - A game which has dynamic world - I guess similar to this tutorial but with animals having behaviours that can interact with one another without player input. I will be going through your Zelda tutorials and Mario Maker ones too. Keep up the good work. Thanks !
@gooser1
Жыл бұрын
hi what IDE did you use? im using pycharm and i dont know why it keeps on saying “video not initialized” and “Game” has no attribute “clock”” even i typed the same thing as Clear Code does. ive been having the same problem from my first code but i dont know why this errors keeps on popping up for me. 3:31 and a lot of errors happening already :((
@gooser1
Жыл бұрын
i finished the pygame introduction video by him but idk why im having this kind of problem :((( i would be happy to have help since im presenting this as my final project
@lindenhamer4766
Жыл бұрын
Hi, I used VS code. I haven’t used APY charm before. I’m terms of where you are getting stuck. Don’t worry. I also encountered MANY bugs that I had to overcome - I will say 99% were small typos and other bugs. Potentially start again (as you’re not far into it) and try to write everything from scratch. OR re-download the starting folder and then remove anything which got added before folder was pushed to the repo.
@gooser1
Жыл бұрын
@@lindenhamer4766 hello, thank you for replying. im starting all over again :)) still stuck though which sucks hahaha
@gooser1
Жыл бұрын
oop! update! got it now! :))
A Tutorial that leads to a bunch of tutorials. Really cool
Muchas gracias, saludos desde Perú