Bigmap
Home Up

 

Bigmap large map game demo

Bigmap was an old GM5.3 project that seemed like a good candidate for HTML5.

The only problem with this was my "clever" tile generation scheme that depended on creating sprites at runtime. It is possible to do this subject to certain frustrating limitations:

  • Generated sprites did not appear to have valid collision masks. This is not unreasonable given that the collision masks were probably generated by the IDE.
  • Objects using a generated sprite with a collision mask always appeared to use image zero of the collision mask. This is probably a consequence of the generated sprite having only one image.

In order to make it play nice with HTML5 the first task is to bypass the generation code and use fixed sprites instead. This works.

A second possibility is to overlay a static tile object providing the collision mask with a dynamic tile providing scenery. This is an attractive option since the way the program is coded it should correctly clean up stacked tiles.

There are some irritating problems with sprite generation. The current method uses drawing surfaces, the design can be drawn on a surface then stored as a sprite. There are some significant problems with this approach:
  1. Surfaces aren't 100% reliable, it isn't totally clear to me but it appears as if surfaces are destroyed if the game goes out of view. This would make sense if they were just used for draw buffering but it is a problem if they are used for something like sprite creation with lasting effects
  2. There does not appear to be a reliable way to erase from a surface replacing the colour with transparency. Drawing with transparency results in nothing being drawn.
  3. There are also some odd and incompletely understood issues with surfaces and HTML5, it seems as if switching the drawing destination between the canvas and a surface repeatedly results in some objects not being drawn at all.