搜尋此網誌

Glossary script

Showing posts with label game systems. Show all posts
Showing posts with label game systems. Show all posts

Computer simulation


                       Computer simulation
Notion and terminologies
category: game systems

Forewords

The development of F.LittleFighter has led to the design of increasingly complex systems. The theoretic justification and implication of subsystems must be well understood in order to build a reliable game system. This article attempts to provide a concrete mental model to align people’s understanding on what game systems are. This article is not yet finalized.

Time model and determinism


         Time model and determinism
why use a fixed interval game clock
category: game systems

Terminologies

Time model

There are two types of time model in game systems: fixed interval and variable interval.
- A game clock is the parameter t which all simulations in a game varies with.
- Time model refers to how the game clock advances.
A fixed interval model is, thus, one that advances the game clock in fixed steps. In other words,
- The time interval between any two adjacent frames is always fixed in a fixed interval system.
- The time interval between any two adjacent frames may vary in a variable interval system.

keyboard controller

keyboard controller for games that every keystroke is critical.

長話短說:
  • 不要做polling / 不要每frame檢查一個鍵是否被按下
  • 用event driven model
  • 一個frame之內其實可以有多於一個鍵, 如果你的遊戲不可以漏鍵的話, 用一個緩衝器儲住按鍵
  • 定時定刻地 從緩衝器擷取按鍵
  • 小心處理程式並行性的問題 / 不要給其他pseudo-thread堵塞了流程
  • 如果不明所以, 就用F.core提供的鍵盤控制程式吧
{"polling":"唔識譯","frame":"幀","event driven model":"事件驅動的模式","pseudo-thread":"偽執行緒"}

in short:
  • never do polling / never check whether a key is down every frame
  • listen to key events / use an event driven model
  • if it is critical that every key must be captured / no keys can be dropped, buffer the key inputs
  • fetch the buffer at a defined point in the game loop
  • watch out for concurrency issues / do not get your event listener blocked by other pseudo-threads
  • use the carefully built keyboard controller provided by F.core

F.core/controller.js