Commit Graph

136 Commits

Author SHA1 Message Date
Bill Meltsner
4d2907d2ce Check the user token's type to ensure it's a string, and thus won't break anything that assumes it is. 2012-09-13 00:22:59 -07:00
Guangcong Luo
955fe3948e Reduce the login server timeout to 10 seconds
(this is on the off chance that a login server stall is causing our lag spikes)
2012-08-17 21:43:08 -07:00
Guangcong Luo
c2d09f55b2 New protocol - significantly reduced network usage 2012-08-14 20:02:56 -07:00
Guangcong Luo
ea746cf2ca Don't crash on malformed JSON 2012-08-14 16:59:34 -07:00
Guangcong Luo
59959ce24e Chat commands for most user actions
- we're moving to a new protocol! wheee!
2012-08-12 13:44:59 -07:00
Guangcong Luo
641f4c153c Support engine.io 2012-08-10 18:55:12 -07:00
Guangcong Luo
91f3f20364 Comment out some unnecessary logging 2012-08-10 09:54:05 -07:00
Guangcong Luo
1d31929db8 Time out requests and responses after 2 seconds each 2012-08-08 23:50:40 -07:00
Guangcong Luo
efc9d77f58 Time out requests after 3 minutes 2012-08-08 22:37:33 -07:00
Guangcong Luo
1b5d406fa3 Some improvements to login/ladder server connection 2012-08-08 13:20:11 -07:00
Guangcong Luo
47c7e02464 Batched ladder requests 2012-08-07 19:21:53 -07:00
Guangcong Luo
2ab4f287db New request API
(preparation for batched requests)
2012-08-05 00:10:04 -07:00
Guangcong Luo
445b840411 Disconnect is now handled separately 2012-08-04 00:56:44 -07:00
Guangcong Luo
878a3f9b11 Implement the disconnect event correctly 2012-08-04 00:51:45 -07:00
Guangcong Luo
4831e68a8c Multi-process battles!
Battles now occur in a separate process.
Hopefully, this results in a substantial increase in network stability.
WARNING: Battle crashes are now practically unrecoverable.
2012-08-01 13:48:58 -07:00
Guangcong Luo
31e642c5a2 Rename simulator.js to battles.js 2012-07-31 19:48:09 -07:00
Guangcong Luo
a230425dcd Fixes to verifier 2012-07-29 14:23:05 -07:00
Patrick Roberts
2325ed9c9a connection grabs IP from behind proxy and fs stream doesn't throw exception now 2012-07-28 23:22:36 -05:00
Guangcong Luo
b801be60c0 Normalize set variables 2012-07-28 17:28:42 -07:00
Guangcong Luo
8b0ee28f21 Hopefully this will make request limiting work properly 2012-07-23 23:30:15 -07:00
Guangcong Luo
8c7449d441 Try to limit the number of open requests 2012-07-23 23:25:49 -07:00
Guangcong Luo
1dc63e446f Even fewer console messages 2012-07-23 23:25:49 -07:00
Guangcong Luo
ba78f59052 Continue cutting down on what we print to console 2012-07-23 13:36:11 -07:00
Guangcong Luo
5df400c39e Support Node 0.6 and 0.8 2012-07-20 23:53:57 -07:00
Guangcong Luo
b654c5f5b6 path.existsSync is now fs.existsSync in Node 0.8 2012-07-20 14:33:53 -07:00
Guangcong Luo
12dac23bb1 setuid support 2012-07-20 13:43:24 -07:00
Guangcong Luo
0db9ffc394 Severely cut down on the number of debug messages 2012-07-17 12:45:25 -07:00
Guangcong Luo
6a4f08f26b New request code - maybe it'll be better on the server? 2012-07-16 17:09:32 -07:00
Bill Meltsner
22cd7cab27 Guard against the mysterious and seemingly impossible situation where someone successfully connects with a null socket. 2012-07-08 20:38:06 -05:00
Bill Meltsner
c31ee2a428 Add SockJS as the default networking library.
You can still use Socket.IO by setting config.protocol in config.js.
2012-07-06 22:56:28 -05:00
Guangcong Luo
b3054fefdf Load all data using tools.js
- the original names BattleItems etc have been deprecated; please use:
  - Tools.getItem() accessor method if possible
  - Tools.data.Items for lower-level access (e.g. iteration)
