Skip to content

Commit 0e125f5

Browse files
committed
doc pass
1 parent cb00439 commit 0e125f5

2 files changed

Lines changed: 60 additions & 20 deletions

File tree

doxygen.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "libyojimbo"
35+
PROJECT_NAME = "Yojimbo"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER =
41+
PROJECT_NUMBER = 1.0
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a
4545
# quick idea about the purpose of the project. Keep the description short.
4646

47-
PROJECT_BRIEF =
47+
PROJECT_BRIEF = "Network library for client/server games"
4848

4949
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
5050
# in the documentation. The maximum height of the logo should not exceed 55

yojimbo.h

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ namespace yojimbo
604604
};
605605

606606
/**
607-
Allocator implementation based on malloc and free.
607+
The default allocator implementation based around malloc and free.
608608
*/
609609

610610
class DefaultAllocator : public Allocator
@@ -646,7 +646,7 @@ namespace yojimbo
646646
};
647647

648648
/**
649-
Allocator built on the TLSF allocator implementation by Matt Conte. Thanks Matt!
649+
An allocator built on the TLSF allocator implementation by Matt Conte. Thanks Matt!
650650
This is a fast allocator that supports multiple heaps. It's used inside the yojimbo server to silo allocations for each client to their own heap.
651651
See https://github.com/mattconte/tlsf for details on this allocator implementation.
652652
*/
@@ -3437,16 +3437,25 @@ namespace yojimbo
34373437

34383438
/**
34393439
A reference counted object that can be serialized to a bitstream.
3440+
34403441
Messages are objects that are sent between client and server across the connection. They are carried inside the ConnectionPacket generated by the Connection class. Messages can be sent reliable-ordered, or unreliable-unordered, depending on the configuration of the channel they are sent over.
3442+
34413443
To use messages, create your own set of message classes by inheriting from this class (or from BlockMessage, if you want to attach data blocks to your message), then setup an enum of all your message types and derive a message factory class to create your message instances by type.
3444+
34423445
There are macros to help make defining your message factory painless:
3446+
34433447
YOJIMBO_MESSAGE_FACTORY_START
34443448
YOJIMBO_DECLARE_MESSAGE_TYPE
34453449
YOJIMBO_MESSAGE_FACTORY_FINISH
3450+
34463451
Once you have a message factory, register it with your declared inside your client and server classes using:
3452+
34473453
YOJIMBO_MESSAGE_FACTORY
3454+
34483455
which overrides the Client::CreateMessageFactory and Server::CreateMessageFactory methods so the client and server classes use your message factory type.
3456+
34493457
See tests/shared.h for an example showing you how to do this, and the functional tests inside tests/test.cpp for examples showing how how to send and receive messages.
3458+
34503459
@see BlockMessage
34513460
@see MessageFactory
34523461
@see Connection
@@ -3589,10 +3598,6 @@ namespace yojimbo
35893598

35903599
/**
35913600
A message which can have a block of data attached to it.
3592-
Attaching blocks of data is very useful, especially over a reliable-ordered channel where these blocks can be larger that the maximum packet size. Blocks sent over a reliable-ordered channel are automatically split up into fragments and reassembled on the other side.
3593-
This gives you have the convenience of a reliable-ordered control messages, while attaching large blocks of data (larger than max packet size), while having all messages delivered reliably and in-order.
3594-
Situations where this can be useful is when sending down the initial state of the world on client connect, or block of configuration data to send up from the client to server on connect.
3595-
It can also be used for messages sent across an unreliable-unordered channel, but in that case blocks aren't split up into fragments. Make sure you consider this when designing your channel budgets when sending blocks over unreliable-unordered channels.
35963601
@see ChannelConfig
35973602
*/
35983603

@@ -3728,10 +3733,13 @@ namespace yojimbo
37283733

37293734
/**
37303735
Defines the set of message types that can be created.
3736+
37313737
You can derive a message factory yourself to create your own message types, or you can use these helper macros to do it for you:
3738+
37323739
YOJIMBO_MESSAGE_FACTORY_START
37333740
YOJIMBO_DECLARE_MESSAGE_TYPE
37343741
YOJIMBO_MESSAGE_FACTORY_FINISH
3742+
37353743
See tests/shared.h for an example showing how to use the macros.
37363744
*/
37373745

@@ -4614,7 +4622,7 @@ namespace yojimbo
46144622
};
46154623

46164624
/**
4617-
Connection class.
4625+
Sends and receives messages across a set of user defined channels.
46184626
*/
46194627

46204628
class Connection
@@ -4818,9 +4826,9 @@ namespace yojimbo
48184826
};
48194827

