Upgrade to Pro — share decks privately, control downloads, hide ads and more …

最強の放置ゲームを作ってる話 ~ と、そのうちのゲーム作るためのゲームデータエディタを作ってる話 ~

kthatoto
February 25, 2021

最強の放置ゲームを作ってる話 ~ と、そのうちのゲーム作るためのゲームデータエディタを作ってる話 ~

kthatoto

February 25, 2021
Tweet

More Decks by kthatoto

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ • ϋϯυϧωʔϜɿ͸ͱ (kthatoto) • Ruby/Rails, JavaScript/TypeScript, Nuxt/Vue, Go •

    Twitterɿhttps://twitter.com/kthatoto • GitHubɿhttps://github.com/kthatoto
  2. ԣಓ - ์ஔήʔϜͷ์ஔใु 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. ࠷ڧͷ์ஔήʔϜ ~֓ཁ~ $ game keyup $ game keyleft $ game

    keydown $ game keyright $ game action $ game cancel γΣϧͱͯ͠ΞΫηεͰ͖ΔΑ͏ʹ͢Ε͹ ΄ͱΜͲͷϓϩάϥϜݴޠ͔ΒΞΫηεՄೳ
  4. ࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket

    Connection $ game keyup $ game action $ game keydown ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε $ game keyleft $ game keyleft $ game action RPC RPC
  5. ࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket

    Connection $ game keyup $ game action $ game keydown RPC ϒϥ΢β ෳ਺ͷΩϟϥΫλʔΛಉ࣌ʹ ૢ࡞͢Δ͜ͱ΋Ͱ͖Δ
  6. ࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket

    Connection $ game keyup $ game action $ game keydown RPC ϒϥ΢β ήʔϜαʔόʔ ήʔϜͷ৺ଁɻΫϥΠΞϯτͱͷ઀ଓ؅ཧɺ ήʔϜϩδοΫॲཧɺΫϥΠΞϯτ͔Βͷཁ ٻʹର͢Δσʔλฦ٫ͳͲΛߦ͏ɻ IUUQTHJUIVCDPNLUIBUPUPUFSNXPSMETFSWFS
  7. ࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket

    Connection $ game keyup $ game action $ game keydown RPC ϒϥ΢β $-*ΫϥΠΞϯτ ϫʔΧʔϓϩηεΛىಈͯ͠ίωΫγϣϯΛ ுΓɺͦΕΛ௨ͯ͠શͯͷૢ࡞Λ࣮ߦ͢Δ͜ ͱ͕Ͱ͖ΔɻϓϩάϥϜΛॻ͍ͯࣗಈԽ͢Δ ͱ͖͸͜ΕΛ࢖͏ɻ IUUQTHJUIVCDPNLUIBUPUPUFSNXPSME
  8. ࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket

    Connection $ game keyup $ game action $ game keydown RPC ϒϥ΢β ϒϥ΢βΫϥΠΞϯτ ී௨ʹήʔϜΛϓϨΠ͢Δ͜ͱ͕Ͱ͖Δɻ ະணख
  9. ࠷ڧͷ์ஔήʔϜ ~֓ཁ~ ήʔϜαʔόʔ ήʔϜ σʔλ αʔόʔ ϓϨΠϠʔͷPC ϫʔΧʔ ϓϩηε Websocket

    Connection $ game keyup $ game action $ game keydown RPC ϒϥ΢β ήʔϜσʔλΤσΟλʔ Ϛελʔσʔλͷ࡞੒ɺ؅ཧΛߦ͏ɻ 31(πΫʔϧΈ͍ͨͳ΋ͷɻࠓ೔ͷओ໾ɻ IUUQTHJUIVCDPNLUIBUPUPUXHBNFFEJUPS
  10. 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
  11. 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; }
  12. 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