46 Canvas examples and counting, animations, games, modules, and more.

I really like canvas elements they are the coolest HTML elements to work with, so of course I have got myself into the habit of making a bunch of canvas examples of my own. On top of that I also took the time to go about writing posts on these canvas examples here on my github pages site where I get into detail about the source code of each of them.

So then it seems like a good idea to have a post that will serve as a main index post of sorts for all of these canvas projects. That is a special post in which I briefly write about each of them, and of course like to the post where I should have the canvas example embedded and go over the source code of the example detail. So then this post will serve as that sort of central index post on all of my canvas examples that I have made thus far.

The canvas examples I have made range form simple animations, to more complex game and simulation prototypes in various stages of completion. Many of them are prototypes for games that I have not continued developing into a finished product. Other examples are starting to feel like a done deal, but might still need a little more work in terms of features, code readability, and so forth. So I have gotten into the habit of making sure that there are embedded packages for each canvas example in the post where I write about it that might help to sever as a way to get me to put a little more time and effort into the examples that may need more work.

I am going all over the board when it comes to playing around with canvas elements naturally because canvas is a great example of fun and exciting javaScript rather than boring yet practical javaScript, or at least that has been my experience with it thus far. So of course I have to make a lot of them, and maybe if I get to it pour a little more time and effort into some of them. So lets get to the list of canvas examples here then as they currently stand.

Read More

Node example of a world generator

I have a lot of ideas for game related projects, many of which will never see the light of day. However a great deal of them share certain things in common. One of which is a world map that exists as some kind of grid of map sections. That is a massive world map is broken down into smaller sub maps or sections, and each section has a max index of sorts. In other words a kind of grid within a grid. So this post will be a nodejs example on making a world map for a game.

Some ideas for world maps exist as collections of static or fixed width and height map sections others have width and height sections that are variable. Some ideas for game involve a world map that is generated each time a new game starts, and there is no need to save the state of the map necessarily. Other times I might want to save the map that is generated to then load again at a later time.

Ideas for games range from RPG style games, to other games that are more like simulations, so there is a need to abstract away game specific logic away from any and all modules that generate these maps.

Read More

Node copy directory example

This nodejs example post of mine will be on some javaScript code I put together for copying a directory. This might not be the best solution for all projects, but I am using some code to this effect in a project I am working on. There are many other node copy options out there on the web, many of which are packed with features that I will not use, I do not want, or I think should be pulled into another library. However in some respects they might also be a bit more robust compared to what I have worked out here.

Read More

Canvas example of exploding binary particles

I like the Die Hard move franchise, and in the third movie there are several scenes that involve the use of a bomb that is composed of a binary liquid. One chemical component by itself is not dangerous at all, however if mixed with another, it becomes unstable and can very easily explode.

So the binary liquid bomb thing in Die Hard inspired me to make a canvas example that consists of a bunch of particles moving around the canvas. Each particle is of one type or another, they can overlap if they are the same type, but if two of two different types combine they will result in another particle type that will result in an explosion.

This canvas example will then be yet another example of several canvas examples now that have to do with what is often called a particle. The term particle seems to be a generic term for a single display object of a collection of such display objects that move around the canvas. There are many other terms that might come up for this kind of object though such a sprite, or display object.

Read More

A simple nodejs lexer

I can not say that I often find myself needing to write a lexer. I will often just use a user space module that was all ready written before hand by someone else that is a lexer, or contains a lexer such as with marked.js. However there might come a time now and then when I will want to write my own lexer, one such reason would be to develop my own language. One thing that comes to mind about custom lexers is that I might want to write a one for my own complier, interpreter, or method that applies some kind of custom domain specific language.

A lexer is an important part of lexical analysis. Say I want to work out some code that makes sense of English language, the first part of such a process would be to break the text into an array of objects where each object is for a word, or other aspect of the language such as a period. this array of objects can be thought of as an array of tokens, and each token object would contain useful data about each token such as the index value at which is appears in the text, the word itself, if it is a noun or verb, and so forth.

Read More