1
0
Fork 0
Commit Graph

56 Commits (master)

Author SHA1 Message Date
Mike Gerwitz d42ca3f9cf
package.json license field update
Newer style.  Note that the license format does not support a very important
piece of licensing information: "or later"; the license is actually AGPLv3+.
2015-12-24 00:09:16 -05:00
Mike Gerwitz 3c2790791d
jshint integration and error fixes 2015-12-23 23:59:29 -05:00
Mike Gerwitz a0cc723582 Ignore remaining two jshint failures (to be addressed)
This gets everything in a good place for further refactoring.
2015-12-23 23:59:12 -05:00
Mike Gerwitz b2304316ba Decouple TileMasker from window.Image 2015-12-22 23:52:48 -05:00
Mike Gerwitz 93b61596b3 Decouple TileMasker from window.document 2015-12-22 23:45:00 -05:00
Mike Gerwitz 3b1ac2c78c Decouple LevelRender from window.document 2015-12-22 00:48:21 -05:00
Mike Gerwitz 2240a61ac2 Loosen coupling of FileLoader and window.FileReader 2015-12-21 00:47:39 -05:00
Mike Gerwitz 887d450955 Apply jshint to scripts/ on check 2015-12-21 00:41:34 -05:00
Mike Gerwitz ba6bc593d6 Dynamic event target for ClassicGame
Decouple from Window.
2015-12-21 00:20:36 -05:00
Mike Gerwitz 9b3fb7758f jshint on check 2015-12-21 00:10:11 -05:00
Mike Gerwitz 36a3ee63f6 {Map=>Level}
This resolves conflicts with the ES6 Map prototype.
2015-12-21 00:08:39 -05:00
Mike Gerwitz 47e022b555 jshint and initial corrections
This leaves issues that involve actual logic changes unresolved.  It also
raises an issue with the `Map` class, which is defined in ES6, and so will
have to be renamed.
2015-12-20 23:34:50 -05:00
Mike Gerwitz 93f3008740
Fix ltgloader-demo 2015-12-20 22:39:13 -05:00
Mike Gerwitz d856fbb957
Build combined lasertank.js
This does something that could not be done trivally back when this project
started: concatenate all files, which are written as CommonJS modules.  I
had to write custom code to do this with other projects; Browserify was but
an infant back in the day, and I remember SubStack talking about it on
freenode.
2015-12-20 22:39:05 -05:00
Mike Gerwitz 2f1967a902
Initial build system 2015-12-20 01:17:32 -05:00
Mike Gerwitz 017567193b
{lib=>src}
It's been a while since I've touched this project.
2015-12-20 01:17:24 -05:00
Mike Gerwitz af89ae7337
Begin transition toward decoupling GameObject (specifically Tank) and MapAction
I will be rethinking MapAction in general
2013-01-21 23:04:33 -05:00
Mike Gerwitz b6ef9cba15
Player movement restricted to map boundaries
This is an initial working concept; refactoring is certainly needed (in
particular, note the MapStae.movePlayer() 'bounds' argument).
2013-01-20 10:20:51 -05:00
Mike Gerwitz f4a61bf28a
ease.js version update (0.1.1); using non-minified version for development
A build can use the minified version for distribution
2013-01-19 22:59:02 -05:00
Mike Gerwitz 8f3ce4f8c6
Initial concept for player (tank) movement; state-driven map
Rendering now relies on hooking MapState, which represents the current state of
the map, raising events as various game objects change position or state.

This is a simple proof-of-concept---the tank moves, but only upward, and the
tile redraw does need work. There is no collision detection.
2013-01-19 13:50:50 -05:00
Mike Gerwitz 2c018a94b5 Began refactoring game logic into ClassicGame 2012-03-27 21:34:33 -04:00
Mike Gerwitz 9afa7e1240 Added favicon 2012-03-26 19:28:01 -04:00
Mike Gerwitz 7d85b5e21c All game content will now appear below the menu bar
I prefer the original look, but that is non-standard.
2012-03-26 19:28:01 -04:00
Mike Gerwitz abdda72148 Added titlebar to entire game "window" 2012-03-26 19:28:01 -04:00
Mike Gerwitz 3d3bee68f6 Refactored menu bar logic into ui/MenuBar 2012-03-26 19:28:00 -04:00
Mike Gerwitz a3e22b6d60 Added title support to dialogs 2012-03-26 19:28:00 -04:00
Mike Gerwitz 42228a8819 Removing upper and lower margins on first and last paragraph elements respectively in dialogs 2012-03-26 19:28:00 -04:00
Mike Gerwitz ee99ab6ba9 Added noscript dialog to index page
It is important that users understand that this game is free software. The same
issues exist for proprietary software in the browser.
2012-03-26 19:28:00 -04:00
Mike Gerwitz 2454739d75 Initial menu concept
One of the only remaining portions of the UI at this point (disregarding missing
functionality) was the menu bar. At this point, I had to make a number of
choices, among them:

  - Do I mimic the original Windows UI, or provide a more native experience?
  - Do I support pre-{CSS3,ES5,HTML5} environments, or take advantage of each?

