View on GitHub


Web Gaming Experiments

download .ZIPdownload .TGZ

== New Game ==

Basic Physics

The Basic Physics in a typical 2-dimension action game is quite straight forward. Given the current gravity, friction and acceleration, the position of objects are computed with some basic math.

  • Gravity
  • The value of Gravity is added to velocity in y-axis each frame.

    vy = vy + gravity

  • Friction
  • In each frame, the speed in x-axis is multiplied by the value of friction(e.g a percentage of 80%). Such way we can see objects get slow down in a natural way.

    vx = vx * friction

  • Acceleration
  • Acceleration act the same as gravity, except it's horizontal. Howevr, the easy way is adding an initial speed when objects start to move.

    vx = vx + moveSpeed

    Elements of Fun

    I created this repository because the idea of making a game using DOM and CSS interested me.

    Initially, it's the rotation view in FEZ that I was testing. Then it occured to me that it seems more like a lab where I can do some experiments on gaming. It brings to me lots of fun implementing some great ideas in popular action game.

    FEZ rotation

    I'm not sure if I'm doing the box rotation the right way. The way you created a box in DOM is far from elegant. DOM is definitely not designed for this, but considering the future, I think it's worth trying adding some 3D elements to DOM. Controllable CSS animation is also essential for a better developing experience.

    Time Traveling in Braid

    The idea of time traveling in action game, according to Wikipedia, is seen in about 30 games. The specific gameplay includes playing at different points in time simultaneously, traveling throught the time line, cooperating with the past self.

    Most of these gameplays are well performed in Braid. The timeline in Braid acts like a stack in data structure, when you hold SHIFT, you are poping the stack of frames, what's happening now is pushing to the stack in each frame. The implementation is easy as I figured this out. The state of each frame, including position and acceleration state, is pushing to timeline stack. When player travels back in time, frames are poped and player is always on the stack top.

    What's Next

    There are lots of gameplay ideas and mechanism I want to write and play with in this platform, such as portals, replication in Swapper, 2-dimension shooting, combat and talking in RPG.

    The making of gameplay platform is also on the list. I've also started to read some game engine source to borrow some performance improvements.