The 2022 blog plan

I have got into the habit of always starting off a new year with a single post for a collection of posts that have to do with the topic of writing a blog rather than javaScript, or a given framework, or the various tech related topics that I typically write about on this website. Not that I think that this is the sort of thing that should happen only once a year, in fact I am always thinking in terms of what it is that I can and should do differently, and not just with this blog, but where I should be placing my time and energy in general.

When I look back at some of my older posts for the various years in which I have write this kind of post at the star of a new year, I have to admit that often I do not follow threw with much of what I outline in such a post. So maybe this time I will write about what the plan is currently, rather than what it is the I aim to do. The fact of the mater is that much might change this coming year when it comes to where it is that I choose to focus on moving forward with things. This might mean less writing, but more work on actual projects. It might also mean more writing actually, but in the form of improving the quality of older content that I have all ready wrote in terms of editing existing content, rather than writing new content.

Read More

Pool reduction digital art javaScript example

For the last day of the year I wanted to do something fun, so I made yet another quick javaScript example type post, this time it is a kind of digital art project that has to do with an object pool that will reduce in terms of the active count of objects. When it comes to my canvas examples collection of posts I have put together a canvas example that makes use of an object pool module for that example that I will then be using in this javaScript example.

I am thinking that this might just be the first of at least a few javaScript examples where the goal is to just do something artful with canvas elements, and also try to go in some new directions with programing in general while I am in the process of doing so. Often people think in terms of what they can do that is new, or different each time a new year comes around, and there are a whole lot of things that I would like to do that are new with javaScript, as well as with this website for sure. With that said there is treating this javaScript example differently this time around by setting some intentions, and making sure to follow threw with them. For example there is not just getting a crude idea up and working and moving on, but refining and improving the over all structure of the idea in terms of the quality of the source code which is one thing I would like to do with this javaScript example.

The general idea of this example came to me when I was editing my post on the javaScript array reduce method which is of course one of the many methods in the array prototype of native javaScript. What I had in mind was just a collection of display objects that move around on the canvas, and when one or more of them overlap with one all the display objects that overlap will combine into one parent display object. So then eventual all the display objects will end up, well reducing into a single display object. After that there is having some additional code that involves having the display objects split apart again. That is it in terms of the genera idea, and as of this writing I have that general idea up and running, but I would like to continue working on this project at least a little way beyond just having the general idea working.

Read More

Item probability javaScript example

This javaScript example post will be on a module that has to do with setting what the probability should be for various classes of items for a game of one kind or another, mostly RPG style games such as my turn based RPG game prototype that is another one of my javaScript examples. The source code of this example started out as a little source code project for my post on the Math.random method in native javaScript as there are a lot of little details about the use of the method beyond just the method itself and a few simple expressions using the Math.random method.

When it comes to such game projects they often contain item systems, and when it comes to such item systems one aspect of such systems is to have a class of item. That is that certain items are of low quality and as such they belong to a class often called common or something to that effect, and then there are items that are of the highest quality in the game and as such they belong to a class such as Epic. So then there is creating a system that can be used to set what the probability of a certain class of item occurring.

This item class module will then not be a whole item system then, let alone a full game prototype of any kind. However it is at least one little component of an item system that has to do with the probability of a certain class of item dropping. There is also the idea of having another set of probabilities for each item of a class also, but that might be a topic for another post that has to do with a more comprehensive over all system for dealing with items in a game.

Read More

The lodash clamp number method and adding a wrap number method

In lodash there is a clamp number method that can be use to return a number value that is based off of a given number that is to be clamped between a lower and upper bound. However it would seem that there is not a wrap number method which is also to be found in libraries and frameworks that provide such a method. If I want a wrap number method in lodash then I will need to add one to lodash by way of a mixin using the lodash mixin method.

I have found that these two methods that is clamp number and wrap number are two major methods that should be part of just about any general utilities library. So in this post I will be writing about the clamp method in lodash, but also how to go about adding the wrap number method that should be there along with it. There are also maybe a few things more to wrote about beyond just that such as the topic of other libraries and frameworks that given these kinds of methods, and also the subject of making vanilla javaScript alternatives to these kinds of methods that in some situations seems necessary.

Read More

Making a turn based RPG game javaScript project example

This week the plain is to expand my collection of simple JavaScript project examples, this time a simple turned based rpg based on the source code of another javaScript project example that has to do with grid unit movement. When it comes to the source code of the grid unit movement example I mad a whole lot of improvements to the source code of that example, and I thought that I should take the time to continue to expand on that source code but as a whole other project folder. This example is then that project as it currently stands, and as of this writing I still have a lot of work to do with this when it comes to turning this source code into yet another project that might end up being some kind of final product.

I have a lot of ideas of what I would like the final product to be when I get to that point. This time around I may in fact make a final product with this one because I still seem to still be stuck in that awful start something but never finish something loop, and I want to break out of it. So I will be getting into making art assets, and external json files that hold things like scene data and so forth, but at the time of this writing that just happens to be what I am working on now.

So when it comes to writing a blog post about what I have together at this point the focus will be on the various features that I have added at the time that I stopped working on my improved form of the previous example, and started working on this example. With that said one improvement thus far has to do with breaking things down a little when it comes to units, pulling logic out of the main game state module and into a units module. Another talking point has to do with starting a custom state machine, and a few files that are state objects for said state machine. The main feature thus far though is my game state menu system that is inspired by the circle menu system in from the super Nintendo game called Secret of Mana. As of this writing it is not a clone of that just yet, and I will want to make chances that will work well when it comes to having a web based game version of it, but thus far I would say that is the best feature thus far with this one.

Read More