Duel

Also known as TutWaffle

This is my DBC (not-enhanced) version of Lee Bamber's Monster Hunt tutorial. I started with Tut25 and added 2 player support via internet. This was mostly to test out internet functionality. But, I added it in such a way that the original Tut25 is still intact. This makes seeing my changes easy. Also good for demonstrating how to add internet play to an existing project. Its a simple project and pretty well documented. The multiplayer stuff in the help files is not exactly helpful as they do not show a real-world example. They do show enough to give a taste and to ease the fear. But, to truely understand this will provide plenty of coverage. The only complicated thing is setting up. While learning that part, you should expect your PC to crash a few times. Expect it and add plenty of debugging code to help you locate the flaw. The other thing to watch for is how often you send data. Avoid sending data every time through the main loop. If you do, all computers in the game may crash from too much data. BUT, do check for data every game loop to keep your input buffer empty. If you closely examine my code, you'll see I have a timer that monitors the frequency of data output. If the required time delay between data sends has not elapsed, no data will be sent. That gives time for the other computer to clear its input buffer. How much time is required depends on alot of factors .... the size of the data you send, the speed of the connection, the speed of all computers ..... So, in this demo, I picked a delay of 100msec (0.1 seconds). I figure most any PC can keep up with that. Also, that does not seem to effect play too much. A longer delay and the creatures may seem to jump around instead of move. A shorter delay and the game may begin to have frame-rate issues.... Its a trade off. Every game will have unique problems, but these are the major tradeoffs. You can use special code methods to "hide" some problems, but that's beyond this tutorial. I do address some of them. Example: the missiles are not updated ever. They are simply fired and forgotten. Each PC handles its own impact testing and gives results if an impact occurs. For homing missiles (not sure if thats in this version, but it is in the DBPro version) they are only updated if a change happens in the heading. This shows one way internet lag can be ignored. Basically, its guessing where a missile "should" be based upon last known data.
Home
Download