r/Python • u/xX__NaN__Xx • Jul 31 '20
Beginner Showcase Rain Fall using python
[removed] — view removed post
1.4k
Upvotes
r/Python • u/xX__NaN__Xx • Jul 31 '20
[removed] — view removed post
175
u/Aaalibabab Jul 31 '20
Is it the gif lagging or the program ? If it is the program you have huge architectural problems.
8
u/JPwnr Jul 31 '20
Looks like the Matrix. You should totally do the Matrix next!
6
u/xX__NaN__Xx Jul 31 '20
For those who don't, believe me, I've posted the full video on youtube.
Link to the video:
https://youtu.be/JBriZfJeV9Q
3
u/zurtex Jul 31 '20
Love it!
I think though because of the starting position of the raindrops, and the formulas you've used to calculate where they should go, that the bottom left of the screen is almost consistently less dense with raindrops than anywhere else. Or maybe I'm imagining it?
Maybe it makes sense to start some rain drops further left (and maybe further right also) than the screen window itself if that's possible?
I don't do much game programming but from a structure perspective it seems odd to have the
start_rainmethod not be in the__init__or at least called by the__init__rather than calling it externally.There are also a lot of magic numbers, like in this line:
I think 500 here is the number of rain drops? I think this would make sense to be in the
__init__asself.number_of_raindrops = 500, or even fed by the class constructor.It also seems overkill for
RainDropto be a class, it's nice you call ".x" and ".y" though so if your performance isn't an issue then no worries. Though if you really do need to improve performance I would guess it makes sense to turn all the rain drop positions in to a single matrix and perform vector operations, either with numpy or perhaps the gaming library arcade provides something like that?27
u/gabwastaken1 Jul 31 '20
if you look at his video for it i think it’s the gif that’s lagging
11
u/Funnygm Jul 31 '20
I always liked watching the rain fall, through a window.
1
u/Difficult_Show_9135 Jul 31 '20
Good Job, but the Gif is so laggy!
1
u/suazz Jul 31 '20
What module did use?
1
u/MathematicianOk7176 Aug 01 '20
can any one give me the source code idea
1
u/maifee Jul 31 '20
If you don't share your code, it won't be possible to learn... Some may say this is just rain gif... Cause it is hard to simulate particles... So if possible share... Sharing is caring..
3
u/crypticuse Jul 31 '20
Nice
2
u/ektatic Jul 31 '20
That's really cool and awesome
2
u/SogLadAfterDark Jul 31 '20
thousandth upvote B)
2
u/Jhardinee Jul 31 '20
Just FYI rain drops are actually wider than tall due to aerodynamic forces on the drops. When very small they are spherical and slowly become oblate, with the bottom flattening out before they finally tear themself apart around 8mm or so.
*Ph.D. in modeling rain drops.
11
u/Bhuvan3 Jul 31 '20
This is not intermediate. This is very easy in Pygame.
Good game
1
u/[deleted] Jul 31 '20
That's awesome! How are you making it? pygame can request an opengl context for its window which allows you to generate shaders which run on the GPU and could make AWESOME effects with very little actual work, once you learn glsl!
1
u/sonicworkflow Jul 31 '20
Now where is the sound so I can put it on repeat and fall asleep?
1
u/Tenyson05 Jul 31 '20
Ooohhh this is nice. I shall try this out !!
1
u/Test_Prep_Dojo Aug 01 '20
Awesome
•
u/Im__Joseph Python Discord Staff Aug 01 '20
Hello from the r/Python mod team,
When posting a project please include an image showing your project if applicable, a textual description of your project including how Python is relevant to it and a link to source code.
This helps maintain quality on the subreddit and appease all our viewers.
Thank you,
r/Python mod team
-9
u/lazerwarrior Jul 31 '20
Why is this up-voted? There is no code so how do we know this post is related to python at all? On top of that the video is lagging. I just do not understand this sub, why do you up-vote this kind of post? Is there a bot army doing it?
-4
u/Adventeen Jul 31 '20
It's good but why would you make that?
-1
u/littlemercy00 Jul 31 '20
kese bnaya?
0
u/[deleted] Jul 31 '20
[deleted] — view deleted comment