Skip to content

GunioRobot/dotmuncher

 
 

Repository files navigation

Quickstart: run the server on your laptop

Prereqs:

  • Django 1.2, Redis, redis-py
  • Optional (so far): NodeJS, node_redis, node-tyrant, Socket.IO, node-mongodb-native, angular.js, express

Folders:

  • Create a folder somewhere. By "ROOT", we'll be referring to that folder's full path.
  • Put dotmuncher in ROOT
  • Run python dotmuncher/scripts/get-repos.py, which will git clone these repos to ROOT:

Prep stuff

  • cd ROOT/dev_deployment; mkdir -p tmpdir
  • cd ROOT/dev_deployment; env APP=dotmuncher python manage.py syncdb

Start the servers

  • cd ROOT/dev_deployment; redis-server conf/redis.conf
  • cd ROOT/dev_deployment; env APP=dotmuncher python manage.py runserver

Run the tests

  • env DJANGO_SETTINGS_MODULE=dev_deployment.settings python tests/all.py

API

GET /api/v0/..name....json?json=...input... ---> JSON response
phoneToken: ("i_" + UDID) if iOS, ("a_" + UUID) if Android
phone: an integer assigned by the server

update_phone_settings

{
    phoneToken: 
    name: 
}
{
    phone: phone integer
}

find_games

{
    "lat": string
    "lng": string
    "phoneToken": string
}
{
    "phone": int
    "items": [
        {
            "id": int
        },
        ...
    ]
}

find_maps

{
    "lat": string
    "lng": string
    "phoneToken": string
}
{
    "phone": int
    "items": [
        {
            "id": int
        },
        ...
    ]
}

new_game

{
    "map": int id
    "phone": int
}
{
    "game": int id,
    "gameToken": string
    "mapInfo": {
        "dotPoints": [...],
        "basePoints": [...],
        "powerPelletPoints": [...],
    },
}

join_game

{
    "game": int id
    "phone": int
}
{
    "mapInfo": ...see new_game...
}

update

{
    lat: ""
    lng: ""
    
    hacc: ""
    vacc: ""
    
    game: int
    phone: int
    
    id__gte: int
}
{
    phoneStates: [
        // ordered by the official order in which the phones joined the game
        {
            phone: int,
            // These will be included iff we've received a sample:
            lat: "...lat...",
            lng: "...lng...",
            idle: ms since update,
            alive: boolean,
        },
        ...
    ],
    powerMode: bool,
    events: [
        {...},
        {...},
        ...
    ]
}

Events

{// sent by server when handling {new_game,join_game}
    type: OHHAI_EVENT = 2
    phone: phone integer
    name: string
    
    i: event id,
    t: timestamp (ms since epoch)
}

{
    type: PHONE_EATEN_EVENT = 6
    eater: phone integer
    eatee: phone integer
    
    i: event id,
    t: timestamp (ms since epoch)
}

{
    type: ITEM_EATEN_EVENT = 7
    k: '["p","lat","lng"]' for power pellets, '["d","lat","lng"]' for path dots
    
    i: event id,
    t: timestamp (ms since epoch)
}

{
    type: GAME_OVER = 8
    reason: int
    
    i: event id,
    t: timestamp (ms since epoch)
}
GAMEOVER_PACMAN_WINS = 1
GAMEOVER_PACMAN_LOSES = 2

About

Software to help real people play pac-man on real sidewalks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 44.8%
  • Java 23.3%
  • Objective-C 19.8%
  • JavaScript 10.9%
  • Other 1.2%