Commit Graph

223 Commits

Author SHA1 Message Date
Ivo Julca
a0d2a59875 Fix replays being uploaded under an alt after player rename 2015-07-07 03:18:08 -05:00
Guangcong Luo
e0efc92d12 Slightly more console output 2015-05-12 02:33:07 -04:00
Ivo Julca
4222ffb5df Dependant support: make sure that relative paths are resolved properly 2015-05-11 15:38:18 -05:00
Morfent
ce1724e179 Replace all s.substr(x, 1) with s.charAt(x) 2015-04-06 21:20:43 -03:00
Ivo Julca
e276f56d60 Battle#resendRequest's argument is now a connection, rather than user
- The higher specificity saves bandwidth and suppresses a client crash when another user connection joins the battle.
2014-12-25 18:18:21 -05:00
Ivo Julca
688bd5f9e4 Add missing sideupdate message type to simulator 2014-12-10 14:00:53 -05:00
小太
5027be79fb Add jscs as a style checker, and add some extra jshint options 2014-09-29 18:38:01 +10:00
Guangcong Luo
265eced415 Stop users from joining battles they're already in 2014-09-16 22:14:04 -04:00
Guangcong Luo
9bd804838f Implement subchannels
This pushes most of the work of dealing with `|split` from the
main (room) process to the socket process.
2014-08-25 23:48:33 -04:00
Ivo Julca
b3b435c1fd Battle.active now defaults to false.
This fixes the issue of players being unable to join any battles they start.
2014-08-25 00:01:00 -05:00
Guangcong Luo
af2026436a More style fixes and Gulpfile updates
JSHint is now a fair bit stricter, and is now correctly checking
files in `mods/`.

The code has been fixed to match the new stricter standards.

JSHint has now caught its second actual bug: Gen 5 Pinap Berry
was Ice instead of Grass.
2014-08-10 20:43:53 -04:00
Guangcong Luo
12b673bb49 Fix style errors; update gulpfile
I used a hack to make the multiple declaration errors go away,
so all that remained in jsHint were actual errors, which I've
now mostly fixed.

All this linting ended up uncovering one actual bug: Uproar's
message not showing. It's a very minor bug in a move no one uses,
so I'm going to fold it into this commit.
2014-08-10 18:06:44 -04:00
小太
5c8fc7b982 Space after function for anonymous functions 2014-04-22 01:58:16 +10:00
小太
6fb3bc332a Spaces around operators and === instead of == 2014-04-22 01:56:11 +10:00
Slayer95
05e7060474 Deprecate 'toUserid' global
Replaced by 'toId'.
2014-04-18 16:49:16 -05:00
Slayer95
75559362b4 Rename global config to Config 2014-04-17 01:12:28 -04:00
Guangcong Luo
692f47fc0a Support dynamically spawning simulator processes 2014-04-17 00:16:15 -04:00
小太
4f6a3e9c36 Merge remote-tracking branch 'upstream/master' into tournaments-frontend
Conflicts:
	package.json
2014-03-10 12:15:35 +11:00
Tyler Stark
bff353cc58 Second Pass at cleaning up the code. These are pretty safe edits that include adding 0 to decimal values, fixing variables that are declared multiple times, and removing duplicate keys 2014-02-09 23:38:57 -06:00
Tyler Stark
afb3dc0c09 First pass at code quality: adding semicolons. 2014-02-09 20:35:42 -06:00
小太
f9101abbe7 Merge remote-tracking branch 'upstream/master' into tournaments-frontend
Conflicts:
	package.json
2014-02-03 00:24:23 +11:00
Guangcong Luo
1b0b3ec63b Optimize team validator
The main process no longer does any JSON parsing/stringifying of
teams. The communication protocol with validator processes has
been changed from JSON to a string protocol delimited by pipes.

A variety of more minor optimizations have also been done.
2014-01-23 21:35:26 -08:00
小太
250aeb3260 Merge branch 'tournaments' into tournaments-frontend
Conflicts:
	app.js
