Just an unrelated question, why not use CORBA for the networking ?
While CORBA is well suited for database and transaction systems, it’s
too high level to use as the abstraction layer for networking games.
Basically, real-time games need the following:
- Millisecond accuracy and overhead.
- Fast error detection and recovery.
- Broadcast or multicast support.
For these same reasons TCP is not necessarily the optimal choice for
most game networking. TCP stands for Transmission Control Protocol,
and as you might guess from the name, has a fair bit of error correction
and dynamic bandwidth adjusting built into it. This presents overhead
that you won’t necessarily want in your game.
UDP is a very good choice for most real-time games, as it is datagram based
with almost zero protocol overhead. The disadvantages of it are that
packets can arrive out-of-order, or never arrive at all. This can be
worked around using a variety of methods, including sort of patching
things up after inconsistencies occur. You can see this in Diablo,
as creatures suddenly “warp” to a different spot, or someone suddenly
appears in a different place, already dying.
I’m redoing the API for the networking library, so that it will have
two separate APIs for TCP and UDP, taking advantage of the characteristics
of each protocol. Both will be available, depending on your needs:
(This is still really rough)
TCP:
create(server/remote)
select(server/remote)
accept(server)
send(remote, data, len)
recv(remote, data, maxlen)
close(server/remote)
UDP:
initialize(localport)
channel = open(address)
read(packet, timeout)
readv(packets, npackets, timeout)
getpacketaddress(packet)
write(channels, packet);
writev(channels, packets, npackets);
close(channel)
deinitialize()