Quick Tips
Don't forget to add the delineator at the end of every message!
Whether that's "\n"
or something else that you choose, sockets won't work without it because it won't know when the message is over.
Similarly, remember to .encode()
every message you send!
Don't be an 8 x 11 memer like Abhi.
If you add an event to keyPressed
or mousePressed
, add it immediately to your timerFired
!
Because if you send something, make sure that you can also receive it.
Watch Rohan's video (it's right here)!
That helped me understand some of the concepts.
Use lots of helper functions!
This will make your code shorter and prettier. I didn't use helpers and I was q sad. (that's q for quite)
Only send what you need to send!
For example, if you need to shoot a bullet in asteroids, you only need to send the fact that you shot a bullet. You do not need to send an update of every bullet position every time the bullet moves. Clients can handle this on their own.
You can use HOST = ""
if you are running it locally!
This is if you are running it only on one computer. This way you don't have to change HOST to your IP Address (which changes over time).
Tab
autocompletes in terminal!
So if you partially type out "dots_ser" and press tab, it will fill in the "ver.py" for you, provided nothing else in the folder starts with that.
To get your IP Address, Google "my IP"!
Pretty hard to screw this up, unless you use Bing or something.