Commit Graph

113 Commits

Author SHA1 Message Date
670d4a514c more better CNPeer.Send()
this fixes a race condition where if 2 goroutines try to send a packet at the same time, they could end up being
malformed due to the 2 separate calls to peer.conn.Write().

instead of writing the packet size to peer.conn.Write() directly, we make space in buf for the packet size,
and patch it in place. this lets us get away with only having 1 call to peer.conn.Write() which will ensure that
the full packet is written properly and be goroutine safe :3
2023-08-23 17:38:10 -05:00
7ebe80d6e3 fixed FinishPlayer assigning items to the wrong slots 2023-07-02 17:24:15 -05:00
f27e72d68d send chat packets to *all* players 2023-06-27 22:05:08 -05:00
215e313c43 added chat :D 2023-06-27 21:49:11 -05:00
3559d9ba9b switched NPC autoincremented ID to atomic int 2023-06-27 20:06:51 -05:00
c4325475ed minor renaming 2023-06-27 00:48:17 -05:00
fd41b32b70 added NPCs; added tdata submodule
- use environment variable TDATA_PATH to specify the location of the
  tdata directory
2023-06-27 00:36:02 -05:00
80dc876517 added shard.addEntity() and shard.removeEntity() 2023-06-27 00:11:00 -05:00
c09a6cfd25 fixed sent server time 2023-06-25 18:29:31 -05:00
8f00a0c492 movement.go: added support for basic movement packets
you should be able to view other players and jump around together,
although while testing locally one of the clients would always trigger
the "Some irregularities have been found with your connection to the
server, so your game will be closed" speed check for some reason ???

really not sure, might just be my machine

chunking uhhh works ? kind of, not tested for more than a few seconds
before one of the clients disconnects
2023-06-25 04:27:42 -05:00
f6ab7a9b5d started chunking 2023-06-25 03:33:17 -05:00
f0b9bc6ed6 god forgive me for this commit 2023-06-25 01:51:21 -05:00
dfc00bcb52 shardServer: simplified peer map logic 2023-06-24 22:36:04 -05:00
1da82ac750 include AccountID in loginMetadata 2023-06-22 18:12:31 -05:00
d42a34535b split redis.go 2023-06-22 18:05:02 -05:00
d7445e0f0f Switched to redis/postgres, major refactoring
- loginMetadata is passed to shards through redis now
- shards announce they're alive via redis.AnnounceShard() which just
  populates a hashset keyed 'shards'
- login servers grab the 'shards' hashset and randomly picks a shard to
  pass the player to (for now)
- ./service shard && ./service login
- Many new environment variables, check config/config.go for more info.
  or for a tl;dr just read the Dockerfile for the required ones
- Shard and login services now run in different processes ! (and
  containers?? wooaaah)