The menu bar in this commit has the boxy style of the classic Windows theme --
not because I like it, but because it is representative of the original game,
which was available only for that operating system. The same style is applied to
the color of the "window" div in which the game is contained, as well as any
dialogs. However, the buttons displayed on the screen are in the style native to
the user's environment. With Gecko and Webkit offering the ability to style
elements (including menu bars, etc) in a way that looks native[1], the question
naturally arises -- do we provide more of a native port look, or a true clone
look? Should the latter be the case, it may be more appropriate to style the
buttons as boxes.

The next decision was whether or not to support environments that do not provide
many of the common CSS3, ES5 and HTML5 features. Initially, the project wished
to use CSS sprites in order to support older browsers, however with the move to
the canvas element, it seems unnecessary to provide such compatibility. Consider
also the push by organizations like Mozilla and Google to automatically upgrade
users' browsers, helping to ensure they have the newest available features. Also
consider that supporting older environments only discourages users to upgrade,
feeding the challenges that web developers already face in creating
cross-browser software. With all of that, the decision was made to simply use
the features provided by ECMAScript 5, CSS3 and HTML5, using browser extensions
where necessary (for unstandardized features, e.g. -prefix-foo in CSS).

It is rare that I get to work intimately with these newer features, as I find
myself most often having to maintain compatibility with older environments. This
will be an exciting chance to be able to explore these features and to showcase
them for others who wish to see them used in a complete piece of software. That
said, LaserTank is a fairly old game and, as such, is unlikely to take advantage
of features like CSS transitions (animations are handled by timers and rendered
to the canvas and there is not much else to transition), as that would take away
from the retro feel of the original game.

With the menu implementation, I attempted to limit myself to CSS as much as
possible in order to reduce the amount of code that had to be written for the
display of the menus and dialogs. The menus display using the :hover selector
and the dialogs with the new :target selector. JavaScript is used to to register
click events on the menu so that moving the mouse to another menu item will have
it automatically displayed, keeping each of the menus hidden until a click.
JavaScript is also used to determine when the menu should be hidden on mouseout.
The menu does not function exactly like the menu in Windows, but it will be
functional for now. I would like to worry about such issues after the bulk of
the game logic has been developed.

This commit's implementation is conceptual; it will be refactored shortly.