- app.js was also rearranged a bit
2012-06-13 22:51:37 -07:00
Guangcong Luo
12e9b5458b Make tools.js support mods (past gens)
- replace Tools.foo with Tools.mod('gen4').foo for gen 4 tools
- mods are stored in mods/modname/ in the same directory structure as data/
- mods modify base data
- further documentation coming soon in mods/modding.md
2012-06-13 08:27:32 -07:00
Bill Meltsner
651881e2f1 Temporarily disable JSONP in Socket.io until https://github.com/LearnBoost/socket.io/issues/609 is fixed. 2012-06-09 01:18:33 -05:00
Guangcong Luo
7009b3a4bb Revert bmelts's hasty porting of Id etc to Sugar.js extensions
- The reverted utility functions, toId/toUserid/sanitize/clampIntRange, were designed to handle unsanitized data gracefully
2012-06-08 15:44:49 -07:00
Guangcong Luo
37c8fca226 Even fewer globals:- getRoom -> Rooms.get, newRoom -> Rooms.create
- getUser -> Users.get
- getTime has been entirely removed; new Date().getTime() isn't that long
2012-06-08 14:51:40 -07:00
Guangcong Luo
e4f5686dc2 Fewer globals:
- serverid and servertoken are now only available as config.serverid and config.servertoken
- lobby is now only available as rooms.lobby
2012-06-08 14:38:13 -07:00
Guangcong Luo
ce506d3b3e Rooms cleanup:
- Renamed: Room -> BattleRoom, Lobby -> LobbyRoom
- rooms.js is now its own file; app.js is now no longer huge
2012-06-08 14:32:48 -07:00
Guangcong Luo
e73c587e7d Move a bunch of files into data/
also take this opportunity to rename movedex.js -> moves.js
2012-06-08 14:25:45 -07:00
Bill Meltsner
caaef761cf Restore individual case-checking for user IDs in the 'challenge' message. 2012-06-03 15:27:46 -05:00
Bill Meltsner
c63593fdd7 Stylistic cleanup. 2012-06-03 13:47:35 -05:00
Bill Meltsner
a38f78d53b Take more caution with what we accept from the client. 2012-06-03 13:46:31 -05:00
Bill Meltsner
7499f3f81c Limit the size of the server-side chatlog.
We're now only keeping the last 100ish messages (100 plus any that arrived between updates). There's really no good reason to keep the entire thing in memory. This should also hopefully mitigate some of the lag issues.
2012-06-02 15:49:33 -05:00
Guangcong Luo
048d06239e Chat throttling implemented
Happens mostly in users.js. Now, chatting is proxied through users.js, which handles throttling.
I tried to write my code to avoid race conditions, but I'm not entirely sure if I succeeded.
2012-05-31 02:42:52 -07:00
Bill Meltsner
4f729aae7f Refactor most utility functions (toId, clampIntRange, etc.) into Sugar extensions of the relevant objects. 2012-05-24 01:41:01 -05:00
Guangcong Luo
41b670ad37 Add a new dependency: sugar
also clean up our includes a bit
2012-05-16 21:56:29 -07:00
Guangcong Luo
e9474d9745 Add some basic help information when starting the server 2012-05-16 21:56:28 -07:00
Guangcong Luo
588a6d5b48 Create a default config.js if it doesn't exist 2012-05-16 20:26:49 -04:00
Bill Meltsner
91541f50d4 Remove tiers.js completely.
Rest in peace.
2012-05-15 17:32:54 -04:00
Guangcong Luo
fedc12d35f Consolidate formats data in formats-data.js 2012-05-15 16:07:35 -04:00
Guangcong Luo
015fb9a6fa Prevent crash from invalid rooms 2012-05-12 18:12:07 -04:00