Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
最強の放置ゲームを作ってる話 ~ と、そのうちのゲーム作るためのゲームデータエディタを作ってる話 ~
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
kthatoto
February 25, 2021
Programming
73
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
最強の放置ゲームを作ってる話 ~ と、そのうちのゲーム作るためのゲームデータエディタを作ってる話 ~
kthatoto
February 25, 2021
More Decks by kthatoto
See All by kthatoto
複数ブラウザウィンドウを 単一平面とみなしてボールの 衝突判定をする
kthatoto
0
210
CSSだけでCookie Clickerを作る
kthatoto
0
1.1k
いろいろな駆動開発の話 / various-driven-development
kthatoto
0
99
ぼくのかんがえたさいきょうの放置ゲームを作ってる話 / saikyou-houti-game
kthatoto
1
490
ぼくのかんがえたさいきょうのぶろぐしすてむ
kthatoto
0
750
Other Decks in Programming
See All in Programming
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
200
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
「人を評価する AI」の設計と実装
ryoyanara
0
120
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
470
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
530
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
460
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
180
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
130
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
1
1.3k
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
560
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
450
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
480
Mobile First: as difficult as doing things right
swwweet
225
10k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
330
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
Crafting Experiences
bethany
1
240
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Curse of the Amulet
leimatthew05
2
13k
30 Presentation Tips
portentint
PRO
1
360
Designing for Timeless Needs
cassininazir
1
430
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
Navigating Weather and Climate Data
rabernat
0
440
Transcript
࠷ڧͷ์ஔήʔϜΛ࡞ͬͯΔ ~ ͱɺͦͷ͏ͪͷήʔϜ࡞ΔͨΊͷήʔϜσʔλΤσΟλΛ࡞ͬͯΔ ~ by @kthatoto at ΞϧϛLTձ#4 on 2021/02/25()
21:00~
ࣗݾհ • ϋϯυϧωʔϜɿͱ (kthatoto) • Ruby/Rails, JavaScript/TypeScript, Nuxt/Vue, Go •
Twitterɿhttps://twitter.com/kthatoto • GitHubɿhttps://github.com/kthatoto
࠷ڧͷ์ஔήʔϜ ~ಈػ~ • 100%ࣗΈͷ์ஔήʔϜ͕͍ͨ͠ • ࣗͰ࡞Δ͔͠ͳ͍ • Ұൠతͳ์ஔήʔϜ์ஔใुྔ͕1࣍తɺ ͍͍ͤͥ2࣍త •
͡Ό͋Ծʹ3࣍తҎ্ͷใु͕Β͑ͨͱͯ͠ɺࣗͰ ୡͨ͠ײ͕͋·Γͳ͍
ԣಓ - ์ஔήʔϜͷ์ஔใु 1࣍త 1࣌ؒ͋ͨΓ10Goldੜ͞ΕΔήʔϜΛ24࣌ؒ์ஔ = 240Gold 10 × 24
2࣍త 1࣌ؒ͋ͨΓ(10 + x)Goldੜɺxͷॳظ0 xͷ1࣌ؒ͋ͨΓ+1͞ΕΔήʔϜΛ24࣌ؒ์ஔ = 516Gold 10 × 24 + 24 × (24 − 1) 2 ɾɾɾ ɾɾɾ
ԣಓ - ์ஔήʔϜͷ์ஔใु 3࣍త 1࣌ؒ͋ͨΓ(10 + x)Goldੜɺxͷॳظ0 xͷ1࣌ؒ͋ͨΓ+y͞ΕΔɺyͷॳظ0 yͷ1࣌ؒ͋ͨΓ+1͞ΕΔήʔϜΛ24࣌ؒ์ஔ =
2540Gold 10 × 24 + 24 × (242 − 1) 6 ɾɾɾ ͷʹΑͬͯୡײͷͳ͍ ΠϯϑϨͷΑ͏ʹײͯ͡͠·͏
ଟ࣍ݩతͳΠϯϑϨΛࣗͷ ૢ࡞ʹΑͬͯ֫ಘ͢Ε ୡײ͕ຯΘ͑Δ ์ஔ͍ͨ͠ʂ VS ࠷ڧͷ์ஔήʔϜ ~ಈػ~
์ஔ͞Ε͍ͯΔ࣌ͷήʔϜͷৼΔ͍Λ ࣗͰϓϩάϥϜͰ͖ΔΑ͏ʹ͢Ε ͍͍Μ͡ΌͶʁ🤔
ଟ࣍ݩతͳΠϯϑϨΛࣗͷ ૢ࡞ʹΑͬͯ֫ಘ͢Ε ୡײ͕ຯΘ͑Δ ์ஔ͍ͨ͠ʂ 🤝 ࠷ڧͷ์ஔήʔϜ ~ಈػ~ ϓϩάϥϜΛॻ͍ͯ ์ஔ࣌ͷৼΔ͍ΛࣗͰ ܾఆ͢Δ
ॻ͍ͨϓϩάϥϜΛΒͤͯ ์ஔ͢Δ
࠷ڧͷ์ஔήʔϜ ~֓ཁ~ $ game keyup $ game keyleft $ game
keydown $ game keyright $ game action $ game cancel γΣϧͱͯ͠ΞΫηεͰ͖ΔΑ͏ʹ͢Ε ΄ͱΜͲͷϓϩάϥϜݴޠ͔ΒΞΫηεՄೳ
࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket
Connection $ game keyup $ game action $ game keydown ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε $ game keyleft $ game keyleft $ game action RPC RPC
࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket
Connection $ game keyup $ game action $ game keydown RPC ϒϥβ ෳͷΩϟϥΫλʔΛಉ࣌ʹ ૢ࡞͢Δ͜ͱͰ͖Δ
࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket
Connection $ game keyup $ game action $ game keydown RPC ϒϥβ ήʔϜαʔόʔ ήʔϜͷ৺ଁɻΫϥΠΞϯτͱͷଓཧɺ ήʔϜϩδοΫॲཧɺΫϥΠΞϯτ͔Βͷཁ ٻʹର͢Δσʔλฦ٫ͳͲΛߦ͏ɻ IUUQTHJUIVCDPNLUIBUPUPUFSNXPSMETFSWFS
࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket
Connection $ game keyup $ game action $ game keydown RPC ϒϥβ $-*ΫϥΠΞϯτ ϫʔΧʔϓϩηεΛىಈͯ͠ίωΫγϣϯΛ ுΓɺͦΕΛ௨ͯ͠શͯͷૢ࡞Λ࣮ߦ͢Δ͜ ͱ͕Ͱ͖ΔɻϓϩάϥϜΛॻ͍ͯࣗಈԽ͢Δ ͱ͖͜ΕΛ͏ɻ IUUQTHJUIVCDPNLUIBUPUPUFSNXPSME
࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket
Connection $ game keyup $ game action $ game keydown RPC ϒϥβ ϒϥβΫϥΠΞϯτ ී௨ʹήʔϜΛϓϨΠ͢Δ͜ͱ͕Ͱ͖Δɻ ະணख
࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket
Connection $ game keyup $ game action $ game keydown RPC ϒϥβ ήʔϜσʔλΤσΟλʔ Ϛελʔσʔλͷ࡞ɺཧΛߦ͏ɻ 31(πΫʔϧΈ͍ͨͳͷɻࠓͷओɻ IUUQTHJUIVCDPNLUIBUPUPUXHBNFFEJUPS
ήʔϜσʔλΤσΟλʔʹ͍͍ͭͯͨ͜͠ͱ • ϑΝΠϧγεςϜΛNuxtͷΈͰૢ࡞͢Δ • Canvas Infinite Scroll ͷΈ • ΦʔϓϯϫʔϧυͷϚοϓσʔλϑΝΠϧͷׂΛಠࣗ
࣮ͯ͠Έͨ (Coming Soon)
ϑΝΠϧγεςϜΛNuxtͷΈͰૢ࡞͢Δ • ϚοϓσʔλϑΝΠϧΛϑϩϯτΤϯυͷΈͰ ฤू͍ͨ͠ • ϚοϓσʔλϑΝΠϧ͚ͩͰɺΦʔϓϯϫʔϧυʹ ͍͔ͨ͠ΒෳϑΝΠϧʹׂ͢Δ͜ͱʹͳΔ • ϚοϓλΠϧͷը૾σʔλͳͲѻ͍͍ͨ ϑΝΠϧΛҰׅಡΈࠐΈ͢Δඞཁ͕͋Δ
nodeͷ Λ͍͍ͨ fs ͰϑΝΠϧॲཧAPIαʔόʔผͰ࡞ΔͷΊΜͲ͍...
Nuxt ͷ Server Middleware ͬͯΈΔ🤔
Nuxt Server Middleware ͱ • NuxtʹAPIαʔόʔతͳ͜ͱ୲ΘͤΔ • on node Ͱॻ͚Δ
fs ͕͑Δʂʂʂʂʂʂʂ fs.mkdir // create directory fs.rmdir // remove directory fs.readdir // list files fs.writeFile // write file fs.readFile // read file fs.unlink // delete file fs.rename // move file/directory
ϑΝΠϧγεςϜΛNuxtͷΈͰૢ࡞͢Δ Nuxt Server Frontend GET /images fs.readdir fs.readFile for {
} Response List Images
const container = document. getElementById('container') container.addEventListener('scroll', () => { const
x = container.value.scrollLeft - 25 const y = container.value.scrollTop - 25 const canvas = getElementById('canvas') canvas.style.transform = `translate(${x}px, ${y}px)` }) Canvas (Infinite) Scroll ͷΈ <div id="container"> <div class="large-box"> <canvas id="canvas"/> </div> </div> #container { width: 300px; height: 300px; overflow: scroll; } .large-box { width: 5000px; height: 5000px; } canvas { width: 350px; height: 350px; }
Canvas (Infinite) Scroll ͷΈ σϞ on Keynote <div id="container"> <div
class="large-box"> <canvas id="canvas"/> </div> </div> https://konvajs.org/docs/sandbox/Canvas_Scrolling.html
• ࣮εΫϩʔϧҐஔ࠲ඪͱ ԾεΫϩʔϧҐஔ࠲ඪΛ͓࣋ͬͯ͘ • εΫϩʔϧʹΑΔ࣮εΫϩʔϧҐஔ࠲ඪͷࠩΛ ԾεΫϩʔϧҐஔ࠲ඪʹͯΔ • ࣮εΫϩʔϧҐஔ࠲ඪ͕ͬ͜ʹ͖ͨΒɺ ࣮εΫϩʔϧҐஔ࠲ඪΛਅΜதʹͯ͠ ԾεΫϩʔϧҐஔ࠲ඪมԽͤ͞ͳ͍
• ඳըΛԾεΫϩʔϧҐஔ࠲ඪΛͱʹߦ͑ ແݶεΫϩʔϧͷ Canvas Infinite Scroll ͷΈ