Sunday, April 3, 2011

Twisted Tutorials and Helpful Stuff..

I've been trying to get a multiplayer game working for awhile now, and during that time i have searched far and wide to find some half decent tutorials and other helpful stuff. I have talked with a lot of different people in hopes of getting some good help, and, while I have not found anything I would call really, really helpful, I have stumbled upon a few sites that have pointed me in the right direction.


Pygame Twisted Tutorial
http://ezide.com/games/writing-games.html
This guide does a great job of explaining how to use a MVC model to make games. Its really good and all, except on the part where it tries using twisted to make the game. In this aspect, its very close to garbage.
Regardless, this is the tutorial that i have been using mostly. I went through all of SJBrown's source code (the person who wrote the tutorial) desperately trying to make sense of what I was seeing. (Because he doesn't explain it very well in the tutorial) My goal was to look at his example until I knew how it worked well enough to implement it in my game. The source was nearly impossible to follow because he has the code split up into unorganized modules and other reasons (especially the parts where he is sending objects back and forth between the server and client, thats confusing). And it didn't help that he has a stupid map object that is integrated with the character's movement, or that his example game doesn't even work with multiple clients connected to the server (WHAT the HECK is that about? whats the point of using twisted if its only going to be a single player game?!?!?!) I ended up going through the source code line by line, copying it down using my own variables and values. 


Its been a long process but it has finally been working. There were alot of things i had to change 
(And i got mocked a few times on IRC because people would say stuff like: What? why do you need to know what that means? That code is terrible. If your doing it that way then your doing it wrong, do it this much more simple way... 
To which I would reply: Oh sorry, Im just trying to follow this tutorial and thats how he's doing it. I didn't write that code.)


if SJBrown ever reads this post:
Dont get me wrong, I'm thankful for what helpful info your tutorial has taught me. 


Anyways...


Game physics in a network game
http://gafferongames.com/game-physics/fix-your-timestep/
I have not got to a point in development where i will need to use this. But it is very helpful. And well written. Not specific to twisted


Crazy Russian Twisted Example
http://bytemuehle.de/Twisted%20Einführung/#grobe-struktur-eines-einfachen-twistedprogramms
This is a helpful example, very well structured and easy to see whats going on
note: it may not be russian, thats just a guess. I used google.translate to read the intro.


General Networking Development
http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
This is professionally written, and really helpful, I would recommend it to EVERYONE. Its not really talking about twisted though.


Twisted Actual Game Example
http://bazaar.launchpad.net/~game-hackers/game/trunk/files/head:/
This is a real game that is in development, It is open source. I've looked through it for a little bit, but the networking code appears tightly integrated into the rest of the game. So at this point I have not taken the time to look through it and try to understand how it works. But I have talked with one owner of this game and he was a twisted pro, he knew what he was doing. 




This list Is the ones that are actually helpful. I've gone through a lot more tutorials than these. I have not really seen any ones that sort of "explain it all". But I have been able to figure out a lot using these. 




Update On My Game
At this point in my game, it is possible to connect multiple clients to the server. You can then control the character on the screen using the w,a,s,d keys. The next thing i'm working on is making it so multiple characters can be controlled by different people (so every person will have their own character, and each person playing can see everyone else's characters).


I also need to think of a name for the game.
At this point its project defender. But that was sort of because I couldn't think of anything better.


Have a nice day.



1 comment:

  1. Sorry it's so hard to find good instructional material. Are there magazines that publish cutting edge code and general instructions? It's pretty impressive that you're teaching yourself such hard information. Let me know if you need help tracking anything down.

    ReplyDelete