Giter Club home page Giter Club logo

koth-webplayer's Introduction

koth-webplayer

This is a framework for Javascript-based King-of-the-Hill competitions.

See it in Action

And see the current unit test / linter status on master here.

Making Games

Check the create-a-game guide for details on how to create your own games using this framework.

Aims

This project has some rough aims:

  • Easy fetching of entries from Stack Exchange answers (done!)
  • Sandboxed and super-fast game simulation via the power of sandboxed iframes and Web Workers (done!)
  • Re-runnable games via a random seed system (done!)
  • Out-of-the-box management of entries, and UI for testing/debugging new entries (mostly done!)
  • Configurable out-of-the-box match and tournament management (mostly done!)
  • Fancy visualisations (see the game as a torus!) (done!)
  • Local storage persistence of display preferences & in-progress entries (not done)

Modifying the Framework

This is early stages, and lots of functionality doesn't exist yet, or is rather quick-and-dirty, so it's likely that new games will need some changes to the engine itself.

Contributions are welcome! Check the contributing guidelines for details.

koth-webplayer's People

Contributors

davidje13 avatar dzaima avatar eaglgenes101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

koth-webplayer's Issues

Cache isn't cleared after player code is updated

After updating the player code from the "edit entries" button, the cache of the players actions doesn't seem to be cleared, resulting in weird results and making live editing often pretty much useless.

Support running in NodeJS

For larger competitions, running on a server can be beneficial. To support this, the game running logic should be made reusable in a NodeJS environment.

Initially only the scores (and possibly game seeds) need be stored / returned, but a later enhancement could be to record game states, allowing later replaying of games in a browser (or even live-streaming of games).

This will also require additional thoughts on security, as the HTML sandbox will not be available, and all submitted code will be able to access the filesystem, etc.

Store chosen entries in permalink hashes

If entries have been deselected, or filtered by a tournament, this is not reflected in the game hash which is provided as a permalink. This means it is not a viable way to replay a particular game exactly. This is also problematic for free-for-all games when new entries are submitted.

This would require storing the teams involved in a game, their ordering, their entries, and their entries' ordering. Ideally without making the hash much longer.

