forked from kgilbert-cmu/basketball-gm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTODO
503 lines (460 loc) · 26 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
CURRENT
-------
there shouldn't be so many players asking for slightly more than a minimum contract. just make it all min.
somehow, don't let the user's team sign any/all free agents they want
randomize "won't negotiate with you" more?
make genBaseMoods lower?
DB CHANGES SINCE 3.1.0
----------------------
EVENTUALLY
----------
GM getting fired too early?
harsher, more realistic luxury tax
midlevel exception
show attendance in box score
playerNameLabels should also put a little hover box over the player link with key stats/ratings
more refined control of playing time: http://www.reddit.com/r/nba/comments/1j1e6q/i_made_a_singleplayer_basketball_management/cbaegpq
reassess buy outs. should they even be possible? probably not
signing draft picks should be optional
maybe sign them in the "resign players" phase
you should be able to drop below 5 players (and above 15) but only temporarily (no game simulation in that time)
fake feet/inches heights should be taller
sometimes a lot of the numbers switch to NaN, essentially breaking the game. is there some unbounded random number somewhere propagating through?
allow GM to switch teams after being fired
some players want to resign for infinite money?
draft
there should be some indication about the quality of upcoming drafts, which would influence how players/AI value draft picks
somehow allow uploading of custom draft classes
more visibly promote subreddit
in player.develop, high coaching rank means old players age faster?
auto sort roster based on value
"rookie contracts" when a new game is started should be bounded at 5 million. so do bound at 20 million before dividing by 4.
sourcemaps putting blank line in front of each file?
trades between AI teams
each day, pick two random teams. if a trade can be found that both teams like, do it
generalize core.trade.makeItWork and other parts of core.trade
transaction log is necessary to keep tabs on this stuff
also propose trades to the user, somehow
user can't just sign all the free agents before AI teams
"coaches" should factor in synergy in gameSim substitutions
also, base it on value, not ovr
IE10 support
dropdowns disappear on refresh?
unit tests fail too, seemingly for the same reason
text in dashboard is messed up
core.team.valueChange should be used to pick which free agents to sign in core.freeAgents.autoSign, but that would be a bitch beacuse of how transactions are set up
also for resigning players in core.season
revamp core.team.valueChange
simpler formulas for rebuilding/contending team values
trades
too easy to trade for yougn stars: http://www.reddit.com/r/nba/comments/1j1e6q/i_made_a_singleplayer_basketball_management/cbaayir
draft pick value needs to be reassessed: http://www.reddit.com/r/BasketballGM/comments/1j2mag/ive_gotten_pretty_good/cbajbz6?context=3 http://www.reddit.com/r/nba/comments/1j1e6q/i_made_a_singleplayer_basketball_management/cbb3l2q
fancy scrolling of summary box, or some better UI
refactor core.trade. it's an utter mess.
cash
otherCash and userCash containing the amount
estimate value of cash - different for different teams? depending on cash, net profit recently, and market size
upper limit? what is NBA rule?
ask button
should there be another one to see what the team will give up for a player? like in civ4, and then only have one active at a time?
be more careful about UI, such as when to make button visible - make it like civ4?
more feedback from AI
if trade is close/far from working, return different messages
display some indication of what a team wants to do on the trade view, e.g.
"I need to cut my payroll and start making more money."
"I could really use a good rebounder."
show championships in awards on player pages
all star game
some players foul way too much
team and league records (highest scoring game, etc)
switch teams after you're fired
trades
allow trades to go over the roster limit, but show a warning. also factor into AI logic that they would have to drop a player
warning should be in a different color than the error-like warnings
after trade, AI drops player immediately
don't allow game simulation if player's team is over limit - currently this is only checked at the beginning of the season, right?
sign and trade (only during resigning phase)
profits too large, too easy
add corporate tax?
luxury tax increases for repeat offenders?
awards assigned based on wins added, like hof
at a minimum, make sure to take minutes played into account
when viewing a url like /l/1/roster, playing until new season shouldn't move it to roster for previous year
this happens because inputs.season gets set even though it's not present in the URL. elegant solution?
only show retired players in season summary if they actually played some
Look at ratings distributions - should there really be so many bigs who are great passers, for instance?
components.dropdown tests are very slow in chrome
export/import roster
some way to specify startingSeason
download link performance
http://mjtemplate.org/examples/rison.html
something besides a data URI?
no base64? Firefox can't handle #
error handling if blank or invalid file is supplied
easily edit in excel?
http://blog.stevensanderson.com/2013/05/20/knockout-es5-a-plugin-to-simplify-your-syntax/
move most db functions into core.whatever. db should just be about initializing/upgrading
get rid of "db" module dependence
core.freeAgents should be core.freeAgent or core.freeAgency?
after last resigning negotiation, switch to next phase?
draft lottery
do a dramatic presentation?
increase hype for teams that exceed expectations
tied records?
how to handle aggregating stats for players who played for more than one team in a season? add them all up in ps in db.getPlayers
for roster, want just a player's stats with this team this season
this currently works, just pass a tid
for player stats view, want total among all teams for one season
no pass tid and you only get the latest row. need added logic to do sum
for player view, want separate and combined rows in careerStats without fucking up totals (including PER)
no pass tid and you get each team separately, but no merged stats as above
better default league name
contracts
maybe also try making contract demands depend on PER, if it is available
maybe make them nonlinear.. role players lower, stars higher
compare to NBA contract distribution
luxury tax should be disbursed amongst non-taxpaying teams
give bbgm website its own version of bootstrap (only with components needed)
team.rosterAutoSort should automatically set dbChanged, and have an option to not if that's important
test trades more
multi-player valuation
rank players by value. each additional value gets some multiplier to diminish its influence. this prevents adding a player to a trade from decreasing its value
but this should have something to do with the difference between numbers of players on each side?
analytics
should have no more referrals from basketball-gm.com since it's all set to the same domain now
https://github.com/segmentio/analytics.js/
analytics.pageview in lib/davis.google_analytics.js
analytics.track to get rid of bbgmPing
how to initialize GA with correct options?
notifications (and log) from top right to display log of key events
game results from user's team
players retiring from user's team
league champions
trades
free agent signings
how to deal with a team that drops below 5 active players, factoring in injuries?
should minimum roster size be higher?
should allow them to exceed roster limit while injury exists
should not allow play when below 5
should use same logic/functions as core.season that checks on new season.
first, add support for auto-add players when AI teams are below limit (in season.js)
if fouling out drops team below 5, play fouled out players but add a FT each foul (technical)
check effects of extreme ticket prices
show old contracts on old roster view
force roster reorder handles to stay big even if window is small
reassess ui module. delete stuff like ui.dropdown. move other functions elsewhere?
what is the difference between util.viewHelpers, views.components, and ui?
can i get rid of js/api.js?
core.trade refactoring
validateSavedTids crap should be in trade.js.
trade.summary stuff should be automatic and stored in tradeStore
trade and clear buttons should be disabled during gameSim, wiht message like in team finances
too easy to do the "be bad, get draft picks, keep payroll low, sign free agents, be good" pattern
free agents are even less willing to sign with the user, even if it's a good team
final score, hall of fame
influenced by size of city (see: difficulty in views.newLeague)
any raw data files should go in the data folder, ideally with a script to convert them to however they're used here
database changes
add activeYears multientry like statsTids use for:
league leaders
stats
ratings
gameSim
3 point percentage is too high
more penalty for really unbalanced rosters: http://www.reddit.com/r/nba/comments/1j1e6q/i_made_a_singleplayer_basketball_management/cba743c?context=3
rename compositeRating to compositeRatings (or something better)
other plural issues in gameSim
playing time not adding up to 240?
do some kind of profiling, see if i can speed it up
any way to speed up PER? maybe break it up into smaller functions so they can be profiled
do i need all the player composite ratings?
do i need all the team composite ratings?
how does performance change/degrade as the years go on?
internationalization
league dashboard rankings should say 1st, 2nd, 3rd rather than 1th, 2th, 3th
http://requirejs.org/docs/api.html#i18n
in lock functions, update g from database before using any potentially sensitive values
or should these g.whatever variables be set at all if they're sensitive? lid doesn't change obviously, but the others?
move to new window button, like gmail, that will open a view in a new window with a minimal UI
only the icon should be clickable, not the area above and below
AI modules that contain functions which are called to determine actions
mode: rebuild or contend
things to regulate...
draft picks
signing free agents
resigning players
trades
budget items (like from team finances view)
releasing/buying out players when over limit
show an option to upload a data file for rosters
nba roster
define file format for external player sources
derive from stats, somehow?
nba player potential ratings
if necessary, scale everything down a bit to make it comparable to normal players
free agents are way overrated. is this roster file legit?
player finder
search by stats or ratings
trade for button, or sign button if free agent
customize which columns are shown in roster view (and possibly other summary views like trade, free agent, etc)
http://datatables.net/extras/colvis/
PER
slow, particularly after multiple seasons?
can i have it share a transaction with writing stats in core.game?
how to deal with players traded mid-season?
reevaluate this in general. stats don't seem to be showing after a trade in roster view and player view.
some UI showing the state of the team's synergy. maybe like an advisors screen that suggests what kind of player is needed to improve synergy
also can respond to budget changes
more handlebars helpers for things like...
team dropdown
season dropdown
go through future list - anything that should be here?
DataTables - fix default sort order on column click
text should be asc, numeric should be desc (except draft picks)
http://datatables.net/ref#asSorting will work. maybe pass it as an option to bbgm_datatable
but can it be set globally, based on column type? can have ui.datatable automatically read columns and figure it out?
more tests
https://github.com/gotwarlost/istanbul
https://github.com/metagriffin/indexeddb-js can i improve this and run tests outside of browser?
like on team finances page, anywhere else to add help popups?
should this be abstracted rather than just inline in views?
inline anything from the manual?
tweak gameSim for stats again
freeAgentMoods should affect AI team signings - or should it?
for resigning players
for signing free agents
bar graphs
gradients like http://twitter.github.com/bootstrap/components.html#progress
AI updating of *Budgets and ticket prices
maybe not necessary at this stage?
call core.finances.updateBudgetRanks() after
team finances template: handlebars helper for form DRY?
update formulas
nationalTvRevenue
same for each team, change contract year by year and display in team finances
localTvRevenue
eventually, t.seasons[0].tvContract
roster reordering
make only handles draggable, not whole row
playoff seeding rules
division winner should get at least 4th seed in playoffs, but still do homecourt by best record in a matchup
FUTURE
------
IE10 support
davisjs for knockoutjs links in IE10
elem.host comes up blank in originChecks
hacky solution used now (see js/lib/README.md) but maybe this will lead to a real answer: http://stackoverflow.com/q/17641380/786644
hire/fire different coaches with different strategies
jslint errors
currently just "Don't make functions within a loop." which should all be fixed eventually
Web workers
don't seem to actually help performance. maybe help responsiveness
benchmark?
would it be worth it to parallelize advstats?
boxplots for shot location stats, plus comparison to NBA data
import/export stuff
online "locker" that you can sync saved games to
https://unhosted.org/adventures/7/Adding-remote-storage-to-unhosted-web-apps.html
data urls don't work with more than ~1 MB. downloadifydoesn't seem to work with more than several MBs of data. until a better solution comes (online sync?), wait.
league names
"Edit" button between "Export" and "Delete" - set in leaguesStore and gameAttributes
move delete/edit/export under one button, "manage". have the 3 buttons pop out in place when you hit manage, then it functions as it does now. popped buttons can be colored too, then
import league
ignore old lid
other advanced stats
WS - http://www.basketball-reference.com/about/ws.html requires Basketball on Paper - http://www.sports-reference.com/cbb/about/ws.html is simpler
+/- and other stats needed to calculate above - track in game
APM?
hitting the phase twice shouldn't be possible. but if i, for instance, hit "until preseason" twice quickly, i skip a year
maybe have something like lock.phaseChangeInProgress? but some timeout would be needed to reset
worth it to switch to closure library? http://stackoverflow.com/questions/10782612/what-is-the-sturdiest-way-to-get-the-closure-compilers-type-safety-together-wit
roster size check on new season
cpu teams with < 5 players should automatically sign free agents
moving to other cities
expansion teams (add population growth, expand when certain conditions are met)
team finances view
compare bar graphs against league averages?
different size stadiums, building new stadiums
tv revenue as a variable
local tv contract - $10 million
base on tvContractAmount, tvContractExp
will be a deal from 3 to 5 years in length
based on...
region population
"hype"
random noise
"random event" - competition between two networks, Sports TV and The Basketball Channel
when renegotiating and really bad, the guy pretends not to know you - "Atlanta Herons? Is that the team from the Mexican/Canadian/Arena/Indoor/Xtreme Volleyball/Soccer/Tennis/Racing/Curling/MudWrestling League?"
stat views
add team dropdown to ratings and stats views - but should this refresh the view, or just filter the DataTable?
could use something like http://www.datatables.net/extras/thirdparty/ColumnFilterWidgets/DataTables/extras/ColumnFilterWidgets/ to also filter on positions
playoff/regular season toggle in team/player stats, league leaders
player stats: toggle to only show players > 2000 minutes http://www.nba.com/leader_requirements.html
per 36 stats in team/player stats view, league leaders
add a dropdown (maybe make the dropdown handling code more general?)
bootstrap 2.3
https://github.com/nprapps/app-template
trading block
race conditions associated with callbacks when passing around transactions
any put/add/update does not guarantee it's finished until the transaction finishes. but letting transactions finish is slow.
contract negotiation
don't have counter-offers be too drastic
weirdness http://www.reddit.com/r/nba/comments/1j1e6q/i_made_a_singleplayer_basketball_management/cbabaq1 http://www.reddit.com/r/BasketballGM/comments/1j3it8/free_agency_bug/
add free agent to the end of roster
eliminate jquery UI dependency? it's only used for roster reordering currently
real calendar
player.injury.gamesRemaining
core.gameSim.updateSynergy should produce continuous output
no big difference between a 80 rating and 79 rating, or whatever
input to helpers.formatCurrency (and all currency in variables everywhere) should be in 1000s of dollars and then only converted to millions when displayed
AI teams should have to deal with fuzz too
if play menu is open when it refreshes, automatically open it again after refresh
not so easy.. tried it in 34927959b2b0acd08224665654343d97ffaea281 but there were issues with updatePlayMenu being called multiple times, for instance at the end of the season
"dbChanged" updateEvent - more correct way
store a list of times and "update events". compare last updated time against that list, and then see the update events. pass as list in "update event" to realtime update
check everywhere dbChange or lastDbChange is set and see if it should be more refined
add playerMovement updateEvent, for when a player signs a contract, becomes a free agent, or is traded
bbgmView
can i do some check to abandon display if idLoading is mismatched with reality? like for clicking a slow link followed by a fast link, in rapid succession, the fast output should show and the slow should be short circuited.
in practice, this doesn't seem to matter much
shouldn't have newPhase updateEvent doing much. instead, have an array of what changed in that phase
(updateEvents.indexOf("newPhase") >= 0 && g.phase === g.PHASE.PRESEASON) should be newSeason
use req.redirect from POST to manage history optimally
make it less tied to BBGM specifically. shouldn't depend on BBGM-specific modules like g, ui, and util/viewHelpers
player development should depend on playing time
http://code.google.com/p/htmlcompressor/ or something similar
core.player.ovr shouldn't just average ratings together. some ratings are more important than others. do regression analysis against PER to prove this and find a better formula.
player.filter
the special case attributes should generally be moved directly into the database?
views.teamFinances should merge db call with team.filter to get seasonAttrs, but that will require rewriting seasonAttrs handling in team.filter to handle multiple seasons.
Template Stuff
--------------
Below are relatively boring/minor improvements that would make the templating slightly better/faster/clearer/whatever.
gameLog
boxScore should be observable, but nothing inside should be except gid
dashboard
observables set right by mapping
historical things (old scores, old records) don't need to be observable?
arrays need correct keys
team finances
smarter updating of player salaries table: contracts should only update on playerMovement
feasible to use knockout for updating datatable? or kogrid?
trade - not fully knockoutifieid
mapping to update summary.teams.trade, userRoster, otherRoster
can i do a redirect from post without refreshing everything?
just call ui.realtimeUpdate which should allow for smart handling
if trade is accepted/cleared, playerMovement will instigate a refresh of rosters
if trade is proposed, message will somehow explicity be sent (set in VM? but what if VM not initialized?)
when to delete stored message?
at beginning of new propose
on clear
when team changes
changing the trading partner shouldn't refresh the user's team
negotiation
some things can probably be non-observable
draftSummary
don't show this season as option if before draft - have an option in components.dropdown
playerNameLabels always updates even if none of the inputs did - why
if ratings.skills is generated by the mapping plugin, it's an observable array and this fucks things up. it would be a bitch to fix, though.
quick fix - return a string for templates rather than array.
leaders
flatten a bit
roster
check release, buy out, trade for
flatten a bit
vars.ptModifiers does not need to be observable
dataTables/grid knockout
examples
https://github.com/CogShift/Knockout.Extensions
https://github.com/CogShift/Knockout.Extensions/issues/9
https://github.com/Knockout-Contrib/KoGrid
http://chadmullins.com/javascript/knockout-js-series-part-2-binding-knockout-js-to-a-datatables-grid/
inbox
on new message (can be a newMessage update event), just add to messages list rather than always refreshing
player_
face display with forward/back button?
some things become observables - why???
mapping function not run right the second time - try to create jsfiddle
arrays are becoming observableArrays
schedule, teamHistory
partial load of list for updates, like in gameLog list
freeagents
optimize refreshes
dist
allow updating box plots without refresh
gameLog
set more stuff through mapping
reassess dropdown - should it really be called like it is in uiEvery? can i use a computed? problem is, some things need to listen to updateEvents too, not just observables
---
g = require("globals"); g.dbl.transaction("draftPicks").objectStore("draftPicks").index("season").getAll(g.season).onsuccess = function (event) { console.log(event.target.result); };
g = require("globals"); player = require("core/player"); g.dbl.transaction("players").objectStore("players").get(184).onsuccess = function (event) { console.log(player.genContract(event.target.result)); };
g = require("globals"); g.dbl.transaction("players").objectStore("players").get(184).onsuccess = function (event) { console.log(event.target.result); };
g = require("globals"); player = require("core/player"); g.dbl.transaction("players").objectStore("players").get(170).onsuccess = function (event) { console.log(player.madeHof(event.target.result)); };
g = require("globals"); player = require("core/player"); g.dbl.transaction("players").objectStore("players").get(172).onsuccess = function (event) { console.log(player.madeHof(event.target.result)); };
g = require("globals"); g.dbl.transaction("players").objectStore("players").openCursor(null, "prev").onsuccess = function(event) { console.log(event.target.result.value); };
g = require("globals"); g.dbl.transaction("teams").objectStore("teams").get(3).onsuccess = function (event) { console.log(event.target.result.seasons[0]); }
g = require("globals"); g.dbl.transaction("releasedPlayers").objectStore("releasedPlayers").getAll().onsuccess = function (event) { console.log(event.target.result); }
g.dbl.transaction("gameAttributes").objectStore("gameAttributes").getAll().onsuccess = function (event) { console.dir(event.target.result); };
g = require("globals"); g.dbl.transaction("messages").objectStore("messages").getAll().onsuccess = function (event) { console.dir(event.target.result); };
// Switch teams
var g = require('globals'); g.dbl.transaction("gameAttributes", "readwrite").objectStore("gameAttributes").openCursor("userTid").onsuccess = function (event) { var c = event.target.result; console.log(c.value); c.value.value = 26; console.log(c.value); c.update(c.value); };
---
git fetch origin pull/8/head:pr-8
---
# Pre-JavaScript TODO
player view
next, previous buttons (also active on left/right arrows)
roster
highlight handle on hover, like button
"trade for" only sensitive when trades are allowed
Client-side game simulation
Robustness of javascript code
g.phase == 3 in league_views might introduce race condition
validate data from client?
make sure play menu doesn't ever get stuck - some kind of timeout
play button requirements
colors - is this a good idea?
green: move to new phase
blue: play games
red: other immediate action
make validate_season work correctly
include sidebar(s) showing all relevant information, plus make that stuff generated by a separate function so it can eventually be kept static as JS updates other content
grep for # links: grep -R --include="*.html" '<a href="#">' .
security
csrf protection
http://flask.pocoo.org/docs/security/#cross-site-request-forgery-csrf
http://packages.python.org/Flask-SeaSurf/
http://flask.pocoo.org/snippets/3/
even for ajax https://docs.djangoproject.com/en/1.2/releases/1.2.5/#csrf-exception-for-ajax-requests
# Then
self-contained game simulation code, to allow other people to hack on it easily. automatically make charts and stuff.
warning when window is closed and game simulation is in progress
http://stackoverflow.com/questions/1244535/alert-when-browser-window-closed-accidentally
https://developer.mozilla.org/en/DOM/window.onbeforeunload
# BELOW IS OLD STUFF
Minor bugs:
Don't allow sort from first column of trade window
UI
--
in team stats tab, allow toggle to show opponent stats
NBA
---
real salary cap rules: http://en.wikipedia.org/wiki/NBA_Salary_Cap
real contract rules (max/min, etc.)
allow contracts that aren't the same $ every year
team and player options
releasing players - see the salary cap wiki page for complicated rule
trading deadline
AI (NON-GAMESIM)
----------------
trade
AI teams trade with each other
opponent GM trade AI based on their team's status: contending or rebuilding
record player value for contending and rebuilding teams in player_attributes, so opposing GMs can more easily suggest trades (i.e. "i'll make the deal if you throw in X")
Feedback from trades (way off, that's close, etc)
"Oh, you again?" after failed trade attempts
AI teams should be aware of contract lengths and the implications thereof
AI teams release/buy out players to sign a better free agent
FEATURES
--------
multi-team trades... how can i make a good UI for that?