Git Product home page Git Product logo

battlecode20's Introduction

Battlecode 2020

๐Ÿœ

Repository Structure

  • /backend: Backend API in Django Rest Framework
  • /frontend: Frontend dashboard in React
  • /engine: Game engine in Java
  • /schema: Game serialization schema (basically, an encoding of all units and events in a game)
  • /client: Game client (visualizer and playback) in TypeScript
  • /example-bots: A bunch of example bots for the game!

Development

Website

To get set up, make sure you have Node and Docker installed. For Windows, you will need Docker Toolbox. If you have Windows, I'd also recommend installing Cygwin, since we have some bash scripts that won't work with the standard Windows command prompt. (Docker is not strictly necessary, but it makes stuff easier, especially if you want to work on the backend of the website.)

First, install all required packages: run ./install_frontend.sh in the main folder. (If this fails, run npm install in each of the four folders /schema, /client/playback, /client/visualizer, /frontend.)

Then, you can start the frontend by running npm run start in the /frontend folder. (If this fails on Windows, make sure you are using Cygwin.) After this step, you should be able to view the website at http://localhost:3000.

If you also want to run the backend (which will enable things like signing in to the website, and a rankings table, etc) then run docker-compose -f docker-compose-b.yml up --build in this folder. If you don't have Docker, you can try following the instructions in the /backend folder instead.

You can also run both the backend and the frontend in a Docker container, by running docker-compose up --build, but that might be slower.

Engine

Windows users: Instead of ./gradlew, use gradlew for all commands.

(whenever Gradle has problems with something, run ./gradlew clean and see if it helps)

To run a game, run

./gradlew headless

The replay file will be in /matches. Use headlessX for bots that are in battlecode20-internal-test-bots. You can specify the robot code and map like this: ./gradlew headless -Pmaps=maptestsmall -PteamA=examplefuncsplayer -PteamB=examplefuncsplayer.

Client

(Make sure you have a recent version of npm: sudo npm cache clean -f && sudo npm install -g n && sudo n stable && PATH="$PATH".)

First run npm install in the schema folder, followed by npm run install_all in the client folder. You can then run

npm run watch

which will launch the client on http://localhost:8080 (if available).

Docs

You can generate javadocs as follows:

./gradlew release_docs_zip -Prelease_version=2020.0.0.0.0.1

This will create a zip file. Unzip and open the index.html file in it to view the docs. In particular, looking at the documentation for RobotController will be helpful.

Notes for porting this to battlecode21

When Battlecode 2021 comes around, it will probably useful to reuse a fair amount of this codebase. Mainting git history is nice, but not trivial. The following steps were taken to port battlecode19 to this repo and maintain history (assuming we start in this repo):

cd ..
git clone https://github.com/battlecode/battlecode19
cd battlecode19
git checkout -b battlecode20export
git filter-branch --prune-empty --index-filter 'var=$(git ls-files | grep -v "^api\|^app") && test "$var" && git rm $var --cached'
cd ..
cd battlecode20
git pull ../battlecode19 --allow-unrelated-histories
mv api backend
mv app frontend

This procedure keeps the history nicely.

battlecode20's People

Contributors

aepstein824 avatar arvid220u avatar ashley-lin avatar asugaya avatar battlecode-prod avatar benjaminfspector avatar bovard avatar dgulotta avatar diuven avatar dvorak42 avatar edstiles avatar ingenuir avatar j-mao avatar jbloxham avatar jmerle avatar joshuagruenstein avatar jsegaran avatar kazimuth avatar kelvin-lu avatar n8kim1 avatar nmccoy avatar npfoss avatar npinsker avatar shewu avatar stephanie-fu avatar uldivad9 avatar vontell avatar wflms20110333 avatar ygina avatar zoemarschner avatar

Watchers

 avatar

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.