-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrldev-1.html
393 lines (306 loc) · 16.2 KB
/
rldev-1.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/assets/styles/styles.css">
<link rel="stylesheet" href="https://indestructibletype.com/fonts/Jost.css" type="text/css" charset="utf-8" />
<script src="https://kit.fontawesome.com/79c31398dc.js" crossorigin="anonymous"></script>
<!-- favicon -->
<link rel="apple-touch-icon" sizes="180x180" href="/assets/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/img/favicon-16x16.png">
<link rel="manifest" href="/assets/img/site.webmanifest">
<link rel="mask-icon" href="/assets/img/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/assets/img/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/assets/img/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<!-- feed -->
<link type="application/atom+xml" rel="alternate" href="https://efredericks.github.io/feed.xml" title="erik fredericks" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>fredericks does the roguelikedev tutorial - 1 | erik fredericks</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="fredericks does the roguelikedev tutorial - 1" />
<meta name="author" content="efredericks" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="introductory post for my participation in roguelikedev tutorial this summer." />
<meta property="og:description" content="introductory post for my participation in roguelikedev tutorial this summer." />
<meta property="twitter:description" content="introductory post for my participation in roguelikedev tutorial this summer." />
<link rel="canonical" href="https://efredericks.github.io/rldev-1.html" />
<meta property="og:url" content="https://efredericks.github.io/rldev-1.html" />
<meta property="og:site_name" content="erik fredericks" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2023-07-07T00:00:00-04:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="fredericks does the roguelikedev tutorial - 1" />
<meta name="twitter:site" content="@efredericks" />
<meta name="twitter:creator" content="@efredericks" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"efredericks"},"dateModified":"2023-07-07T00:00:00-04:00","datePublished":"2023-07-07T00:00:00-04:00","description":"introductory post for my participation in roguelikedev tutorial this summer.","headline":"fredericks does the roguelikedev tutorial - 1","mainEntityOfPage":{"@type":"WebPage","@id":"https://efredericks.github.io/rldev-1.html"},"url":"https://efredericks.github.io/rldev-1.html"}</script>
<!-- End Jekyll SEO tag -->
</head>
<body>
<aside class="menu">
<div class="menu-top">
<div class="menu-top_logo">
<a href="/" >
<img src="/assets/img/Fredericks-Small.jpg" alt="Logo" onerror="this.style.display='none'">
</a>
</div>
<div class="menu-top_expand" onclick="toggleExpander(this)">
<div class="bar_top"></div>
<div class="bar_middle"></div>
<div class="bar_bottom"></div>
</div>
<ul class="navigation">
<li>
<a href="/" category="home" title=""
>
<span>home</span>
</a>
</li>
<li>
<a href="/students.html" category="students" title="students tooltip"
>
<span>students</span>
</a>
</li>
<li>
<a href="/teaching.html" category="teaching" title="teaching tooltip"
>
<span>teaching</span>
</a>
</li>
<li>
<a href="/publications.html" category="publications" title="publications tooltip"
>
<span>publications</span>
</a>
</li>
<li>
<a href="/activities.html" category="activities" title="activities tooltip"
>
<span>activities</span>
</a>
</li>
<li>
<a href="/posts/" category="" title=""
class="selected"
>
<span>posts</span>
</a>
</li>
</ul>
</div>
<div class="menu-contact">
<a href="https://github.com/efredericks" target="_blank">
<i class="fa fa-github"></i>
</a>
<a href="https://scholar.google.com/citations?user=wpdiGa0AAAAJ" target="_blank">
<i class="fa fa-toilet-paper"></i>
</a>
<a href="https://youtube.com/@erikfredericks" target="_blank">
<i class="fa fa-youtube-play"></i>
</a>
<a href="https://twitch.tv/mrdoktorprofessor" target="_blank">
<i class="fa fa-twitch"></i>
</a>
<a href="https://twitter.com/erik_fredericks" target="_blank">
<i class="fab fa-twitter"></i>
</a>
<a href="mailto:[email protected]" target="">
<i class="fas fa-envelope"></i>
</a>
</div>
</aside>
<main class="content-layout">
<div class="post">
<div class="content-container ">
<header>
<h1>fredericks does the roguelikedev tutorial - 1</h1>
</header>
<div class="post-content">
<hr size="1" />
<p><a href="https://www.reddit.com/r/roguelikedev/comments/14q58js/roguelikedev_does_the_complete_roguelike_tutorial/jqr89ss/" target="_blank">Week 1 post</a></p>
<hr size="1" />
<p>I’ve silently participated in the Reddit (RIP) does the <a href="http://rogueliketutorials.com/tutorials/tcod/v2/" target="_blank">roguelikedev tutorial</a> over the past few years (and have never extended it beyond the basic tutorial - school-related things always seem to come up). This year I wanted to try something different and we’ll see how it goes. No guarantees I’ll finish this or that even I’ll make something releasable, but I wanted to have some fun and see where I can get.</p>
<p>I’ve always had a soft spot for grindy MMOs (for example, Ragnarok Online, FlyFF) and fell hard for <a href="https://www.realmofthemadgod.com/" target="_blank">Realm of the Mad God</a> (RotMG) several years ago. Oddly enough, one of the early contributors who did the maps for RotMG - <a href="https://www.redblobgames.com/" target="_blank">Red Blob Games</a> - also <a href="https://www.redblobgames.com/x/2025-roguelike-dev/" target="_blank">participates in this challenge</a>!</p>
<div align="center">
<img src="https://media.tenor.com/3QvpUGVoyuIAAAAd/rotmg-realm-of-the-mad-god.gif" alt="RotMG" title="RotMG" />
</div>
<p>Anyway, that’s where my mind wandered this year. This proof of concept will probably fall outside of the typical <a href="https://roguebasin.com/index.php?title=Berlin_Interpretation" target="_blank">Berlin interpretation</a> of a roguelike, and dare I say, may even become a rogue<em>lite</em>.</p>
<p>Here is the core concept:</p>
<h3 id="roguelike-mechanics-bump-to-attack-tile-based-movement-permadeath-etc-in-a-multiplayer-instanced-environment">Roguelike mechanics (bump to attack, tile-based movement, permadeath, etc.) in a multiplayer, instanced environment</h3>
<p>The fact that multiple players will be participating is not new, however is a tricky thing to address for the typical roguelike given that time moves only when players move. My design decision here is that time will forever be moving forward (meaning that the game state will update periodically), however players can “remove” themselves from the flow of time if they need to stop and think (or take a break).</p>
<p><em>Or, worst case they can bail on the instance as in RotMG if things don’t work out</em>.</p>
<p>This will be the <strong>meditate</strong> mechanic - players will enter a meditative state where they still exist but are on another plane of existence. A mechanic which is ripe for abuse and therefore probably will receive a cooldown timer of sorts.</p>
<p>One of my caveats is that, while I will do my best, this will not be a “secure” environment in which I can guarantee that players can’t abuse the client/server mechanic. If you’re familiar with RotMG (or any multiplayer game really) there was a serious issue with item duplication that went on for some time. I’m going to handwave that bit and assume I’ll hire a security expert at some point that can fix things.</p>
<p>Anyway, here are my overall goals for the follow-along tutorial series:</p>
<ul>
<li>
<p>Client/server architecture where all logic occurs server-side</p>
</li>
<li>
<p>“Standard” tutorial concepts implemented (e.g., multiple dungeon levels, enemies, items, etc.)</p>
</li>
<li>
<p>Different procedural content generation (PCG) methods for the map (BSP, cellular automata, etc.)</p>
</li>
<li>
<p>Camera system to allow large-scale maps to let the PCG shine</p>
</li>
<li>
<p>Ability for players to interact with each other (i.e., via a text chat)</p>
</li>
</ul>
<p>And some initial architectural/design decisions in no particular order:</p>
<ul>
<li>
<p>Server will be in Python to enable me to use <code class="language-plaintext highlighter-rouge">tcod</code> if necessary</p>
</li>
<li>
<p>Client will be in JavaScript/HTML5 and be responsible for rendering/handling player input</p>
</li>
<li>
<p>All code will be open source to enable others to spin up their own instances</p>
</li>
</ul>
<p>And lastly some stretch goals:</p>
<ul>
<li>
<p>Player can select tiles or ASCII</p>
</li>
<li>
<p>Players can trade with each other</p>
</li>
<li>
<p>Fog of war for individual players</p>
</li>
<li>
<p>Database implementation will allow persistence (<code class="language-plaintext highlighter-rouge">redis</code> or <code class="language-plaintext highlighter-rouge">SQLite</code>)</p>
</li>
</ul>
<p>I don’t plan to checkpoint this at all as I go so the eventual repository will be one single <code class="language-plaintext highlighter-rouge">main</code> tree, but I’ll try to highlight things that are “interesting” for others in these posts.</p>
<p>Prior to the Week 1 drop I wanted to get a prototype up and running just to see if I could get Flask to play nicely with web sockets and a JavaScript frontend. Here is a sample - hot pink is you, green are other players, E are enemies that will either randomly move or follow the closest player. When a player goes dark they are meditating and still exist but aren’t a part of the game until they resume motion.</p>
<p><img src="https://i.imgur.com/YfOeEQv.gif" alt="Sample interactions" /></p>
<hr />
<p><a href="/rldev-2.html">Next post</a></p>
</div>
<div class="post-metadata">
<p class="discography-album_release-date">
date: 07 July 2023
</p>
<p class="discography-album_type">
post type: blog
</p>
</div>
</div>
</div>
<script>
window.addEventListener("load", () => {
document.getElementsByClassName("copyrights")[0].innerHTML =
`Copyrights © ${new Date().getFullYear()} erik fredericks | template c/o <a href='https://github.com/ItsPatrq/minimal-music-project' target='_blank'>minimal-music-project</a>`;
});
</script>
<footer>
<p class="copyrights">
</p>
</footer>
</main>
<script>
(function () {
window.toggleExpander = function toggleExpander(x) {
const menu = document.getElementsByClassName("menu")[0];
const navigation = document.getElementsByClassName("navigation")[0];
if (menu.classList.contains('expanded--visible')) {
menu.classList.toggle('expanded--visible');
navigation.addEventListener('transitionend', function(e) {
menu.classList.toggle("expanded");
}, {
capture: false,
once: true,
passive: false
});
} else {
menu.classList.toggle("expanded");
setTimeout(() => menu.classList.toggle('expanded--visible'), 20);
}
};
window.addEventListener("load", () => {
// #region click to enlarge images
const imageWrappers = document.querySelectorAll(".click-to-enlarge");
imageWrappers.forEach(imageWrapper => {
imageWrapper.addEventListener("click", () => {
const img = imageWrapper.getElementsByTagName("img")[0];
const src = img.attributes.getNamedItem("src");
const modal = document.createElement("div");
const removeModal = function() {
modal.classList.add("hidden");
setTimeout(() => {
document.body.removeChild(modal);
}, 200);
};
const newImage = document.createElement("img");
newImage.classList.add("modal__picture-zoomed--image");
newImage.setAttribute("src", src.value);
modal.classList.add("modal__picture-zoomed", "hidden");
// modal.style.backgroundImage = `URL("${src.value}")`;
modal.addEventListener("click", removeModal);
modal.append(newImage);
document.body.append(modal);
document.body.addEventListener("keyup", e => {
if (e.key === 'Escape') {
removeModal();
}
}, {once : true});
setTimeout(() => {
modal.classList.remove("hidden");
}, 0);
});
});
// #endregion click to enlarge images
// #region embedded audio players
const players = document.querySelectorAll("iframe.embedded-player");
const getParamsByPlayerType = (src, type) => {
const rt = (src, height) => ({
src: src,
height: height
});
switch (type.toLocaleLowerCase()) {
case "soundcloud":
return rt(`https://w.soundcloud.com/player/?url=${src}`, 125);
case "bandcamp":
return rt(`https://bandcamp.com/EmbeddedPlayer/${src}`, 125);
case "spotify":
return rt(`https://open.spotify.com/embed/track/${src}`, 80);
case "spotifyalbum":
return rt(`https://open.spotify.com/embed/album/${src}`, 80);
case "spotifyplaylist":
return rt(`https://open.spotify.com/embed/playlist/${src}`, 80);
case "spotifyepisode":
return rt(`https://open.spotify.com/embed/episode/${src}`, 152);
case "spotifyshow":
return rt(`https://open.spotify.com/embed/show/${src}`, 152);
case "youtube":
return rt(`https://www.youtube.com/embed/${src}`, 350);
case "anchor.fm":
return rt(`https://anchor.fm/sucias/embed/episodes/${src}`,102);
default:
return rt(src, 125);
}
};
players.forEach(player => {
const givenSrc = player.getAttribute("givenSrc");
const type = player.getAttribute("type");
const { src, height } = getParamsByPlayerType(givenSrc, type);
player.setAttribute("src", src);
player.setAttribute("height", height);
player.classList.remove("hidden");
});
// #endregion embedded audio players
});
})();
</script>
</body>
</html>