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.
- What to know first before reading more
The up to date source code, and any additional assets ca be found at my test vjs repository
In this section I will be writing about that main game module that is used to create and mutate a main game state object, as well as the library that I use to draw various parts of this state to a canvas element.
1.1 - The game.js module to creating and mutating the main game state object
1.2 - The draw.js fire for drawing to the canvas
Later in this source code I have a canvas element reference that is what will be used to draw the current state of a game object. I have got into the habit a long time ago to septate logic that has to do with a game object from logic that has to do with drawing that game state object. SO then this is that Logic that has to do with drawing the current map of a game world map, as well as various other things that I wanted rendered to the canvas.
2 - Core libraries of this example
I have took a moment to think in terms of what it is that I can pull out of my main game module and into a library that is its own independent thing. With that said thus far I have a general utilities library, as well as libraries that have to do with units, the game world map, and an object pool system that I am currently using with my menu system thus far. As I continue working on this example I am sure that this is a collection that will just continue to grow for the sake of keeping things fine grain and modular.
2.1 - The utils.js lib that contains various utilty methods
2.2 - The units.js lib for now
This is a lib in which I have pulled a lot of logic out from game.js and has to do with units that will be found in a map. I have expanded on it a little more sense then, and will likely continue doing so in future revisions so I think I should not write to much about this one at this time.
2.3 - The map.js lib
2.4 - The pool.js file
This is a object pool library that I puled from my game framework project that I have been working on for a while. As such I am seeing some things that I think I would like to change and add from that thus far, and when I do I will likely add those changes to future revisions of that framework.
3 - The state machine, and main.js
3.1 - The root sm.js file
This is the main state machine file thus far.
3.2 - The title state object
The title screen state object of the state machine.
3.3 - The game state object
The main game state object of the state machine.
3.4 - The main.js file
4 - Conclusion