Consistent handling of added entries is less important, since the code cannot be shared in any case, but whatever system is introduced should not break for new entries (within the same browser session, implementing #1 should mean that the code will still be available)

Allow drag+drop to reorder entries & teams

Within the code editor's team/entry list, it should be possible to drag+drop to reorder teams and entries. This should also support moving entries between teams.

This should only be possible from the "homepage" editor; once inside a game, it does not make sense to shuffle the entries or switch teams around.

Zoomed view of the 2D board can hide the spot of interest

A minor thing in the ease-of-use department...:

Scenario: Playing Formic Functions with default settings (2500x1000 arena shown in 2D) in a browser window not quite as wide as the arena is (Safari 11.0.3 on macOS).

When the mouse pointer is in the right half of the arena/board, the zoomed view is displayed flush left with the left edge of the board, and it is less than half as wide as the board: Works fine.

When the mouse pointer is in the left half of the board, the zoomed view is displayed, not flush with the right edge, but closer to the middle of the board. When the point of interest
(and thus the mouse pointer) is itself near the middle of the board in the left-right direction, the zoomed view will pop up so as to cover it, and it pops down again at the slightest mouse jiggle. Moreover, it seems not to be possible to pin the zoomed view to such a point of interest, I guess because the click requesting to do so ends up in the zoomed view instead of in the board which is momentarily hidden under it.

TreeTable should perform optimised rendering

Currently TreeTable rerenders its entire content when changed. This should be changed to perform deltas to improve performance. It may be possible to share code with the HierarchyTable (#8)

Full3DBoard appears to be using mip-mapping

The full 3D board occasionally shows seams at the edge of the texture, and refuses to support non-power-of-two textures. This implies it has mipmapping enabled somehow. This should be disabled, as mipmapping is not required and non-power-of-two textures would be useful for storing the game board.

HierarchyTable should perform optimised rerendering

Currently HierarchyTable rerenders its entire content when changed. This should be changed to perform deltas to improve performance:

  • each result has an associated row
    • rows need to account for rowspans; maybe group at outermost level
  • create any missing row entities and delete extras
    • maybe use 'key' concept from react to reduce rerendering due to reordering
  • ensure rows are in correct order in table
    • note that rowspan'd cells will need to be kept on the top-most row of the block
  • ensure data in rows is up to date

Tournament individual game links inacurate.

This tournament for Formic Functions had Game 7 show Wildfire in 1st place (with 15 points). Opening the game to watch it, shows this game where it scores 11 points.

I believe this is due to the individual links having the right seed but don't correctly trim the participant list to only the 16 present bots. Even manually modifying the player list and starting a random game and attempting to input the seed doesn't work, as the "go" button and the "random" button do the same thing: generate a new seed. Planting the seed in the URL resets to using the full list of bots.

Tournament results Game 7 results

Issues related to a new challenge

I'm currently looking at implementing my upcoming challege in this framework: https://codegolf.meta.stackexchange.com/a/16415/43363

First, I'd like to have a way of configuring tournaments to run forever, and an easier means of programmatically extracting scores from each game within a headless context (like, say, in a cloud VM).

Second, the author of one of the forks told me that part of the framework security mechanisms had to be dismantled for the contest (more specifically, eval()) to run correctly, though the details about why specifically were rather light. I'm not interested in doing something similar, so perhaps try to upstream his less destructive changes and figure out why?

Add support for indefinite tournaments

I'm seeking to create a challenge based on this framework. This issue was mentioned in #19 already. In the Formic Functions implementation the need for a dynamic amount of games played per tournament was ignored, and the tournament length simply limited to 50. The planned challenge of mine will most likely use a similar, dynamic tournament termination condition. I can't let the reference implementation not stick to the specification, so I need this functionality. Ideally, the new tournament type would be similar to the "brawl" and would visually look like this:

  • One sorted leaderboard that updates upon any game completion and contains data about each entry:
    • Rank
    • Name
    • Current average score (not counting ongoing games)
    • Games played
    • Configurable additional columns for desired secondary data
  • Ever-expanding list of all games (clickable links) played to date

Optionally:

  • Parallelism slider
  • Checkbox for whether or not tournaments should be automatically terminated upon hitting the condition
  • Button for manual tournament termination
  • Resume button

And internally:

  • A configurable function that takes all finished game results as input and outputs whether or not the tournament has finished already
    • When it returns true, terminate all running games and dump the leaderboard into the console
      • If the (optionally implemented) checkbox for automatic tournament termination is unchecked, dump the leaderboard snapshot into the console and keep all the games running normally

I'm willing to look into this myself once I get the actual game up and running (and if I manage to get anywhere I'll contribute back so Formic Functions can finally be fully properly implemented).

Store display preferences in local storage

When display preferences for a game are changed, they should be saved in the local storage and override the game defaults on subsequent loads. This should not apply to the game configuration.

This must be stored per-game and should include a mechanism to revert to the standard configuration if desired.

Persist entry code in local storage

When editing existing entries, or adding new entries, the code should be stored in local storage to prevent loss if the page is closed.

This should include an option to revert-to-original, and possibly an option to reload entries from the question (since otherwise it may get stuck with old entries)

Add results matrix visualisation for tournaments

In all-vs-all tournaments, a nice visualisation of the results is a matrix (players listed across top & down left, each cell corresponds to the result of the match between those players)

  • Axis of entry vs self should be empty
  • Either keep one half blank, or duplicate data across divide (but inverted); no need to run matches of A vs B and B vs A.
  • Requires drill-down capability into matches

Provide UI for testing entries with given input

Within the code editor it should be possible to manually enter input parameters and see what output (or errors) the code generates.

This will require some thought for games which provide functions in their parameters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.