48204828
/**
4821-
Adapter class
4822-
This is used to integrate your game engine with yojimbo.
4823-
It lets you specify the message factory to be used by client and server, as well as to implement various callbacks.
4829+
Specifies the message factory and callbacks for clients and servers.
4830+
An instance of this class is passed into the client and server constructors.
4831+
You can share the same adapter across a client/server pair if you have local multiplayer, eg. loopback.
48244832
*/
48254833

48264834
class Adapter
@@ -4829,20 +4837,42 @@ namespace yojimbo
48294837

48304838
virtual ~Adapter() {}
48314839

4832-
// todo: document this class
4840+
/**
4841+
Override this function to specify your own custom allocator class.
4842+
@param allocator The base allocator that must be used to allocate your allocator instance.
4843+
@param memory The block of memory backing your allocator.
4844+
@param bytes The number of bytes of memory available to your allocator.
4845+
@returns A pointer to the allocator instance you created.
4846+
*/
48334847

48344848
virtual Allocator * CreateAllocator( Allocator & allocator, void * memory, size_t bytes )
48354849
{
48364850
return YOJIMBO_NEW( allocator, TLSF_Allocator, memory, bytes );
48374851
}
48384852

4853+
/**
4854+
You must override this method to create the message factory used by the client and server.
4855+
@param allocator The allocator that must be used to create your message factory instance via YOJIMBO_NEW
4856+
@returns The message factory pointer you created.
4857+
4858+
*/
4859+
48394860
virtual MessageFactory * CreateMessageFactory( Allocator & allocator )
48404861
{
48414862
(void) allocator;
48424863
yojimbo_assert( false );
48434864
return NULL;
48444865
}
48454866

4867+
/**
4868+
Override this callback to process packets sent from client to server over loopback.
4869+
@param clientIndex The client index in range [0,maxClients-1]
4870+
@param packetData The packet data (raw) to be sent to the server.
4871+
@param packetBytes The number of packet bytes in the server.
4872+
@param packetSequence The sequence number of the packet.
4873+
@see Client::ConnectLoopback
4874+
*/
4875+
48464876
virtual void ClientSendLoopbackPacket( int clientIndex, const uint8_t * packetData, int packetBytes, uint64_t packetSequence )
48474877
{
48484878
(void) clientIndex;
@@ -4852,6 +4882,15 @@ namespace yojimbo
48524882
yojimbo_assert( false );
48534883
}
48544884

4885+
/**
4886+
Override this callback to process packets sent from client to server over loopback.
4887+
@param clientIndex The client index in range [0,maxClients-1]
4888+
@param packetData The packet data (raw) to be sent to the server.
4889+
@param packetBytes The number of packet bytes in the server.
4890+
@param packetSequence The sequence number of the packet.
4891+
@see Server::ConnectLoopbackClient
4892+
*/
4893+
48554894
virtual void ServerSendLoopbackPacket( int clientIndex, const uint8_t * packetData, int packetBytes, uint64_t packetSequence )
48564895
{
48574896
(void) clientIndex;
@@ -4863,7 +4902,8 @@ namespace yojimbo
48634902
};
48644903

48654904
/**
4866-
Network Info
4905+
Network information for a client connection.
4906+
Contains statistics like round trip time (RTT), packet loss %, number of packets sent, received and acked.
48674907
*/
48684908

48694909
struct NetworkInfo
@@ -4876,7 +4916,7 @@ namespace yojimbo
48764916
};
48774917

48784918
/**
4879-
Server interface
4919+
The server interface.
48804920
*/
48814921

48824922
class ServerInterface
@@ -5210,7 +5250,7 @@ namespace yojimbo
52105250
};
52115251

52125252
/**
5213-
Server implementation.
5253+
Dedicated server implementation.
52145254
*/
52155255

52165256
class Server : public BaseServer
@@ -5280,7 +5320,7 @@ namespace yojimbo
52805320
};
52815321

52825322
/**
5283-
Client interface.
5323+
The common interface for all clients.
52845324
*/
52855325

52865326
class ClientInterface
@@ -5492,7 +5532,7 @@ namespace yojimbo
54925532
};
54935533

54945534
/**
5495-
Functionality shared across all client implementations.
5535+
Functionality that is common across all client implementations.
54965536
*/
54975537

54985538
class BaseClient : public ClientInterface
@@ -5618,7 +5658,7 @@ namespace yojimbo
56185658
};
56195659

56205660
/**
5621-
Client implementation.
5661+
Implementation of client for dedicated servers.
56225662
*/
56235663

56245664
class Client : public BaseClient

0 commit comments

Comments
 (0)