Giter Site home page Giter Site logo

hacky-game's Introduction

Hacky Game

This is the start of a game involving some crazy technical jazz, for the sake of magical minimalism.

The game will be a platformer, with lots of interconnected rooms and various enemies, taking some inspiration from Kirby & the Amazing Mirror.

(Some basics are implemented, like blocks, slopes, one-way platforms, and doors. There are several rooms, but they're pretty boring, and the art is very preliminary.)

The game supports LAN multiplayer, and the client's world is simulated in between updates from the server, a basic implementation of client-side prediction.

Single player is treated the same: the client hosts a server and communicates with it locally over TCP. This might change.

When other servers are discovered, a door is opened to another world.

Players can travel between worlds, and you can even have two players in each other's worlds. (But the player's client has to be online for their world to be available.)

You should be able to get a feel for the game in single-player, with a substantial world to explore, but I think multiplayer will be the real focus of the game and I think it would be interesting to have parts of the world that you can only explore with a friend.

Oh, did I mention the worlds are gonna be procedurally generated? That's probably kind of important. It might have some areas that are the same in all worlds, like a tutorial level, or perhaps just fairly similar and functionally identical.

Both players should gain from exploring either players world. It should be like the worlds combined make up the space to explore, and which one to do first shouldn't feel contentious.

There could be doors that require multiple keys, that you need to get from several people. There could be keys that belong to random other worlds and you have to find the one player whose world contains the door. There could be halves of items (including keys).

Keys could be 2D "pin arrays", where locks run a game-of-life simulation for a number of iterations. This would work well for a 1BPP game, as alternative to using color to distinguish keys.

There could be portals that you can pick up and place, including between worlds.

There should be limits on the viewport, maybe fixed but not necessarily; it could have a maximum viewport size, and the ability to look in a direction, and then the total amount you could look could be fixed while allowing for a range of screen sizes on handheld systems etc.

The game runs in nw.js (so it can include both client and server), but the final game.exe is a wrapper. The wrapper currently built with nexe, although this essentially means distributing two Node.js runtimes, which is a considerable amount of overhead which could ultimately be avoided. It downloads the nw.js runtime (on first load) and extracts a zip file from a resource in the executable containing the main application. Then it launches the game, passing in the path to the executable. It does all this so it can read and write game state from the end of the exe file. (At the moment this functionality is disabled. I did a tech demo of this first, but there are no persistent elements to the world yet.)

Open Doors to Other Worlds

  • Local multiplayer

    • Discovers other clients through tiny JSON files stored with ports and PIDs. Discovers other clients through SSDP

    • TODO: Manage input methods for multiple players. You should be able to play with two people on one keyboard, without some program to send input to two windows at once.

    • Could try to do single window splitscreen ("normal" local multiplayer) instead.

  • Multiplayer over LAN

    • Discovers other clients with SSDP

    • You can use Hamachi to establish connections between computers if LAN doesn't work for you

    • TODO: When booted from a server, have the world door sputter out behind you

    • TODO: Get booted if server doesn't respond for some time

  • TODO: Implement client-side prediction smoothing

  • FIXME: There is a race condition when going back and forth between rooms where you can get viewing a room that you aren't in. Entering a door involves sending a command to the server but you switch the room you're viewing instantly.

  • TODO: Remove the need for client-side prediction on the client's own server; maybe merge the client and the server so they use one World

  • TODO: Use random seeds to render the exact same blades of grass etc. as another client for the same world. (Also, with pixi.js, it'll probably be fast enough to render the grass dynamically, so there could be wind and stuff, rustling through the grass as you move, explosions sending waves of air...)

Install

Final builds of the game will be standalone executables, but there's not much of a point yet to trying to release builds.

You'll need Node.js. Clone the project and then, in a terminal/command prompt in the project's directory, run:

npm install ; cd game ; npm install ; cd ..

Run

After installing, you can run the game with:

npm start

On the first run, it'll download the nw.js runtime.

There are also scripts to run multiple instances of the game:

npm run start-secondary
npm run start-tertiary

These only work on Windows, but I could make a CLI script that works cross-platform, and allows any number of instances, plus other options like --enable-logging.

Build

The game implements hackily saving game data directly to the executable binary, which is rather platform specific. This is only implemented for Windows so far, but it should be feasible on at least some other systems.

On Windows:

npm run build

On other platforms, for now:

npm run build-simple

hacky-game's People

Contributors

1j01 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

reimertz

hacky-game's Issues

Issue trying to start after install

[kirkins@philip-pc hacky-game]$ npm start

> [email protected] start /home/kirkins/tmp/hacky-game
> nwbuild -v 0.12.3 -r game

(node:4770) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
Using v0.12.3
Create cache folder in /home/kirkins/tmp/hacky-game/node_modules/nw-builder/cache/0.12.3
Downloading: http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-linux-x64.tar.gz
  downloading [====================] 100% 0.0s

Launching App
{ Error: spawn EACCES
    at exports._errnoException (util.js:1033:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at exports.spawn (child_process.js:386:9)
    at /home/kirkins/tmp/hacky-game/node_modules/nw-builder/lib/index.js:716:43
    at Promise._execute (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/debuggability.js:300:9)
    at Promise._resolveFromExecutor (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:79:10)
    at NwBuilder.runApp (/home/kirkins/tmp/hacky-game/node_modules/nw-builder/lib/index.js:715:12)
    at NwBuilder.tryCatcher (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/home/kirkins/tmp/hacky-game/node_modules/bluebird/js/release/promise.js:524:17) code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }

npm ERR! Linux 4.4.59-1-MANJARO
npm ERR! argv "/home/kirkins/.nvm/versions/node/v7.7.2/bin/node" "/home/kirkins/.nvm/versions/node/v7.7.2/bin/npm" "start"
npm ERR! node v7.7.2
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `nwbuild -v 0.12.3 -r game`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'nwbuild -v 0.12.3 -r game'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hacky-game package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nwbuild -v 0.12.3 -r game
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs hacky-game
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hacky-game
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/kirkins/tmp/hacky-game/npm-debug.log

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.