NetBlitz - Documentation
About NetBlitz 1.3 - NetBlitz is a easy to use UDP Library, using DirectPlay like commands, the point of the library is make changing your DirectPlay code (Very slow multiplayer support) to UDP code (better, quicker multiplayer support) easier with minimum effort, if you don't think that is possible, look at the example that came with this program. NetBlitz is the evolved working version of InternetBlitz. This program is for use with Blitz Basic(2D, 3D, Plus). You can also use the library to create new multiplayer games without changing your DirectPlay knowledge, you will have no problem using this library if you have used DirectPlay before. Surreal's BlitzPlay has somewhat inspired me to go after doing this library with UDP (Thanks Surreal). NetBlitz was created by David Dawkins (nick- starfox), if you need any help, email me. Most of all, have fun developing multiplayer games (no matter what library you use)!
Licensing Information - The only information you need is that you cannot sell this source code, or put it under your name. You cannot modify it and release it without my permission. It is free of use, for freeware and commercial, the only thing I require, is that you mention my name in your program somewhere, other then those things, this program is yours to use.
Features - (Some of the outstanding features of the Library)
1. Fast and easy UDP support
2. DirectPlay like commands
3. Very simple to understand and modify
4. Small and compact library
5. Writes to the Debug Log, for easy message Checking
6. Change DirectPlay support in a snap!
7. Royalty Free!*
*Under Condition (Read Licensing Information)
1. StartNBGame(port = 80) - This starts up the game and returns the handle of the udp stream
2. CreateNBPlayer$(name$,sip$,udpstream,hosting=0) - This actually creates the player, it sends a special message to the all the players (Type 100), parameters include your name, the host port, the stream you are using and the port, if available, If you are the host, make sure that hosting = 1. This command returns a special id that is a string.
3. DeleteNBPlayer(udpstream) - This command deletes the player, it sends a special message to all of the players (Type 101), it is vital that you use this command before the StopNBGame() command, or things will mess up.
4. StopNBGame(udpstream) - This ends the stream, the use of this command is to finally close of connection to the internet. Use after DeleteNBPlayer() function.
5. NBPlayerName(id) - Returns the name of the specified player, on the specified id is given.
6. NBPlayerLocal(ip=0) - This commands returns 1 if the specified ip is a local ip.
7. RecvNBMsg(udpstream,readme=1) - Returns 1 if a message has been received, if the readme param is 1 then the NBmessage is the received message (NBmessage explained later) otherwise the NBmessage will be the same as old.
8. NBMsgType(udpsteam) - Returns the type of the last message received
9. NBMsgFrom$(udpstream) - Return the id of the last message received
10. NBMsgData$(udpstream) - Returns the actual string data in the message, you can parse the message to get other information
11. SendNBMsg(typ,msg$,idto,udpstream) - Sends a message to the specified id, parameters include type of the message (Distinguish with NBMsgType()), the message (Distinguish with NBMsgData()), the id of the receiver (0 if you want to broadcast).
12. NBMsgTimeOut(milliseconds) - The timeout of each RecvNBMsg()
13. WriteNBString(typ,texts$,udpstream) - Writes a string to the udpstream bank, so you can send it as a packet with the SendNBPacket() command
14. SendNBPacket(idto,udpstream) - Send a packet full of messages to the destination id (0 if broadcast)
15. NBCopyPacket(udpstream,deststream,buffer) - Copy's a packet from the source stream to the destination stream, using the specified buffer
16. CheckNBDatabase(udpstream,msgtype=0) - This command checks the database of message it may have, or it may have to send. If you are the host and the person who has joined has sent you the message that they have joined, you should use this command (CheckNBDatabase(udpstream,1)). This command will handle all of the sending information about each NBplayer. What NetBlitz does is when a new player joins, the host sends a big packet, with all the information of each player, then the new persons receives this message, and puts it in their NBplayer bank (will get to this later). Very important command.
17. CountNBPlayers() - Returns how many people are playing
18. ReadNBPacket(udpstream) - reads through a packet slowly(by string), this command changes the NBmessage
19. NBGamePort(udpstream) - Returns the port of the stream you are using, useful if you did not specify a stream.
20. NBMsgPort(udpstream) - Returns the port of the last message received
21. NBMsgIp(udpstream) - Returns the ip of the last message received
22. CheckAvailPorts(udpstream) - Checks for other ports that are used and returns the first availiable one
23. NBPlayerPort(id) - Returns the port of the specified player on the specified id
24. NBPlayerIP(id) - With the new system that NetBlitz uses, it would be helpful to know the ip of each player that matches the id.
25. ConvertToID$(ip,port) - Convert a port and a ip to one id, useful if you don't know the id
Other Important Things:
Global's - There are five globals in NetBlitz, the first one is the server ip, second one is NBmessage (The NBmessage is the global that contains the last message received), the third is the name of the player you have, the fourth one is the server's port, and the fifth is the user id (This is similar to DirectPlay).
Types - There is only one type, that type is NBplayer, this type stores the port, name, and ip of each player
If you have any other commands in mind, write the name of the command you want, and the description of it, and email me with it.
Tutorial - If you read the example file, you will have a better aspect on how NetBlitz works. If you have any problems, contact me on the blitz basic forums or contact me. Hope you have fun.
v1.0 Added The Whole Library Of Commands
v1.1 Added one parameter to CreateIBPlayer(), and integrated CheckIBDatabase() with that command
v1.2 Changed the internal structure on how Internet Blitz worked. Instead of knowing the ip and the port, all you need to know is the id. Added one more global ibuserid and added the functions IBPlayerIP() and ConvertToID().
v1.3 Rewrote the whole library and renamed it NetBlitz, this library has been tested thoroughly and has worked on a firewall protected network computer perfectly. The commands are not known as 'IB' anymore, now they are 'NB', please use replace. NetBlitz uses a whole new system that detects id, much like DirectPlay works instead of ip and port, the id is string instead of integer.
NetBlitz Is Property Of The Dawkins Enterprise