Search This Blog

Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Monday, April 3, 2017

MWDA, javascript, and weather system updates.

With my surplus of 'thinking time' for javascript coding, I find myself making progress inexorably towards a real, functional item.
So this isn't available yet but it will be soon.  I'm currently working on making this thing safely output to a page and I'll post it up on my blog eventually.

For your reference: MWDA is Mechwarrior: Dark Age.  It's a wargame using mini figures on the clix system.  It ran it's course a few years back and has since become something of a collector's item.  I collect many, myself.  That said, there's virtually no one to play with or against locally.  My sons aren't old enough yet.  So I have been humbly trying to migrate this to a program I can use and run to eventually build up to a full fledged game (similar to megamek in principle).  Then, eventually, I'll rip out the guts and rebuild it with my own game that I have been working on.

That said it's a great exercise in building something from nothing in javascript.  The current iteration builds it's own objects, a data table, a huge volume of information which only covers about 60% of the objects in the original Dark Age game.  There were many expansions of course, all of which will have to be added later.  The current version can do combat between two infantry units in direct contact.  It has no game board to speak of, no ranges, no graphics.  It's just the guts of a combat system and a very simplistic database.  

Once I have it mapping everything to a webpage properly I'll post it up on this site along with some updates from time to time.  I may obfuscate my code first, not sure.

We'll see.

 For now, that's what's up.  Once I sit down and hammer out my weather system (hopefully tomorrow) to make it consumable for the general public at large, then I will put it up for sale after final testing.  Price will range between 10 and 20 dollars.  Probably 15 with a sale price of 10-12.

Final checklist items needed for the weather system:
  • inclusion of my lightning scripting to provide realistic weather effects during a rainstorm.
  • ambient sound of various weather effects.
  • better methodology for deploying weather and time of day.
  • a general 'time of day' global variable based on loop counter/time.  Shouldn't be hard to do.  This will give a means to pull a time of day for secondary scripts (to allow shopkeepers to close up at 9pm, for instance).
  • better weather randomization.  Right now it's simply selecting based off a probability matrix.  This isn't really a great way to do things.  I'd rather it be for a percentage of the day vs just randomly selecting based on a time of day state change.  
I've also been thinking about just calling it early, wrapping it up, and saving other changes for a 'version two'.  Feature creep is a real bitch and sometimes it's better to just cut it off at the knees and save the rest for another time.  Some of this stuff is really easy.  Other stuff is more complex theoretical work (like how best to initiate/ramp up weather).

Anyways that's the status.  Take care and see you around.

Thursday, March 30, 2017

Found these two gems today (Javascript)

So I'm not some uber-JS programmer, let's just get that right out.  I know how to program and Javascript makes sense to me, until you add all those stupid extensions people throw at it like some kind of tacky christmas tree.

For a long time I've wanted to make a pure JS version of my MWDA (Mechwarrior: Dark Age) game for the browser.  However, my limitation was that I didn't understand how to get past the portion of actually outputting beyond using the alerts and stuff built into JS.

Enter the canvas element.  A cursory search today revealed an incredibly simple fix for this conundrum:

https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript

And:

https://www.w3schools.com/graphics/canvas_reference.asp

So the canvas, which is apparently a newish HTML element is one that is specifically made for people trying to do what I'm trying to do. Which makes it perfect for this iteration.   You basically get a blank drawing space.  I feel kind of dumb for not finding this before.  So when I've got time and I don't feel like reading RHEL Clustering Tech manuals, guess what else I'll be thinking about?