Monday, April 4, 2011

AHHHHHH ITS WORKING@#$%@#%$^@%^!@&*&^%$#

When I realized it was working, This is how i felt

What was it that makes me feel like a kid who just got blastoise?

Funny you should ask..

I've spent all day working on my game, and at this point I can start up the server on my PC, start a client on my PC, which connects to the server. I can then move my character around and get everything displayed to the client HUD. 


I can also start up a client on my Mac, which i then connect to my PC server,
And the best part is?
Both the PC and the MAC client each have their own character which they can move around, and each client can see the other client's characters moving around also!!!

Note: there may be a number of subliminal key things which i mentioned here, that you may have missed.
In the interest of getting the reader (you) to a point of more understanding and awe inspired gratefulness, I will list the things you may have missed, and what they mean.

1) The server is running on a PC, and I was able to connect with a Mac client.
    This is great because it means my multiplayer software is cross platform. And there will be no issues with running the game from, well, pc to mac, or mac to pc. (a big plus) (thanks for this goes to twisted)

2) Each client can see the other clients characters
    This took a lot lot lot of thinking on how to do. But it ended up working. Basically, the game state is sent to all of the clients, so they all see the same game. Sounds easy, but, well, whatever...

3) The Mac client connected after the PC client
    This took forever to figure out how to do. Because when a new client joins, there are already tons of objects on the screen which the new client has no clue about 
so when the server says: hey client! update these (insert potentially big number here) objects, move them to this position! The client says: uh, I have no clue what those are! I wasn't around when those were made!)

So I fixed this by having the server send out the entire game state when a new client connects (which I had to organize, and package into useful stuff, then unpack on the client side, and use the info to get up to the same level as the server). Again, it sounds like a matter of: Oh, just do this... But. theres a lot more to it than it sounds.

Wrap up

Yeah thats pretty much it, I guess ill note that at this point the code is 1000+ lines, which is already one seventh of the code in Color Tower Defense. And all it does is moves a character around. Wait, thats just the mentality that I was saying don't have. Cause as I mentioned, It does a lot more than just move characters around. But anyways. Without the Network code and multiplayer, this would have taken < 100 lines of code to do. Big difference.

The Future is in the FUTURE

some good news is that I have a knowledge of how to send info back and forth between the clients and server. So at this point I can focus on adding features, as in more gameplay stuff. My next goal is to make it so each character can shoot projectiles, and the other characters have to dodge them, while shooting back! It could actually be fun.

Stay tuned...


  1. That was hysterical.

    Nice job describing things so even I, a low-tech person, can understand them.

    I can't wait to see this new game!

  2. Hey, hey. How's the Python+Twisted life going? Still making networking progress? I hope so. Look forward to seeing the next finished project!