Commit Graph

16 Commits

Author SHA1 Message Date
CPunch e5a9ed1481 shardserver: added Service()
also, Start() now returns an error result
2024-02-01 16:53:27 -06:00
CPunch ac62f7d64e moved config/ -> internal/config 2023-12-02 22:09:11 -06:00
CPunch 557117f093 moved internal/protocol -> cnet/protocol 2023-12-01 19:56:23 -06:00
CPunch b07e9ddbcb merged internal/service -> cnet/service 2023-12-01 19:22:49 -06:00
CPunch af867ccff2 renamed cnet.CNPeer -> cnet.Peer 2023-12-01 19:15:00 -06:00
CPunch c60017f78f rename cnpeer package to cnet 2023-12-01 17:11:41 -06:00
CPunch bcc999db38 moved internal/entity to shard/entity 2023-12-01 16:56:55 -06:00
CPunch e355af19ab moved internal/protocol/cnpeer to cnpeer
also started a util package
2023-12-01 15:29:19 -06:00
CPunch f4b17906ce more protocol/service refactor
- removed protocol.Event: CNPeers now send protocol.PacketEvents
- peer uData is held in CNPeer, use SetUserData() and UserData() to
set/read it
- Service.PacketHandler calback has changed, removed uData:
switched calls to peer.SetUserData() and peer.UserData() where appropriate
- service.Service lots of tidying up, removed dependence on old
protocol.Event.
- service.Service && protocol.CNPeer now accept a cancelable context.
hooray graceful shutdowns and unit tests!
- general cleanup
2023-12-01 00:56:34 -06:00
CPunch c0ba365cf5 CNPeer/Service refactor
- each CNPeer is given a unique chan *protocol.Event to pass events to
the service.handleEvents() loop. this is now passed to CNPeer.Handler()
as opposed to NewCNPeer().
- service has basically been rewritten. handleEvents() main loop uses
reflect.SelectCase() now to handle all of the eRecv channels for each
peer
- new protocol Event type: EVENT_CLIENT_CONNECT
- Added service_test.go; blackbox-styled testing like the others.
TestService() starts a service and spins up  a bunch of dummy peers
and verifies that each packet sent causes the corresponding packet
handler to be called.
2023-11-29 19:57:45 -06:00
CPunch 1f66acfd25 holy refactor
started out as me making a service abstraction..

- db.Player exists again, and entity.Player uses it as an embedded struct
- chunk.ForEachEntity() lets you add/remove entities during iteration now
- removed account related fields from CNPeer
- protocol/pool has been merged with protocol.
use protocol.GetBuffer() and protocol.PutBuffer().
- new protocol/internal/service!
service.Service is an abstraction layer to handle multiple CNPeer*
connections and allows you to associate each with an interface{} uData.
In the future it might also handle a task queue for jobs that
modify/interact with the player's uData, called from service.handleEvents()
- PacketHandler callback type has a new param! uData is passed as well now
- much of loginserver/shardserver is now handled by the shared service
abstraction
- SHARD: NPC_ENTER packets are now sent on player loading complete
rather than on enter.
2023-11-27 21:23:28 -06:00
CPunch 458e907c99 moved 'core' to 'internal' 2023-08-23 18:16:24 -05:00
CPunch 83b664da93 minor refactoring, fixed go-staticcheck warnings 2023-08-23 18:03:14 -05:00
unknown 215e313c43 added chat :D 2023-06-27 21:49:11 -05:00
unknown 3559d9ba9b switched NPC autoincremented ID to atomic int 2023-06-27 20:06:51 -05:00
unknown c4325475ed minor renaming 2023-06-27 00:48:17 -05:00