-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
104 lines (104 loc) · 3.45 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
<html>
<head>
<title>Blocks</title>
<link rel='icon' href='favicon.png'></link>
<style>
html, body {
padding: 0;
margin: 0;
color: white;
}
#cnvs {
background-color: #444; /*#000500;*/
}
#name_inpt {
position: fixed;
width: 200px;
height: 40px;
left: calc(50% - 100px);
top: 50%;
font-size: 20px;
font-family: monospace;
text-align: center;
}
#control_div {
display: none;
width: 160px;
position: fixed;
bottom: 0;
right: 0;
padding: 4px;
}
#log {
height: 200px;
overflow: auto;
border-top: 1px solid;
}
#cmd_inpt {
width: inherit;
}
#stats_div {
width: 160px;
position: fixed;
top: 0;
right: 0;
padding: 4px;
}
#info_cont {
position: fixed;
top: 2px;
left: 2px;
}
#info {
left: 50px;
display: none;
max-width: 600px;
}
#info_cont:hover > #info {
display: block;
}
p {
margin: 5px;
}
</style>
<script src='https://git.io/zengine.js'></script>
</head>
<body>
<div id='info_cont'>
<div style='font-size: 32px; padding: 4px;'>i</div>
<div id='info'>
<p>All the code for this can be found <a href='https://github.com/joeiddon/blocks'>on GitHub</a>.</p>
<p>You will notice that all the 3d rendering is done through a 3d library
called <code>zengine.js</code> which you can find <a href='https:/github.com/joeiddon/zengine'>here on my GitHub</a>.
This is my most ambitious use of that library which was written from complete scratch, bar
the built-in trig functions and the ability to draw shapes to a 2d Canvas.</p>
<p>In addition the code uses an adapted version of <a href='https://github.com/joeiddon/perlin'>my <code>perlin.js</code> library</a>.
Which I modified so that each chunk is seeded based off a deterministic function of the base world seed - so the world is infinitely large,
but only requires a couple of bytes to store (the seed integer).</p>
<p>In terms of the multiplayer aspect, I have a Google VM Instance which, among other things, hosts a websocket server that you are (hopefully)
currently connected to. I say hopefully since it is most likely not running right now (sorry), but to pre-empt the game breaking, I have
encorporated error detection and if there is a server error, a red message should flash up and you can enter offline mode.</p>
<p>Finally, bare in mind that this is currently a work in progress, so:</p>
<ul><li>bugs need to be fixed</li>
<li>features need to be added.</li></ul>
<p>Enjoy! (and if you do, please star me on GitHub)</p>
</div>
</div>
<input type='text' id='name_inpt' placeholder='display name'></input>
<div id='control_div'>
<input id='a' type='checkbox' onchange='torch=this.checked'></input>
<label for='a'>torch</label><br>
<input id='b' type='checkbox' onchange='third_person=this.checked'></input>
<label for='b'>3rd person</label>
<div id='chat_div'>
<div id='log'></div>
<input type='text' id='cmd_inpt' placeholder='chat or `help` for cmds'></input>
</div>
</div>
<div id='stats_div'></div>
<canvas id='cnvs'></canvas>
<script src='world_generation.js'></script>
<script src='objects.js'></script>
<script src='script.js'></script>
</body>
<html>