[1] https://developer.mozilla.org/en/CSS/-moz-appearance
2012-03-26 19:28:00 -04:00
Mike Gerwitz bbb718eb88 Added control buttons (not yet functional)
- Pixel precision for padding/margins, but button size left to window system
2012-03-26 19:28:00 -04:00
Mike Gerwitz edcc9318a2 Using classic Windows theme window background color (as would have been used in the original game) 2012-03-26 19:28:00 -04:00
Mike Gerwitz 0736ce5867 Began adding opening image to game screen
- Note that this is stretched to fit the full size of the board
2012-03-26 19:28:00 -04:00
Mike Gerwitz eabde5c226 Added menu to top of game "window" (non-functional) 2012-03-26 19:27:59 -04:00
Mike Gerwitz b1e5f18e20 Set background color on game "window" 2012-03-26 19:27:59 -04:00
Mike Gerwitz 9465af62cb Began adding index.html, which will hold the actual game
This essentially is a simplified demo page, styled to begin looking like the
actual game.
2012-03-26 19:27:57 -04:00
Mike Gerwitz fe2dbcac19 Moved global var declarations to main.js to be shared with game 2012-03-21 00:38:25 -04:00
Mike Gerwitz 22b99b9405 Added map metadata to demo page 2012-03-21 00:37:51 -04:00
Mike Gerwitz f037dff705 Added LVL metadata retrieval methods to ClassicMap 2012-03-18 22:02:42 -04:00
Mike Gerwitz 822e1e6d05 Corrected LtgLoader._getDataSegment() impl. and offsets
- Unit testing would have caught this. It is terribly uncomfortable not unit testing.
2012-03-18 00:35:01 -04:00
Mike Gerwitz 6654b19ecb Added ability to render other maps after having rendered another (demo file now allows for map selection by id) 2012-03-17 16:34:36 -04:00
Mike Gerwitz 6f1640e721 Corrected ClassicMap._SIZE
- Accidently added 16 (bits) instead of 2 (bytes) for the DWORD
2012-03-17 15:24:06 -04:00
Mike Gerwitz 0d82e84daf Added basic animation support to MapRender
This implementation is likely to change, but it does an excellent job bringing
the map to life. The only frustrating part is that the game looks playable,
but is not.
2012-03-16 21:36:57 -04:00
Mike Gerwitz 90b9208bca Refactored tunnel logic from MapRender into ClassicMap 2012-03-16 20:34:54 -04:00
Mike Gerwitz 6af5adddb8 Game object tile mappings and tunnel colors are now part of the ClassicMap 2012-03-16 20:04:52 -04:00
Mike Gerwitz e4f678919b ltgloader-demo now clearing previous MapRender instances 2012-03-16 19:43:41 -04:00
Mike Gerwitz 2a903f7b3d MapRender will now lock canvas from other MapRender instances 2012-03-16 19:42:59 -04:00
Mike Gerwitz 85426b9ab7 ltgloader-demo will now alert the user on all uncaught exceptions 2012-03-16 19:14:11 -04:00
Mike Gerwitz 17d8dbe0fc Removed hard-coded width and height for tunnel color rects 2012-03-16 18:51:29 -04:00
Mike Gerwitz eb5fb38396 Added reference to first element in circular linked list for tile frames
This will both make it easy to reset an animation and help to display
the first tile (when animations are disabled or for display tiles for
the editor)
2012-03-16 00:32:13 -04:00
Mike Gerwitz af533652a6 Initial map rendering support
The next major step for the clone is the loading and parsing of LVL files
(maps). This is especially imporant for the purpose of ensuring that users can
continue to use the maps the know and love (and possibly created themselves),
rather than having to recreate them in the clone.

The maps are concatenated into a single fixed-width file and loaded (in the
original sources) into the TLEVEL struct (LTANK.H). The main thing to note about
this data is the manner in which the object data (the playfield) is stored. The
TPLAYFIELD type (defined as a 16x16 multidimensional signed char array) is
formatted as [x][y], meaning that it is an array of *columns*, not rows. While
at first confusing, this does not complicate matters any.

This commit adds initial rendering support for the playfield via MapRender and
is demonstrated in the same demo file as LtgLoader. After loading a tile set,
the user can load an LVL file. The rendering is done using two canvas elements,
the second of which is created by MapRender itself and overlayed atop of the
original canvas. Unmasked tiles are rendered to the bottom canvas and masked
tiles to the upper, allowing us to move game objects without having to redraw
underlying tiles. This is also necessary as the context putImageData() method
overwrites any existing data rather than leaving values corresponding to the
transparent pixels in tact.

This commit also added support for tunnel coloring - each set of tunnels has its
own distinct color. The color values were taken from ColorList in LTANK2.C in
the original sources rather than using CSS color names (e.g. 'red', 'blue',
'magenta') because different environments may assign slightly different colors
to those values (as an example, FireFox does not use #00FF00 for 'green').
Tunnels themselves are identified by a bitmask (0x40), so we can get the tunnel
id by XORing with that mask. The ids are incremented by two in the LVL data
(e.g. 0x40 for index 1, 0x42 for index 2), so we can then divide by two and take
that index in the color array. This color is used to fill the tile with a solid
color in the lower canvas. We can then paint the tile on the upper canvas, which
will allow the color of the lower canvas to peek through the transparent pixels.

Animation support has not yet been added (but animations are still visible in
the demo to the left of the map rendering). This is an exciting start, as we can
clearly see what the game will look like in the browser. This commit also does
not cover any additional level metadata (e.g. author, difficulty, hints); that
will be addressed in future commits and added to the demo.
2012-03-16 00:06:30 -04:00