-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfile for running the game in the browser
- Loading branch information
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# this file is based on https://earthly.dev/blog/dos-gaming-in-docker/ | ||
|
||
FROM node:16-alpine | ||
|
||
WORKDIR site | ||
|
||
# js-dos | ||
ADD https://js-dos.com/6.22/current/js-dos.js . | ||
ADD https://js-dos.com/6.22/current/wdosbox.js . | ||
ADD https://js-dos.com/6.22/current/wdosbox.wasm.js . | ||
|
||
# the game itself | ||
ADD https://github.com/mlesniew/kosmici/releases/download/1.0/kosmita.zip kosmita.zip | ||
|
||
# add the index | ||
COPY index.html . | ||
|
||
# entrypoint | ||
ENTRYPOINT npx serve -l tcp://0.0.0.0:8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Kosmici | ||
# Kosmici Atakują | ||
|
||
`Kosmici` is a simple shoot 'em up DOS game that I wrote in high school. | ||
|
||
|
@@ -19,6 +19,22 @@ curl -L https://github.com/mlesniew/kosmici/releases/download/1.0/kosmita.tgz | | |
dosbox kosmita.exe | ||
``` | ||
|
||
|
||
## Running with js-dos in the browser | ||
|
||
The game can also be run with [js-dos](https://js-dos.com/) in the browser. The required server setup can be easily | ||
done with Docker: | ||
``` | ||
git clone [email protected]:mlesniew/kosmici.git | ||
cd kosmici | ||
docker build -t kosmita . | ||
docker run --rm -p8000:8000 kosmita | ||
``` | ||
|
||
The game will be available at [http://localhost:8000](http://localhost:8000). Unfortunately, the game can be very | ||
slow when it's run this way. | ||
|
||
|
||
## How to play | ||
|
||
* Use the mouse to move your space ship | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<html> | ||
<style type="text/css" media="screen"> | ||
canvas { | ||
width: 400px; | ||
height: 300px; | ||
} | ||
</style> | ||
<head> | ||
<title>Kosmici Atakują!</title> | ||
<script src="js-dos.js"></script> | ||
</head> | ||
<body> | ||
<canvas id="jsdos" width="400" height="300" ></canvas> | ||
<script> | ||
Dos(document.getElementById("jsdos"), { | ||
autolock: true, | ||
cycles: "max" | ||
}).ready((fs, main) => { | ||
fs.extract("kosmita.zip").then(() => { | ||
main(["-c", "kosmita.exe"]) | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |