I am
posting this early today as I am going to The Last Jedi tonight so will be busy.
I have decided that for next year I will not be interrupting my emulator
project for game material unless it is for a game jam that I am participating
in. Material relating to resurrecting Blazing Games games and the revised
version of my Flash Game Development book will be on my resurrected Blazing
Games development blog which I will be starting this Saturday. Now onto Santa’s
Search.
When I
originally create Santa’s Search, Flash did not have any 3D support at all.
Worse yet, it didn’t have direct bitmap support so manually building an image
was not possible. My Coffee Quest series was already using ray casting. The CQ
ray caster had only partial perspective correction but after taking graphic
programming courses I realize that the solution I found was simply wrong and
that the better approach would simply do a world transform to make every ray
act as if it were the center ray. But that is way off topic. The point I was
trying to make is that at the time I couldn’t do ray casting so I went with a
more primitive algorithm known as the painter’s algorithm.
The idea
here is that you paint the things furthest from the player first then overpaint
the items with things that are closer to the player. The downside to this
approach is that you are potentially overdrawing the same pixel multiple times.
As this is not a real-time game, this is not a huge concern so the painter’s
algorithm works fine.
As you can
see by the sprite atlas above, the game has three different blocks that it uses
to draw the maze. A left-side block, a center block, and a right-side block.
These are chosen based on the position of the block relative to the player’s
viewpoint. Had I been a bit more ambitious with saving image atlas space, I
could have had all three blocks combined into a single distorted block and have
the sprite take just the appropriate chunk of the combined image. The deer and
sled images are the same no matter which position the player is looking at
them.
The
original game was controlled using the keyboard. As mentioned in previous posts,
I want the game to be able to be playable on touch devices. As the only
controls are turning and moving, adding simple arrow buttons was the obvious
choice. I was originally going to go with transparent arrows that turned solid
when clicked on, but felt that the outlined arrows simply looked better so went
with those.
The hard part of porting this game was
assembling the sprite sheet as Flash CS 6 did extremely poor so I had to adjust
the sheet manually then figure out the coordinates myself. The code was very
quick to port and to my shock worked nearly flawlessly once all the “this”
statements were added. Half a day’s worth of work and I have a playable game.
Not too bad for porting. Let us hope that my future Flash to HTML5 ports go as
smoothly as this one did.
See you next year!
No comments:
Post a Comment