2023-06-22 01:53:38 -05:00
983588b6c9 dockerfile: switch to scratch
- build.sh: disables CGO and specifies linux
- we really don't need the cstdlib now, and we don't need a busybox shell
2023-06-20 18:33:29 -05:00
124bb77f8d dockerfile: specified entrypoint 2023-06-20 18:24:17 -05:00
e4cf64d7bc started docker image 2023-06-20 02:12:15 -05:00
727c68aef3 server: split login/ and shard/ 2023-03-27 17:02:13 -05:00
70e42b5d79 server/shard: added UpdatePlayer(), which should be used whenever player struct state needs to be updated to prevent race conditions 2023-03-26 21:08:13 -05:00
bb29a988b3 landwalker achieved!
- the shard's ip sent to the client via the login server is currently hardcoded in config/config.go
- no packets other than P_CL2FE_REQ_PC_ENTER and P_CL2FE_REQ_PC_LOADING_COMPLETE are supported via the shard server
2023-03-22 17:07:16 -05:00
5b2a8b838e major refactoring: db.Player is now core.Player
- misc. cleanup
- core/db/players.go: works with core.Player types, will also grab inventory table
2023-03-22 00:30:58 -05:00
735bdc5b36 protocol: added CNPeer
- moved Peer from the server package to the protocol package, it was also renamed to CNPeer as most fusionfall specific constants in the client use the 'CN' prefix.
2023-03-18 16:40:20 -05:00
1357de99aa server: started ShardServer
- protocol: added GenSerialKey() which securely generates an EnterSerialKey
- login server accepts a shard via LoginServer.AddShard()
- login server will pass LoginMetaData to the selected shard via ShardServer.QueueLogin()
- misc. refactoring
2023-03-17 16:27:47 -05:00
7a26ffdcf7 server/peer: wrap 'defer pool.Put()' in a closure 2023-03-11 15:02:01 -06:00
cbe308a0bd misc. db.GetPlayers() result is now truncated 2023-03-11 03:28:11 -06:00
c62ed5d101 db: GetPlayerInventorySlots() can just build the array the first pass, no? 2023-03-11 02:06:39 -06:00
a0a108a605 more better 2023-03-11 01:48:26 -06:00
850dd59967 protocol/packet: accept structs by value for encoding
- server/loginServer: no longer sending packets by pointer, except in cases like AcceptLogin(), which operates on a sent structure slice. since these are already allocated, no need to copy them
2023-03-11 00:24:20 -06:00
00fa94162c server: refactoring; start support for variadic packets 2023-03-10 23:59:13 -06:00
d60638d555 loginServer/peer: peer no longer uses panic/recover for error recovery 2023-03-10 20:30:16 -06:00
857250bf33 protocol/packet: don't panic, return errors 2023-03-10 20:07:48 -06:00
f1552830a0 protocol/packet: switch away from allocation
- Packet struct is small enough that allocation for it is really unnecessary, and can be passed around by value fairly easily
2023-03-10 20:00:06 -06:00
985890d351 protocol: packets operate on io.ReadWritter; now use a buffer pool to encode/decode packets 2023-03-10 19:56:05 -06:00
5cc3f275c1 packet: refactoring; use go's binary package for encoding *most* things 2023-03-10 17:10:57 -06:00
52f0c4b1c7 update module name to reflect repo 2023-03-10 01:02:28 -06:00
bf1e9d1350 updated README 2023-03-10 00:58:29 -06:00
5c7b9bf9fb login: implement CHAR_DELETE && SAVE_CHAR_TUTOR
- inventory is now properly grabbed from db
2023-03-10 00:41:21 -06:00
8c52df6554 server: Client -> Peer 2023-03-09 16:42:13 -06:00
294e83d533 db/account: match the DB usage of others 2023-03-09 15:37:41 -06:00
c4ce7ae6c2 removed test.db
honestly forgot it got added to the commit history. there's nothing worth protecting in this db. i'll save you some time, the password for the 'hello' account is 'world'.
2023-03-09 15:33:39 -06:00
6df016b421 login: validate characters 2023-03-09 14:41:38 -06:00
8569225ec7 major refactoring; started DB
- DB work has started in db. this will be a direct port of the OpenFusion DB format.
- LoginServer is now less of a dummy. You can create and login to accounts, and create a character to go through the tutorial with.
- config.go will host some commonly changed variables.
- protocol: fixed a bug relating to arrays being ignored while encoding packets
2023-03-09 01:48:13 -06:00
1fff485f93 refactoring; moved client to protocol package 2023-03-07 17:04:57 -06:00
4c7696dc92 genstructs.py now also scrapes constant definitions 2023-03-07 16:28:34 -06:00
07dae43072 no more manual shuffling of structs!! script works off of raw ilspycmd output 2023-03-07 15:53:12 -06:00
20af006566 misc. refactoring 2023-03-07 15:31:34 -06:00
3f4ce93f9f genstructs.py: include go source header 2023-03-07 15:08:48 -06:00
b639346605 server: split LoginServer, new Server interface 2023-03-07 14:47:49 -06:00