-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
145 lines (121 loc) · 6.64 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html>
<head>
<title>Parasite</title>
<link rel="stylesheet" href="style.css" />
<script>
onerror = function (event, source, lineno, colno, error) {
if (/resizeobserver/i.test(event)) return;
try {
var err = ("" +
"\nline: " + (lineno || "unknown") +
"\ncolumn: " + (colno || "unknown") +
"\nfile: " + (source || "unknown") +
"\ntraceback: " + (!error ? "not available (" + event + " ??)" : error.stack)
);
fetch("/report_error/" + encodeURIComponent(err));
document.documentElement.innerHTML = "Fatal error: please copy and <a href=\"https://github.com/dragoncoder047/parasite/issues\">report</a>: <pre>" + err + "</pre>";
window.onbeforeunload = null;
}
catch (e) {
document.documentElement.innerHTML = "Double fatal error: please copy and <a href=\"https://github.com/dragoncoder047/parasite/issues\">report</a>: <pre>" + e.stack + "</pre>";
window.onbeforeunload = null;
throw e;
}
throw error;
};
onunhandledrejection = function (error) {
onerror(error, error.reason.source, error.reason.lineno, error.reason.colno, error.reason);
};
</script>
</head>
<body>
<main>
<div id="canvas_container"></div>
<div id="bottom_bar" class="flex-row"></div> <!-- filled in by code -->
</main>
<section class="sidebar">
<h3>Menu</h3>
<div id="menuitems"></div> <!-- filled in by code -->
</section>
<dialog id="welcome" class="big">
# PARASITE
You are a snake.
There are other snakes.
The other snakes are stupid. They don't even know they are snakes.
Your job is to teach the other snakes who they are.
*Note: The game is in a bit of a "shell" state right now. There really aren't any useful levels yet. You are welcome to play around and report any bugs, nit-picks, or ovservations, [here](https://github.com/dragoncoder047/parasite/issues).*
</dialog>
<dialog id="help" class="big">
# Help
## Snakes
All of the snakes other than the one controlled by you are controlled by AI neural networks. They are fed information about their surroundings and then choose 1 of 22 different things to try to execute in the world.
Snakes can see, in 5 directions around their head (straight ahead, 45 degrees left and right, and 90 degrees left and right) the distance, hue, and energy level of the closest snake in that direction, the distance, hue, and size of the closest pheremone particle, and the distance to the wall.
Snakes can also sense whether something is touching them, and where (left/right side of body, and position along the length of their body).
As well as the environment, snakes' brains are also fed their own energy level, length, and velocity.
Based on that information, snakes can choose to do a number of different things: move around, eat, release pheremones or make noise (which could be used to communicate among multiple snakes), or grow themselves <!--, or mate with another snake (creating more of them)-->.
### You (the player)
The player snake is given a few special abilities. As well of any of the actions a normal snake is capable of, the player snake can also meddle around with the parameters of the world itself.
You can grab onto a wall or a block and move it around, resize it, turn it, etc. You can also grab a snake and modify its physical properties, such as the energy cost for moving.
## Controls
### Keyboard
* Use the mouse wheel to zoom in and out. (The camera automatically follows you around.)
* Use the arrow keys to move around.
* Use `w`/`a`/`s`/`d` to move your tongue.
* Press `` ` `` (backtick) to grab or release something.
* Press `e` to eat.
* Press `q` to grow. <!-- * Press `z` and `c` to mate. -->
* Press `i` and `o` to change the color of your pheremone and `p` to release some.
* Press `k`/`l` and `;`/`'` to change your body color.
* Press `,`, `.`, and `/` to make noise.
**TODO finish this**
### Gamepad
***TODO***
</dialog>
<dialog id="devNotes" class="big">
# Development Notes
## Things to do
* [ ] Make more useful levels.
* [ ] Make sure error toasts still go on top of the level complete toast.
* [ ] Train the snake AIs to actually act like snakes.
* [ ] Export and save a pretrained model somewhere and then fetch JSON and load it onto all the snakes.
* [ ] Add a plugin/modding mechanism for users to add new things.
* [ ] Finish implementing last 2 actions for snakes -- creating more snakes other than the ones already added.
* [ ] Everything else marked `TODO`.
</dialog>
</body>
<script src="js/lib/matter.js"></script>
<script src="js/lib/rl.js"></script>
<script src="js/lib/marked.js"></script>
<script src="js/enhancedevents.js"></script>
<script src="js/utils.js"></script>
<script src="js/color.js"></script>
<script src="js/vector.js"></script>
<script src="js/coll_layer.js"></script>
<script src="js/linnaeus.js"></script>
<script src="js/toast.js"></script>
<script src="js/dialog.js"></script>
<script src="js/canvas.js"></script>
<script src="js/input.js"></script>
<script src="js/keyboard.js"></script>
<script src="js/muck.js"></script>
<script src="js/pretrain.js"></script>
<script src="js/brain.js"></script>
<script src="js/block.js"></script>
<script src="js/particle.js"></script>
<script src="js/snake.js"></script>
<script src="js/goal.js"></script>
<script src="js/level.js"></script>
<script src="js/game.js"></script>
<script src="js/main.js"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XR0F89CCGK"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-XR0F89CCGK");
</script>
</html>