2013-09-16 16:05:45 +10:00
Guangcong Luo
ae62e9e737 Update ResourceMonitor to control bandwidth 2013-09-01 02:37:35 -07:00
小太
f2f973fe29 Obliterate trailing whitespace 2013-08-18 21:33:15 +10:00
小太
24279166b3 Core file edits to support frontend 2013-08-07 23:22:07 +10:00
Guangcong Luo
15297f2c0f Less logging 2013-07-12 22:32:10 -07:00
Guangcong Luo
238a709f3b Rename battles.js to battle-engine.js 2013-05-24 20:50:30 -07:00
Guangcong Luo
27be062395 Tons of documentation 2013-05-24 14:59:29 -07:00
Guangcong Luo
9f79b1423e Switch to new protocol 2013-05-22 20:43:13 -07:00
Guangcong Luo
355f906e3f Fix timer issue 2013-05-01 03:05:00 -07:00
Cathy J. Fitzpatrick
3b6d0792f9 Fix rejoining battles 2013-04-21 18:42:28 -06:00
Cathy J. Fitzpatrick
a0dc8bb12a Fix /potd 2013-04-14 17:48:38 -06:00
Cathy J. Fitzpatrick
7b98429a75 Implement /hotpatch battles 2013-04-14 17:46:39 -06:00
Cathy J. Fitzpatrick
31fac973e0 Correct trapping mechanics
This doesn't yet handle modded formats that don't validate ability
selection in the ordinary manner. Those formats will continue to work
essentially in the same manner as before, rather than with the correct
mechanics.
2013-04-10 21:19:35 -06:00
Cathy J. Fitzpatrick
6259cd8ed0 Implement multiple simulator processes 2013-02-22 23:14:00 -07:00
Cathy J. Fitzpatrick
6e54bccb16 Commit missing file for last commit
I accidentally forgot to commit the other file for Zarel/Pokemon-Showdown@9b3e433bc7
2013-01-26 13:01:58 -07:00
Cathy J. Fitzpatrick
923498e7ba Reinstate stopgap for now
On further analysis, I'm not sure what the bug is here so I will
leave in the stopgap until is more thoroughly analysed.
2013-01-26 12:36:51 -07:00
Cathy J. Fitzpatrick
5b74e24a90 Fix bug causing crashes
Previously, Simulator.prototype.resendRequest() called user.sendTo()
with an invalid room specified, causing the server to send the
message to all rooms, leading to problems on the live server.
2013-01-26 12:26:30 -07:00
Guangcong Luo
1d9b1a5852 Stopgap fix for server crash 2013-01-26 10:44:33 -08:00
Cathy J. Fitzpatrick
f09d287070 Require client to acknowledge requests
In certain laggy situations, the following sequence of events
was previously possible in a battle:

1) Server makes request R_1 and R_2.
2) User 1 selects decision D_1 for request R_1
3) User 2 selects decision D_2 for request R_2
4) Server receives D_1 and D_2 and runs the turn
5) Server makes request R_3 and R_4.
4) Due to lag, User 1 does not realise that the server has
   already run the turn. User 1 wants to change his or her move
   for request R_1, so User 1 cancels decision D_1 and sends in
   decision D_3, intending it to be for request R_1.
5) User 2 selects decision D_4 for R_4.
6) Server receives D_3 and considers it to be the response to R_3,
   rather than the response to R_1 (which was what User 1 intended).
7) Server receives D_4 and considers it to be the response to R_4.
8) Server runs the turn.

The result of this sequence of events is that a move that User 1
intended to be for request R_1 is instead used for R_3, which has
the effect of depriving the user of the ability to make a reasoned
choice of which move to use for R_3.

This commit attempts to solve this problem by requiring the client
to acknowledge having received a request before the server will
accept a decision for that request.

Unfortunately, there is no seamless way to implement this in a
backward-compatible way. In other words, if the client were updated
to always send acks, it would no longer be able to work with old
versions of the server. For example, if the ack were added to the
choice string, old servers would no longer be able to handle choice
strings sent from the client. Similarly, if the ack were added
in the form of a new command (say, /ackrequest), old servers would
emit an unrecognised command error on receiving the command.

This commit maintains backward-compatibility by introducing a version
field to the init data structure sent to the client when joining a
battle room. This version should be incremented for any future
backward-incompatible changes as well.

The implementation of the ack request system is that the client must
send in "/ackrequest rqid" for each request, where rqid is the ID of
the request. If the server has not received an ack for request 'rqid'
when it receives a decision for request 'rqid', it discards the
decision and asks the client for another decision.

The corresponding client commit is Zarel/Pokemon-Showdown-Client@ccf0a97733
2013-01-25 01:19:03 -07:00
Guangcong Luo
68c989907a /potd is supported again
I've introduced a new function: Simulator.eval, which allows chat
commands to evaluate raw JavaScript in the simulator process.
2013-01-24 15:03:04 -08:00
Guangcong Luo
42abd07ef0 Fix where the timer messages appear
(timer messages should be much less confusing now)
2013-01-10 02:02:02 -08:00
Guangcong Luo
d4ab09b9f7 Fix some bugs with the reset timer 2013-01-10 00:50:20 -08:00
Guangcong Luo
13aafe2909 New battle timer 2013-01-09 00:31:07 -08:00
Guangcong Luo
248446d1c2 Making an invalid choice no longer restarts the kick timer
(it could previously be abused to postpone a turn indefinitely)
2012-11-19 14:44:59 -08:00
Guangcong Luo
cf8e19789b Make sure users can always continue playing after rejoining 2012-11-06 22:31:32 -08:00
Guangcong Luo
3187dee583 Fix /forcetie 2012-09-15 21:43:03 -07:00
Guangcong Luo
66b86f9678 Don't mark rooms as active if they're not 2012-08-01 23:23:18 -07:00
Guangcong Luo
60ca007255 Many stability improvements 2012-08-01 23:08:55 -07:00