Tuesday, December 29, 2009

quick post

busy as hell doing everything in the world but what i want to be doing (working on this game engine). But i did some reading on IE 9 and wanted to say something about it ... not that i think Microsoft gives a crap what the developers really think or want ... If IE 9 does not have support for the canvas tag i will ban the IE browser from my sites. A simple check and redirect to a page telling them to download a real browser that does support the w3c standards, why they should do it and links to the most popular browsers will do nicely i believe. I do encourage everyone who is trying to set up canvas-specific sites to do the same. If they don't want to support us ... they can talk to 404.html. :-)

going to go beat up a pillow now. cheers!

Saturday, December 19, 2009

Progress

Ok, court could not have went more wrong but i won't vent about that but that is over now. Now to just get the move and holiday stuff out of the way! I did work on it a bit as soon as i got home while the wife woke up though. Added the image preloader so that it works fine the first time instead of having to press the browser 'reload' button to get it to go. Next is to get it to scroll beyond the current 3x3 grid which will involve some duct tape, a crow bar and a 10 lb sledge hammer. :)

This first version will remain as a flat-isometric plane but i do have plans on adding a layered isometric plane later on. Performance is good in Firefox and Opera but in chrome it just flies! IE ... screw IE we don't care about them. :p perhaps in the next version they will add canvas support but i'm not getting my hopes up. not going to post a new link or even upload the newest version yet. I will do that when i get it to dynamically load a map from the server and it is scrolling beyond the current 3x3 grid. Maybe i'll even add in a fence or a cow or something else in addition to the trees and grassland.

Monday, December 14, 2009

Court Week has finally arrived!

ok, my wifes insurance claims are finally going to court. Doesn't seem like they are going to offer a real settlement at all so i guess we'll have to go the whole nine yards with this one. Bleh! like i have time for this! STILL in the middle of moving ... my wife, bless her heart, has us moving tiny bit by tiny bit. Move a few things then set them up in the new place, move a few more then set them up. Me i just want to get the crap over their and then set it up then. At this rate it seems like Christmas will be gone before we are finished.

Ok so it's like 5:36am and i have to jump in the shower in just a minute but I'll throw out my idea for the first game the canvas engine will be laid out on. I purchased a domain called moghack.com. No it has nothing to do at all with hacking mmo's. :p Instead it will be a multi-player version of nethack. Though I will be getting a lot of ideas from nethack it will not be a duplicate or a web-based clone of it. That's been done before for starters and the current base design of nethack does not lend itself to multi-player options. Their are two features that will be absolutely migrated over, random-dungeon generation and perma-death. I have several ideas laid out on paper for the multi-player aspects of it but they are still in their infancy so will not be releasing those ideas quite yet. More details to come in January i hope if everything goes as currently planned ... which it never does. :p

-Matthew H.
aka Wetlander

Tuesday, December 8, 2009

General FYI

Ugh, Christmas is in full swing so working all the hours that I can get. Along with 2nd job, trying to drum up more business for home and in the middle of moving i barely have time to breath. Come January though this should all settle down though as by then we will have finished moving and have the new house unpacked along with reduced hours at one of the two jobs. a heck of a lot less travel time is going to help as well, about one hour per day that i won't be sitting in traffic.

Good thing about working at wally world though is that it's pretty mindless so i'm carrying around a small notebook in which to write down ideas and plan my January to-do lists. Doubt i'll post much till then though so merry Christmas to everyone!

Tuesday, November 10, 2009

The Universe is a Big Place ...

Ok anyone who has done any sort of research on the universe at all, or attended some basic science classes, or opened a book, or looked up into the sky ... ect, knows that the universe is big. Very big, really big, we has humans cannot even grasp exactly how big it is much less see across the whole thing. Currently we can see somewhere like 13-14 billion light years away because that is how long it has been since the big bang.

So what?

Some games have lots of different playable worlds, which according to string theory is plausible, but the main reason for this has been server limitations. For a web-based mmo game however there is no real good reason for this limitation if you design your engine to work across multiple servers. Their has been great advances in cloud computing so as such I believe it is entirely feasible to create a JavaScript version of this and apply it to an mmo game.

I very much believe in the K.I.S.S. method even in programming. I've seen many programmers over complicate things just to prevent theft of their work or to justify their jobs. In it's simplest form this is what i'm thinking:

Servers ...
  1. 1 login server
  2. 1 chat server
  3. 1 AI server (?: possibly a cloud depending on the number of units it needs to control)
  4. 1 server for every X number of users
  5. 1 database server (?: possibly it's own separate cloud at a later point) to bind them all in darkness.
  6. (?: possibly) Star-map server. The only thing it does is path-finding as the star-map is fixed. Would be a behind-the-scenes server like the database-server.
With exception of the database server itself all of the other server programs should be a single entity to make installing and expanding easier. The base program will load the required modules for that type of server so as such initially they can all be loaded onto a single server and then expanded outwards as required.

Client Side ...
  • Each user is given a list of of user servers (#4) to poll for data, the system polls the list and uses the one with the fastest response time.
  • The servers are re-polled every (x) minutes to help reduce server lag and overloading.
  • Script will keep track of data return times and will force a re-polling in case of lag from a single server.
So it seems fairly simple and as such should be possible, but what about new players?
  • Players are not given a starting world, they must find their own world to colonize (possible addition to 'autopilot' to a inhabitable planet.
  • Players are given a copy of the the latest available copy of the compendium (all publicly available knowledge)
  • You start as a colony of the faction you choose, not your own independent nation (this however does not mean you can't be attacked even as a noob).
  • Technically speaking you can be a leach and never leave your colony and never perform any research at all. Factions share group knowledge with their members including leaches ... this however may make your leaders unhappy but that is up to the players themselves.
  • New players will naturally migrate out towards the edge of the known galaxy.
  • Their are fixed travel lines between stars (though it is possible later to circumvent these travel lines but it takes a much longer time)
  • More than 1 player can inhabit the same planet ...
  • That's right you can start on the same planet as your bestest buddie in the whole world.
  • You don't have to colonize a planet, you can choose to build a space colony instead. Though this idea does have strategic advantages it comes with it's own obvious set of problems such as expense and habitation limitations.
  • Shared Knowledge: Just via interaction with other players, trade ... ect. Knowledge is shared with each other in the form of bonus points, the time it takes to research something is reduced.
I will expand more on these ideas in later posts.

Monday, November 9, 2009

Moving, ugh!

Ok, so for like the next two weeks we seem to be renting two places at the same time, talk about expensive ... but can't afford for me to take any time off either. So for my next couple of days off will be spent trying to get the lead out of my butt and get this moving thing done. Good news about the new place is the fact that we will be paying less rent than what we are here, and we'll have about 400 sq ft more space! The wife and I are definitely hoarders and seem to have issues throwing anything away! lol. Instead it get's tossed in a box where it will remain for 2-5 years before donation to the salvation army. :p

I've set my DVR to record episodes of 'The Universe' on the discovery channel to see if I can get some more ideas for the Nemesis Star game. Still thinking to do that one first but at this stage I'm still flip-flopping quite a bit so anything is up for grab's. Everything that will be needed in both games is very similar for the JavaScript engine, the only big difference is the addition of a flat or 3/4 view perspective in addition to the isometric drawing routines ... which is infinitely easier.

For the server side I've been doing some research on SSJS (Server Side JavaScript). There seems to be way too many choices and confusion about it with little real information. I have though ruled out using any SSJS engines that are programed in php or any other server side scripting language ... i don't mind sacrificing a little bit of speed for ease of use, but not that much. Hell at this point it might just be easier to program the server side in C# with spider monkey overlaying it for the scripting routines.

Well i got to get my lazy butt to work get these next couple of days over with (work two jobs 3 days of the week). Then it's moving time! Ugh!

Saturday, November 7, 2009

General Updates

Busy busy busy! The freaking Christmas season is almost here! Ok at least at good ole wally world it is. Yes yes, I'm still working two jobs one of which is for Walmart ... hey they have benefits! Just about anyone working in the computer field as a web programmer will tell ya ... unless you get a great gig working for Google or some other large company you probably won't get benefits anywhere. Getting ready to move soon again! ugh! but at least now with this move I will be 1.6 miles from work! which means more time to do the stuff I want to be doing (aka, this game design thing)

Was reading through a forum news feed archive and came across this: http://news.ycombinator.com/item?id=751075 Instead of resurrecting an old thread (3 months at the time of this writing) I figured i would cover one of the topics that someone their suggested.

CSS Sprites and Javascript Canvas ...

The long story short ... don't waste your time using CSS to clip the sprites from a large png image ... all the browsers have big performance issues when clipping and if your going to build a GUI or game of any real scale this alone will kill any good performance you would get. This isn't to day that the persons idea was so off either ... the advantage to using fewer files is faster load times especially if you are using xmlHTTP requests to tell it what files to load.

A simple tile prototype ...

function Tile()
{
this.img = new Image(); // create a new Image object.
this.width = 128; // width of the tile. defaults to 128
this.height = 64; // height of the tile. defaults to 64
this.offX = 0; //X offset for drawing abnormal sized tiles
this.offY = 0; //Y offset for drawing abnormal sized tiles
}

From the above i think you can get the picture here already ... you simply load the big file then you piece it out into actual tile objects thus pre-clipping everything. You get the speed performance from using smaller images that don't require clipping and reduce server latency time because you are pulling fewer files.

Also another way to get great performance increase ... use multiple canvas's! ... How many you use and what each of these layers does is of course entirely up to you just remember that the top most layer is the layer the user actually interacts with for your event processing.

If their is interest i will discuss this in greater detail with actual numbers to back up my claims here. I've done quite a bit of testing and this is the fastest way to process canvas games of any real size or scale.

M. Hagston

Thursday, September 10, 2009

Moving On!

ok, i told myself no games, no nothing on my two days off here so i can get stupid map working....and then i get a cold. So with my blankie and an entire box of tissues done and i'm sure a nose that is kin to rudolf i finally fixed the error.


perhaps if i get comments then i'll post how it works, otherwise you can just figure it out yourself. The super-short of it is it has a 3x3 buffer, it the data from these buffers to actually render the current viewport. Next phase is to get it to update these buffers as the user scrolls in order to create the illusion of an infinately scrolling map. after that it will be to get an actual charecter into the map and walk around. :-)

i'll spell check these posts later, but i'm going to bed now and fein death for a few hours. ughhhh. **sneezes**

Sunday, September 6, 2009

FINALLLY! making progress

hour here, hour there, finally making some progress! Nothing i wish to post quite yet (but the same url is in the blog history if you really want to find it map test 002). I warn you though with all the test stuff activated (and new ruler bar that's dynamicly drawn), it takes like 10-12 seconds to first render in google chrome. With the test draws i would not suggest any other browser besides chrome untill it's optimized again.

Anywho! Finally got that error somewhat fixed, at least on the vertical axis it seems to be working correctly for P1 (top left drawing panel). I finally figured out if i make it clip correctly then it draws it correctly, something i planned on doing for optimization because letting the browser clip anything outside the window leads to slower draw times. Now i just have to get the other 3 panel layers clipped right and then the inital map phase is well under-way to being completed! Might have to increase the buffer from a 3x3 to a 4x4 area though in order for it to properly preload a map in all directions. Will do some testing as far as that goes though, would prefer to stick with the slightly smaller size just to avoid being a memory hog.

So hopefully soon i'll have a little guy walking around the map and behind tree's and such, first rendition i will avoid collision and pathfinding but neither should be that complicated to add (yeah right). I do have some simple pathfinding already programmed for javascript that navigated across and old starmap type thing, just have to locate which file it's in. Well lunch is almost over and I need to get some more work done! Hopefully i'll have something for people to actually play with soon, the first thing i'm shooting for is a small grassland to walk around in, then I will create a small space-station which will help test the collision and pathfinding. Not to mention it the type of map that will primarily be required for the Nemesis Star game. Seeyaz!

Friday, August 28, 2009

Life Get's in the way ...

Ok, has been WAY too long since my last post and that's going to stop now I hope. Still don't have any more time than I did a week ago, just getting a bit better at managing it. :-)

Going to begin working on this again starting first thing in the morning, though it will be the nemesis-star version of my javascript mmo and not the lychgate version. Nemesis star is more space-based and not fantasy land-based, and it has been fleshed out for a few years now on paper. I have done a fair bit of graphic testing on it already and given the current canvas support i belive it will work out better overall than to start with than lychgate, due to ease of implimentation. Maybe by next weekend I will have a link to post to start showing off the work. Well on my lunch break and it's already over, got to get back!

Will also see if i can find the initial story line and post the alpha copy of it for your review in the morning :-)

M. Hagston

Monday, May 11, 2009

General Updates

Been working here and their as I have time. I accidently (hehehe) installed the old 'Call to Power 2' on my puter ... between that and playing Fallout on the weekend I do belive I have neglected my programming for about a month now.

Things have settled down at good ole Wally World and I am on their perminant now (which i was hoping for for the benefits alone). Bad thing about working these computer jobs is that they never seem to last long and unless you work for someone like Google or Microsoft your probably not getting any bennies either. Family always comes first and my wife definatly needs medical insurance.

Nearly got my garden out! If you have a back-yard and you haven't planted a garden yet then get off your lazy ass and get out their and do it! I've started to late myself to get anything going from seed this year so we cheated and got some plants at Lowes. Not to badly priced either and some already have some little buds on them.  Couple of years back when tomatoes got to $4 a lb i was really thankfull that mine only cost me about $8-$10 total for all the 'maters i could eat! If you do plant tomatoes make sure you plant some marigolds (a flower) with them, they are a natural pest deturent for tomatoes. Planting some mint nearby (pots?) will also help to deture insects from getting into your veggies. So not only do i get all the veggies i can eat, they're chemical free. ;-)

Ok, not realy the kind of updates you were looking for aye? Ok, nothing that i'm going to show off quite yet but i nearly got the map scrolling perfected. I need to add in a few more little details then add in the ajax engine and do some load testing to and from the server.  If all goes to plan it should provide smooth scrolling with no noticeable loading. The only problem that it may have is when it actualy has to render the map. It takes about 3 seconds to render a 3x3 map (9 of my map grids). With the way the new system works it only has to redraw 3 of them instead of all 9. That's still a 1 second delay though which in human terms is very noticeable.  That though is only if the redraws take the same time as the initial load time which i'm hoping it doesn't as it is also loading the graphics as well. The new firebug timers don't work nearly as well as the old ones. At least they don't seem to provide the extremely detailed information that they once did. Time will tell!

Tuesday, April 14, 2009

Matthew's Miracle Diet

Ok, want a diet that works? This is especially for computer geek types like me who tend to sit at their computer a lot. Try not being able to get a full time job building websites and such and having to work full time night-shift at Walmart along with holding at least 1 part time job. Just being out 16+ hours a day means you won't even have time to bother with pesky things like food or sleep. :p Not to mention all that excersize that you'll be getting! Ugh, i'm too old for this sh*t. But hey! it's keeping my bills paid and the people at their are great, a few lazy people (but you'll find those in any job) but none of the back-stabbing that tends to flutter around office jobs. Just temporary work though, helping to reconstruct a walmart into a super-walmart so I maybe have a month left their tops. I do plan on getting back to work this weekend though on the engine as getting a working game that can generate me some mula may be my only option out of this hole.

On the plus side i think i've lost about 20 lbs now and just getting into my 3rd week working their. Not that i was really over weight but was starting to put on some pudgy marriage weight. :p

ok, gotta go don't wanna be late! Cheers!

Tuesday, March 24, 2009

Perfectionism

Wikipedia ...
Perfectionism, in psychology, is a belief that perfection can and should be attained. In its pathological form, perfectionism is a belief that work or output that is anything less than perfect is unacceptable. At such levels, this is considered an unhealthy belief, and psychologists typically refer to such individuals as maladaptive perfectionists.
Ok, i realize trying to make everything flow absolutely perfect is unhealthy and cannot really be achieved ... but i just can't help it. I mean it has to work right! The lives of villagers depend on it! Ok, not really ..  :p

Making good progress on getting the map to flow correctly though! What i've done is created 9 arrays that hold the basic map data. each of these arrays draws to a seperate canvas that is 2048x1024 ... i do this in order to speed processing. While i *could* try and make that canvas buffer larger that in itself would run into more problems, mainly having to go through map reloads. the 3x3 buffer allows me to reload and redraw areas off-screen and reduce the amount of time that the useri has to spend reloading data.

Also, the 3x3 array is dynamic ... meaning that the data as position 1,1 may not always be what's in the top, left corner. I simply have a pseudo-pointer (javascript doesn't do real pointers), that points to the current top-left of the drawing area. since the width and height of the array are fixed this allows me to draw the overflow sections by using 1st grade math ... p1+3 (right side), p1+1 (bottom), p1+4 (buttom right). Very simple!

The biggest trick is having to fit the pieces together smoothly. Because the minimap is click-able and draggable this changes a lot of the reference data. The good thing is that once i get this working, the same math applies to square tile-based layouts as it does to isometric tile based layouts.

And thus no code to show off today, perhaps soon though but again i only allow myself to work on this for a little while each week as bills come first. bleh!

Once i get this done, build some simple animation routines and get the basic collision working I will start making some mini-games in order to test the engine out properly. Not sure what i'm going to do first, i'm thinking perhaps a canvas-based tower defense game.

Friday, March 20, 2009

Guilds in RPG's

Not going to spend long on this today, too many things on the "honey-do" list not to mention sites that I need to get completed to keep food in our bellies. For starters in most mmo's their seem's to be a severe lack of real guild support for the players. Not to mention the fact that most of these mmo's are mearly about the grind and getting levels and seem to forget about other things.

Umm, idk why we can't get more female players ... i mean there's like 7 billion different monsters to kill! Ugh!...

That seems to be the general attitude that i've heard from admins and developers of games. Ok, well I guess i have the luxury of having a wife that likes to playe rpgs, well at least now she does. She very much doesn't like the grind and prefers to up her other crafting type skills and most monster-killing that she does do is related to that. Now i know that not all women prefer this type of thing ... which is really my point, no one strickly likes any one thing. But I digress I do seem to be getting slightly off topic.

The whole point being in order to even make these expansions of what guild can do, you also have to expand the content available to them. The only real problem with any of this is the fact that it expands the possibility of cheaters and scammers, but the only real way to deal with that is with the help and support of your player base.

In addition to guild and town buildings/housing their should be ways to organize this ... for both the players and the guild owners. Here is a breakdown of my ideas ...


MMORPG Guild Structures ...

  • Nation -> County -> Town

    To form a Nation you have to have at least 2 Counties.

    To form a County you have to have at least 2 Towns

  • Society -> Faction -> Circle

    Societies are secret clans, they may not form cities (that would defeat the "secret" part).
    Members of a circle cannot see members of other circles, only the officers and leaders can see this amount of structure.

    A society themselves may be public and have an office so that they may give off a certain appearence. The factions and circles however, and their intentions,  always remain secret. For example your Women's Society has a faction named the Black Widow's that is dedicated to only killing male players.

  • Clan -> Guild -> Squad

    "Guild" is the starting point, they may break their members into squads if they wish. Multipul guilds can form a clan. You can be a Member of multipul guilds (i.e.: Your a member of Knights of Ni and the Gardening guild.)

    Guilds are usually based in towns that they help to support, but they are not required (obviously unless the town you build your 'base' in requires your help).

    Guilds can build bases in multipul towns ... for example Your Guild, The Brotherhood of Bronze has their main office built in Noviscus but a minor recruitment type office in nearly every other major town.

All of the above should be able to share resources, though societies this is obviously limited due to their nature. All of these resources though take up space so you have to have a place to put these donations.

This is definatly the early stages of this idea and up for change. But i think you see the basic idea that I am getting too ... more possibilities for players and stop trying to limit them. They do all of this anyways!!! If you impose a limit of 15 players per guild, all they do is make multipul guilds. Impliment it into the game, keep their possibilities open and just let them have fun with it.

Wednesday, March 18, 2009

Expansion on Housing

Ok, going to expand on my ideas for player owned housing. The idea of the players being able to build and modify the existing landscape will be one of the core elements on the actual javascript engine. This, like all other items beyond basic drawing routines will be built as a module so it can be added too and/or modified easily.

In the other game I am developing, Nemesis Star (a space-based MMOR), actual habitable planets are somewhat rare so the players have the option of construction massive space stations. In addition to this they will be able to rent sections of their newly constructed station out. As such it makes sense to me, since i have this similar idea in multiple games, that it should be built into the core engine. Not to mention the fact that a great portion of online players really like the idea of having their own little piece of the world that they own.

I have played way too many mmorpg's in my life, quite a few of them in their early release and beta stages. A great many of them totally flop on their ideas for housing, perhaps due to a lack of understanding of the wants and needs of their player base? Or problems due to lack of available land, or allowing them to build houses pretty much anywhere. I remember one 3D FPS types mmorpg that some friends and I played, we put our house on top of a gigantic tree. 

Anyways I'm rambeling a bit here so here's  an expansion of the list of core ideas that should be addressed.

  • Guild Housing.

    Almost all players join a guild and as such they should be allowed special housing just for them! Any housing built for the guild is owned by the guild itself, not any one player. This is to prevent characters who go inactive but control the resources of the guild.

  • Hiring Workers.

    Not all players will want to spend the time leveling up construction and building skills just to add a single room to their house. You should be able to hire other players to build your house for you! Not only does this encourage a few to work these skills, but it opens up a whole new market for the players beyond just crafting a billion arrows to sell.

  • Hiring NPC's.

    In order to get people from spamming the town square with their goods they are wanting to sell you will have the ability to hire a merchant to sell them for you. This obviously is not a new idea for any of those who have played Ultima Online. In addition you can hire protection for your house, expecially seeing how you can be attacked by "monsters".

  • Traps and Magical devices.

    Certain sensitive rooms you may wish to put traps on if you are part of a PvP town. Their will of course be areas that you can store your hard-earned items but anything stored your house withing this type of town is up for grabs by an expert thief. You may have to feed and pay an NPC guard untill the day they die, but an Iron Golem never sleeps and doesn't care for gold.

  • To Catch A Thief ...

    In order to prevent a massive uprising of theives their has to be a way for players to bring them to justic. And as such your traps and NPC guards always have a chance to capture the player roaming around your home. This can lead to prison time or even public hangings, it is entirely up to the town. I'm sure their will have to be quite a bit of tweaking work in order to get it to run smoothly, but it is an idea that has been mentioned repeatedly across many different mmorpg's but has never been taken seriously. 

  • Environmental Changes ...

    Due to the fact that the map is saved on the server and delivered dynamicly you will be able to make some changes to the map itself. Things such as planting trees, cutting trees down that are in your way, leveling the ground out and more. Say for example your land area borders a mountain / cliff area. You do have the option to begin a tunnel and continue your town inside of the mountain. The downside, to that is if your town get's taken over by mob's, they also take over your new dunegon.

  • Unbuildable Areas ...

    Their are none, but some areas may require a great deal more work to ... pacify .. than others. Not to mention if you just start throwing up a house just anywhere you may find the kings guards on your doorstep demanding their taxes and other fees. Or perhaps you build your house within a PvP town's area without their permission ... they now have the right to take the taxes out of your hide.

  • Underwater Cities ...

    Yes, when i said you should be able to build anywhere ... with the right technology and skills ... you can build anywhere!


That about sums up the core ideas I have for housing, next i will touch on player guilds, factions, towns, nations.

-M

Tuesday, March 17, 2009

Goal for Lychgate

Nothing to report yet on my new logo page, having some problems still with the icons hopping around like little bunny rabbits. Pretty sure I know how to remedy it, just have to make the time to do it. But as always paying jobs come before any hobby work!!

Anyways, my primary goal for lychgate is PvE, not PvP. Almost all games that i've played concentrate more on PvP than anything else (except for graphics). Me, i'd rather have more of a real story-line and some real character buildup / skill base.

For example, one of the things that really made Ultima Online was the fact that it had a large skill-base and PoH (Player Owned Housing). Their biggest problem was also PoH ... the world seems quite large untill you figure in a hundred thousand players all trying to build their new houses on top of each other. 

My ideas for remedying this? ...

  • Super large maps / play area.

    The Biggest problem with this idea, beyond the obvious server-storage issues, is movement time. This is easy to remedy though by allowing a more intriquite teleport and gateing system. Also allowing players to build transportation networks (roads, ships, ect.) to increase travel speed.

  • Housing Decay.

    Yes, in real life if you don't properly maintain your house it will fall right on top of your head! Players who are inactive or just never visit their house will find that have decayed. While they will not dissapear entirely for quite some time, other players can take over the property and fix it up!

  • Housing Prices.

    Prices for player housing in most of these games are way too cheap. Plus if you are within the bounderies of a kingdom you will have taxes to pay if the current king (emporer, mayor, whatever) deems it so. To offset these prices a rental system should be put in place as well. 

  • PvE (Player vs Environment)

    Built your house right on top of a goblin village? You may find the goblins attacking your new house then! If you build a house / town / anything, you will have to defend it, this is not a human-friendly environment untill you make it so.

  • PvP (Player vs Player)

    If you are part of a town that participates in PvP then your house and town can be attacked by other players as well as "monsters".

  • Dynamic Construction

    You are not limited to a prefabricated anything. Build up your house one room at a time or all at once. Don't forget to put a roof on it if you have wood floors though as that will increase the decay rate of your home. When you purchase rights to build within a kingdom, you actualy purchase a piece of land to build on, so if you wish you can build a stone wall around your entire lot.

That's it for now, have to head out for the day!

-M

Friday, March 13, 2009

Worked some on my new logo page again, i added an icon to one of the spikes then discovered just how bad they were hopping around in the wrong places. Tried to correct it by just modifying the starting angle by which it was being drawn but no dice there, made the problem worse. hehe. Finally figured by doing a little bit of flipping around in the object arrays it workes just fine. Next up on the list will be to add more interactivity than simple cheesy mouse-overs. I added color to the object so i could track the spikes location easily, but will leave it in there. Will also add in border-color to the next version to show what is currently highlighted. A lot of what i'm working on with this simple logo will will be applied to the canvas engine, especialy the mouse-detection within a triangle portion. 

http://www.nemesisstar.com/sb_index_nemi3.html

Trying to slow down how much i was playing Atlantica ... way too addictive! Had a few friends of mine play it and I have barely seen them online since ... lol. Pretty much confirms to me that your game doesn't have to be exactly like 'WoW' in order to be popular. I already knew this but it is always nice to have real confrimation.

Ok, going to work on this some more but i doubt i have more to post quickly. If you want to look at the source code just go to the link above and view-source.

-M.

Wednesday, March 11, 2009

ASP IP Ban/deny list from .htaccess file.

:::General Information :::

Granted I did not search for very long for for those familiar with microsoft servers know that trying to use an .htaccess file with IIS just doesn't work. If you have direct access to the server then you can follow microsofts directions on how to do it, but alas not everyone can do that. So I decided to write a little include script to  correct this issue.

So far the only thing in the .htaccess file that it pays attention too is 'deny from' and 'allow from', and it will work across an ip range ... example:   192.168.1.1/100

Just rename the .htaccess file that you want to use to htaccess.txt, save this script into a file that you can include in your asp pages. Very simple. If are not a developer and want this on your site then please visit my site and I will get it up their for you. If you are a developer than feel free to use this script! You cannot charge for the script itself though, or include this script in a larger package that you charge for without my express permission.

If there's something relating to .htaccess files that you want added to this script then please let me know and I will update it and repost it here. 

If your looking for a list of ip addresses then visithttp://www.wizcrafts.net/htaccess-blocklists.html they have .htaccess files for several known spamming and scamming places, including ip's for several web-proxies to preven them from back-dooring into your site.


:::EDITS & UPDATES :::

none yet requested.


::: SOURCE CODE ::: 11MAR2009

Dim FSO, FO, File, numitems, htfile, line, ips, ip, ip4, userIP, accessallowed, overrideaccess

accessallowed = true
overrideaccess = false
userIP = Request.ServerVariables("REMOTE_ADDR") 
htfile   = "htaccess.txt"

Set Fso  = Server.CreateObject ("Scripting.FileSystemObject")
Set Fo   = FSO.GetFile(Server.MapPath("\" & htfile))
set File = FSO.OpenTextFile(Server.MapPath("\" & htfile),1,true)

' Pre-check for ALLOWed IP's. ...
Do While Not File.AtEndOfStream
  line = File.readline                                  ' Open the file for reading
  line = LTrim(LTrim(line))                             ' Trim any excess space from edges
  if LCase(left(line,10)) = "allow from" then           ' IP Deny list, process this line
    if line <> "all" then                               ' We won't be using the "all" keyword
      procDeny = LTrim(RTrim(Mid(left(line,10), 10)))   ' Trims out the ip list itself.
      ips = Split(line, " ")                            ' List is usually seperated with a space, this is used as the delimiter
      for n = 0 to UBound(ips)                          ' Loop through all the possible IP's.
        ip = Split(ips(n), ".")                         ' Split IP string into an array
        if UBound(ip) = 3 then                          ' Got an ip address and not a command. (should start at #2 normally but never assume!)
          ip4 = split(ip(3), "/")                       ' Try to Split 4th IP address string into an array
          if UBound(ip4) = 1 then                       ' Lower and upper bound of the IP address. otherwise it is just an ip address!
            for m = ip4(0) to ip4(1)                    ' Loop through all the IP's in this range and check them.
              if ip(0)&"."&ip(1)&"."&ip(2)&"."&m = userIP then
                overrideaccess = true                   ' Known good user, over ride the deny-checker and let them in
              end if
            next
          else
              if join(ip, ".") = userIP then            ' Single ip address, not a group, check it.
                overrideaccess = true                   ' Known good user, over ride the deny-checker and let them in
              end if
          end if
        end if
      next
    end if
  end if
Loop



' we do a simple close and reopen of the file as to increase server compatibility
File.close()

Set File = FSO.OpenTextFile(Server.MapPath("\" & htfile),1,true)
if overrideaccess = false then
  Do While Not File.AtEndOfStream
    line = File.readline                                  ' Open the file for reading
    line = LTrim(LTrim(line))                             ' Trim any excess space from edges
    if LCase(left(line,9)) = "deny from" then             ' IP Deny list, process this line
      if line <> "all" then                               ' We won't be using the "all" keyword
        procDeny = LTrim(RTrim(Mid(left(line,9), 10)))    ' Trims out the ip list itself.
        ips = Split(line, " ")                            ' List is usually seperated with a space, this is used as the delimiter
        for n = 0 to UBound(ips)                          ' Loop through all the possible IP's.
          ip = Split(ips(n), ".")                         ' Split IP string into an array
          if UBound(ip) = 3 then                          ' Got an ip address and not a command. (should start at #2 normally but never assume!)
            ip4 = split(ip(3), "/")                       ' Try to Split 4th IP address string into an array
            if UBound(ip4) = 1 then                       ' Lower and upper bound of the IP address. otherwise it is just an ip address!
              for m = ip4(0) to ip4(1)                    ' Loop through all the IP's in this range and check them.
                if ip(0)&"."&ip(1)&"."&ip(2)&"."&m = userIP then
                  accessallowed = false                   ' Known bad user, deny them access.
                end if
              next
            else
                if join(ip, ".") = userIP then            ' Single ip address, not a group, check it.
                  accessallowed = false                   ' Known bad user, deny them access.
                end if
            end if
          end if
        next
      end if
    end if
  Loop
end if
File.close()

Set FO = nothing
Set FSO = nothing
Set File = nothing

if accessallowed = false then
  Response.Redirect "/no_access.asp"
end if

Friday, March 6, 2009

New javascript/canvas splash page

Still working on my new splash page, i'm just not happy untill it works 100% like i want it too. You can view version two here: http://www.nemesisstar.com/sb_index_nemi2.html the first version is still in the same place, just go the the other blog entry to look at it and the code walkthrough.

Not going to go through all of this, basicly i had to get the 3 points of the triangle(s) and run them through a barycentric calculation.  If you want an explination on how that math works then visit these two sites ...


Now here's the main piece of code that has been added ...

        if ((((mouseX-ckW)x)) && (((mouseY-ckW)y)))
        {
          // Calculate the points.
          px1 =  x;
          py1 =  0;
          px2 = ((spikes[i].width * angCos[mmAng]) - (38 * angSin[mmAng]))+x;
          py2 = ((38 * angCos[mmAng]) + (spikes[i].width * angSin[mmAng]));
          px3 = ((0 * angCos[mmAng]) - (77 * angSin[mmAng]))+x;
          py3 = ((77 * angCos[mmAng]) + (0 * angSin[mmAng]));
          
          // Y-Axis Scale modification
          py1 = ((py1+y)*(scaleY))+ ctxHeight*((1-scaleY)/2);
          py2 = ((py2+y)*(scaleY))+ ctxHeight*((1-scaleY)/2);
          py3 = ((py3+y)*(scaleY))+ ctxHeight*((1-scaleY)/2);
          
          // barycentric calculation
          b0 =  (px2 - px1) * (py3 - py1) - (px3 - px1) * (py2 - py1);
          b1 = ((px2 - mouseX) * (py3 - mouseY) - (px3 - mouseX) * (py2 - mouseY)) / b0;
          b2 = ((px3 - mouseX) * (py1 - mouseY) - (px1 - mouseX) * (py3 - mouseY)) / b0;
          b3 = ((px1 - mouseX) * (py2 - mouseY) - (px2 - mouseX) * (py1 - mouseY)) / b0;
          
          if (b1>0 && b2>0 && b3>0) {
           spikes[i].mouseover = true;
           } else {
           spikes[i].mouseover = false;
           }
          
        } else {
          spikes[i].mouseover = false;
        }

Not going to walk you through every line of code there but basicly it it calculated the rotation of the 3 points (without the Y axis modification). Then it adds in and scales the points according to the current scaleY. After that it simply runs through the barycentric calculation formulas and does a simple check.


If you read the last blog entry you should also notice that it doesn't draw the spikes from an image any longer, now javascript renders them to the canvas through a simple object prototype called 'Spikes' ...

    function Spikes()
    {
      this.x = 0;
      this.y = 0;
      this.rad = 0.0;
      this.width = 105;
      this.ctx = '';
      this.mouseover = false;
      this.draw = function()
      {
        this.ctx.save();
        this.ctx.strokeStyle = "rgba(255,0,0,0.5)";
        this.ctx.lineWidth = 1;
        this.ctx.translate(x,y);
        this.ctx.rotate(rad);
        this.ctx.beginPath();
        this.ctx.moveTo(0,0);
        this.ctx.bezierCurveTo(0, 15,  85, 23, this.width,  38)
        this.ctx.bezierCurveTo(85, 53, 0, 62, 0,  77)
        this.ctx.bezierCurveTo( 5, 67, 5, 10, 0,  0)
        if (this.mouseover) this.ctx.fillStyle = "rgba(255,0,0,0.5)";
        this.ctx.fill();
        this.ctx.restore();
      };
    }
    spikes = new Array();
    for (i = 0; i<=8; i++) { spikes[i] = new Spikes(); }
 

yes, draw is a function not a string ... remember EVAL is EVIL, we don't use it. If you haven't used javascript prototypes before then you definatly will have to read up on them as i progress through this, or if you want to mess with anything in the google api.

Ok, i need a break and am going to go blow something up.



Thursday, March 5, 2009

AI Game Theory

Still waking up, and very unfortunately I am sipping tea instead of coffee. The wife insists that it's better for me. I'm not sure about all that ... :-)

My thoughts on how I want the default AI to work in my lychgate engine:

  1. Multiple levels of AI intelligence. Deer, and rabbits will not react as well as goblins, who will not react as well as dragons. I don't believe this should go by the default rule and just make them much stronger just to simulate this. Not going to do any JavaScript neural net programming ... i think that would possible be overkill. Instead the more creatures with more intelligence should have their own databases for battles with the characters marking successful and unsuccessful attack methods. Very simple, not real complicated programming and it has been proven to work in games such as computer chess.
  2. Animal Intelligence. Be default animals fear sentient creatures that attack them so as such herbivore and omnivore animals should by default make an attempt to run away. This will be a bit more difficult due to the battle style that I have chosen to go with but I'm sure with some trial and error in the alpha tests we can get this to work very well. Carnivores though, especially pack animals, may decide that attacking is their best choice so should run the simplest version of rule #1.
  3. Sub-Human. Goblins, and other related creatures will be classified as sub-human, and use the second simplest version of rule #1. They will though always travel in packs but may not always rush to help their friends due to their higher fear factor.
  4. Human. While it will never be close to real human intelligence, but through building it's own database of battle techniques to use against varying foes I believe we can simulate it very well. These and the other more intelligent foes always give more experience as well. The game should not be about the grind, every other game concentrates on that, i'm looking for more social interaction and group activities not just "hey, i killed 10,500 orcs and completed my noobie quest!"
  5. Above-Human. Better usage of the database, goal will be to be the big-blue of rpg battles. Yes, i have this problem where i dream to big. :p But if your going to dream that's the only way to do it.
  6. God-Like. Not only will it try to always choose the best usage of the database, they can influence all other creatures and can randomly be taken-over by the Admins! The rest of the god-like creatures will remain a secret ... for now.
Creatures will also war against other creatures ... they are not all friendly and cozy together. Also because of this creatures, sub-human and above, can gain simple experience levels. Nothing nearly as complicated as actual players (too much data to keep track of) but just and additional 2-3 bits of information. Also they will have the ability to change out their weapons and armor ... the biggest reason for this is the god-like creatures and humans who wish to be 'evil'.

Ok, that's enough ranting, some or all of these ideas may change depending on how will they work in actual implimentation ... but it's just me making this game at the moment and as such i'm the only one to bounce ideas off myself. :p

Wednesday, March 4, 2009

Busy Busy Busy

Ugh, barely any time to breath let alone work on lychgate. Been driving around Raleigh for what seems like an eternity now dropping of resumes and shaking hands. Most calls though have been from recruiters, which isn't that bad but they'll pretty much call anyone. Finally though the efforts are paying off and getting some real interviews.

I've never had any luck with any of these job-posting sites though, only people who call me from them is the recruiters. Yes I'm still very much a geek and believe more and more things will migrate to the internet. But even in all it's glory it still can't beat the personal touch of actually meeting someone face-to-face when handing them a resume and shaking their hand.

Perhaps if my job interview this afternoon goes well then I'll be able to have more time to concentrate on my game engine. Otherwise my wife and I will end up homeless soon. Neither of us have any family close by, but one of our friends in an online game we play invited us to stay with them if we do get our butts kicked out the door.

Been playing a Korean made game called Atlantica though for some stress relief. It's pretty fun, reminds me of final fantasy a bit. The battles are somewhat more tactical than most mmo's I've played, but their pay is based off selling items and then calling it free. Which it is free, no real limitations and you don't have to buy anything. But you can also get to level 95+ in a couple weeks if you don't have a life at all. Seemed like it was a great concept but they got side tracked along the way.

Well got to get to work, will post my interview results tomorrow and spell check this later.


-edit: spelling must be getting better, only FF only spotted one real error. :-)

Wednesday, February 25, 2009

New Logo using JavaScript and Canvas


Been working on a new logo for my nemesisstar.com website. Well not changing the logo really, just adding a bit of flair to it without using flash. If you want to take a look at it you can find it here. Again, don't bother trying to look at it using IE, as the internet explorer browser does not yet support canvas, and no official work that i know of that IE8 will support it either. 

Break down of how the script is working ...

Ok, for speed reasons I'm using 3 canvas's, not just one. All the base objects are wrapped in a div tag, the first 'img' tag inside the div will be used for those browsers that do not support the canvas object. For non-game stuff I have not reason not to provide some sort of backwards-compatibility support ... at very least so the search engines can still browse the site. the very last. I will throw everything into  a nice style sheet and make it pretty a bit later.


Setup of the cavas objects ...

    var logo = document.getElementById('myLogo');
    var logoBG = document.getElementById('myLogoBG');
    var logoBG2 = document.getElementById('myLogoBG2');
    var ctx = logo.getContext('2d');
    var ctxBG = logoBG.getContext('2d');
    var ctxBG2 = logoBG2.getContext('2d');
    ctxWidth = parseInt(document.getElementById('myLogo').offsetWidth);
    ctxHeight = parseInt(document.getElementById('myLogo').offsetHeight);
    document.getElementById('myLogo').width = ctxWidth;
    document.getElementById('myLogo').height = ctxHeight;
    document.getElementById('myLogoBG').width = ctxWidth;
    document.getElementById('myLogoBG').height = ctxHeight;
    document.getElementById('myLogoBG2').width = ctxWidth;
    document.getElementById('myLogoBG2').height = ctxHeight;
    ctx.globalCompositeOperation = 'source-over';
    ctxBG.globalCompositeOperation = 'source-over';
    ctxBG2.globalCompositeOperation = 'source-over';

Because I'm fitting the canvas objects to the screen width and height i need to adjust these values so that they are transformed to their appropriate 000px values. Otherwise, on some browsers at least, everything will have to pass through the scale routines and for some reason things really start to slow down.

Preloading the Graphics ...

Any graphics you use need to be preloaded, or if you are loading them as you need them in your script you need to verify that they are actually loaded before you use them ...

    var imgLogoA = new Image();
    var imgLogoB = new Image();
    var imgLogoC = new Image();
    imgLogoA.src = "assets/images/logo1a2.png";
    imgLogoB.src = "assets/images/logo1d.png";
    imgLogoA.onload = function() { loadCntr++; chkLoad(); }
    imgLogoB.onload = function() { loadCntr++; chkLoad(); }
    function chkLoad()
    {
      if (loadCntr==loadTotal)
      {
        renderLogo();
      }
    }

Very simple if you've done it before, no reason at all to make anything more complicated than you require. If you don't preload then you will get some very funky errors ... but inside the error text it will say 'no data' which is the key point to the error. The browser has 'no data' to work with .. as in, the image has not loaded.

The animation script ...

The script itself is pretty simple if you just walk through it line-by-line. Which I'm not going to do here. First everything needs to be set up and initialized ...

    function renderLogo()
    {
      ctxBG.drawImage(imgLogoA, centerX-203, centerY-203);
      window.setTimeout(doRotate, 100);
    }

The ctxBG is the middle layer which is holding the static logo. It is not moving at all in this portion of the script so their is no reason to keep redrawing it. Plus by sandwiching it between the three layers we can simulate the 3d effect.

angCos[curAng] and angSin[curAng] ...

Very simple simple if you have worked on any sort of 3d application. It takes more time to access Math.sin than it does an array. So we pre-calculate any sin or cos value that we might need and put them into these two arrays. As for the rest of the formula it is a very simple circle drawing routine from basic math class ...

        x = (250 * angCos[curAng]+centerX);
        y = (200 * angSin[curAng]+centerY);
        rad = curAng*0.01745 + offAng;

That tells us exactly where to draw all of the little spikes. The next line of code after the x,y are calculated converts the degree's to radians which is required by the canvas.rotate() function.  After that we actually have to do the drawing but there are two different buffers to draw too.

          if (fbuff==false)

The fbuff variable simply stands for "flip buffer" which tells the screen whether to draw to the foreground or the background based on the 'y' (vertical) value.  After that we do the actual drawing ...

            ctxBG2.save();
            ctxBG2.translate(x,y);
            ctxBG2.rotate(rad);
            ctxBG2.drawImage(imgLogoB, 0, 0);
            ctxBG2.restore();
            curAng += 45;

The canvas.save() and canvas.restore() do exactly like the sound, they save the current state of the canvas, allow us to do our manipulations, then restore it. canvas.translate(x,y) moves the origin point so that when we call the canvas.rotate(radian) function it rotates around the correct point and not the top of the screen (0,0).  canvas.drawImage(img,x,y) does exactly like it sounds ... draw's the little spike to the screen .. finally.

      ctx.translate(0,ctxHeight*((1-scaleY)/2));
      ctxBG2.translate(0,ctxHeight*((1-scaleY)/2));
      ctx.scale(1,scaleY);
      ctxBG2.scale(1,scaleY);

Above all that in the code is this piece which simply adjusts the vertcale scale value and re-centers the origin. The coupled with the buffer flipping is what gives us our pseudo-3d look without having to bother with full 3d code which is slow at best with the current canvas object. Full 3d support is to be added to the canvas object later, but they will have to get past the arguments about the standards first. Myself if i wanted to add full 3D i would just use Unity 3D even though I don't like plug-ins.

Speed of the canvas rendering ...

I've done everything that I've been able to think of to make this run as fast as possible and have a great more that I do wish to add. So far Chrome seems to run it the fastest for me by far and the few people I've had test it have said that a higher end video card does help in the rendering speed. The only thing I don't like is with the black on white it seems a bit shaky in the rendering. I could probably add in 2 more buffers and then flip the visibility after they are rendered to remove that but I'm not positive how that will work out.

Future additions ...
  1. Add interactivity so the user can play with the logo
    * double-click top and it will spin top-to-bottom
    * double-click side and it will spin left-to-right
    * drag the spikes to increase or decrease the spinning speed.
    * be able to click and select a spike
    * add a highlight-glow to currently selected spike/icon
  2. Add icons to the spikes
  3. Make the center image change according to the icon clicked on.
  4. See if i can get more speed by removing the canvas.scale() and converting the spikes to vector drawings instead of images.
  5. Convert the entire script into an animation object/class.
    Will be using this same type of animation in the nemesis-star game so that i can add space-station and such around planets. When being used on a smaller scale like that the animation speed should drastically increase.

Tuesday, February 24, 2009

MMORPG Stories

I had a question the other day relating to MMORPG's that I could not give a good answer too.  The question was ...
Can you name any mmorpg that has an active story line that compels the player to play along with the story, not just walk around and randomly kill mobs, and skill?

Me, I could not think of one single game that did that. I asked a few of my friends and one of them suggested a new game in beta called Jumpgate in which he is participating in the beta. he said.

The player is not REQUIRED to participate
  but the players are actively influenced with the results.
  Example...
  A new line of weapons come out
  If their faction doesn't complete the faction missions, then their weapons isn't released
  and they will be at a collective disadvantage


One of the things I want to do in my lychgate game itself, not the engine, was to make the story more interactive. Encourage group play that goes along with the story and weekly events to defend the 'human kingdom' from attack. While nobody should ever be required to play, it is just a game and not a job. Players should defiantly be encouraged to participate via rewards of some sort. Not just meaningless quests ... "please, this tree monkey offended me so go kill 100 of them and I'll give you some free stuff". Bleh, some quest.

I also think the monsters/mobs themselves need a great deal more AI than what they have.  How hard could it possibly be to script some action in the town and not just have everyone standing in one spot all day and night!

Also, I'm guessing no game designer has ever went deer hunting ... they don't freaking run to attack you! they run away! And a group of Orcs which would supposedly be sentient, i mean they built houses however crude they might be. But you can walk up and attack one, and the others don't run to help their buddy? yeah right. Yes adding some more realism would make it more difficult for the players, but in turn it would also make it a lot less "ok, only 57 more demons and I'll level up again", and a lot more "hey guys, let's go raid the Orc village together before they attack us!".

And in concerns with the deer, unless your stealth can surpass the alertness of a deer (not likely w/o magic), your not going to kill one with your "+10 vorpal sword of deer-slaying".  Use tracking to find it, and a bow or some sort of traps to kill it (traps for smaller game). Or go out with friends, some will be sent around to flush the deer or other game to you. This would not be that difficult to program and I'm not sure why nobody really has yet.  Just too much "kill, gain exp, kill, gain exp" and not enough game anymore.

I'll have a lot more comments on these ideas later. ;-) Feel free to post your ideas and comments about this!

Tuesday, February 17, 2009

Another jobless day

Another day passes, few phone calls yesterday from recruiters but I have not had very much luck with them so I won't get my hopes up.  At this point willing to relocate to just about anywhere to get a job. Wife insists that it's not the economy it's that I'm just lazy and haven't applied my self enough to the job hunt. Me being the quiet mousey type i just sit there and say nothing, I've learned that there's no point in arguing with her, she will keep going until she feels like she has won no matter how long it takes. But still, we're scraping by thanks to the grace of god and as long as that's happening we're a step above a lot of people in this day in age.

Anyways, did a bit more work last night on the canvas engine. Seems like Firebug has changed since I've lasted worked with the profile in the console. It no longer lists all the functions that are called like the old version. The old version would even list what classes were accessed, how often, and how much time it took. But alas I will have to just make due with it, just seems like their development progress took a step back. I have the mini map scrolling properly across the mm buffer, just need to get it updating the main map area fluidly.

Fluid updating of the map .... I've seen other's try this with DHTML and run into problems.  After you have optimized the draw portions of your map-renderer you then need a way to interact with it. Though I do try to avoid global variables for the obvious problems they can cause I've implemented a global boolean variable called notDrawing. This actually should be in the drawing class itself and it will be placed there later when I restructure it.

At the beginning of any event function that will do any rendering to the map the variable 'notDrawing' is set to false. When the calculations and rendering is complete then notDrawing is set to true. This allows you to very simply check the renderer .... 

if (notDrawing)
{
drawDetails(obj, x, y, tx, ty)
}

Very simple, but what is the point you may ask! Ok in order to make the mini map and the large main map move fluid they have to be redrawn as fast as the browser will allow. What you want to avoid though is over sending these draw calls as it will cause a slowdown instead and could lead to the browser being locked up. Even a short lockup of the browser will frustrate users and cause them to leave. 

Some other ways to optimize your JavaScript code... Avoid using EVAL, eval is bad as it forces a delay in your script and causes the browser to call it's parsing program. Other places where you use eval and might not even not it ... widows.setTimeout, or windows.setInterval. It has been common practice for years and i see this mistake in tutorials all the time where they do something like ... windows.setInterval="myFunction();". This is just like an eval statement and forces the browser to call it's parser routine. Instead remove the quotes and the parenthesis so it looks like .... windows.setInterval=myFunction;.

Another way to optimize your JavaScript code is to use VAR. In JavaScript you do not have to declare your variables, but by doing so it becomes a global, and as stated previously use of global's is bad. This is one of the primary problems that people run into when using JS Scripts from multiple sources, the fact that the variables conflict. I've seen some scripts use super long variable names to avoid this, which is ok i guess but seems a bit pointless. Just predeclare all your variables that you use with a VAR statement instead. That limits their scope to inside the {} brackets and I'm pretty sure it limits it to inside the .js script file as well, though i would need to do some testing first to be totally positive on that. 

Ok, time to start wandering around Raleigh dropping off resumes to the local web business's. I was told by a recruiter that this looks desperate ... but then again he drives a Ferrari so I'm pretty sure that he hasn't tried to find a job in quite some time, especially in this economy.

Friday, February 13, 2009

Lychgate Roadmap

Lychgate - the JavaScript Game Engine


This is a portion of a Google document that I have created to assist me in my programming activities. I believe the first full game I will design this engine for will be for my Nemesis Star game. By doing this it will include support for ground, air and space activities across multiple planets. Nemesis Star however encompasses both RTS and RPG elements which should make the design of the basic engine a bit trickier but overall I think it would be a better final product for it.

I will be revising this as I go and put forth a more detailed road-map to a full fledged game, but at the current moment getting these few things done would allow me to open up some closed alpha testing and tweak the game till it works properly. I do have a list started for requests from people to be part of the closed alpha, but if you wish to participate you must make this request before it begins.


A few requirements I have laid down for myself ...


Classes

  1. Classes will be broken into groups based on what they do.
  2. These groups should work as independantly from each other as possible.
  3. Allow dynamic loading and unloading of these classes and scripts.
  4. Each group type will have basic get/put elements that are required for interaction with that group.
    (this all allows multiple types of the same group.)
  5. Cannot load more than one group type at the same time.
Graphics

  1. Graphic animation strips should be small, 1 animation type/direction per file. This means multiple files however it does give a big speed processing. I've tested this quite a bit and the larger the file the more the slowdown when clipping from it.
  2. The graphics library must support dynamic buffering. This would be the dynamic creating/deletion of canvas objects where needed. Back-buffering is a very old trick but it does very much apply when using the canvas tag to render scenes and animations. By pre-rendering certain things you get a great improvement in performance.
  3. Dynamic loading and unloading of graphics. The map object will be designed to support a nearly infinite amount of different tile terrains. Because the base graphics are loaded into via smaller files the map engine itself can select what terrain tiles that it wishes to load. This allows the coder to put just what they want into the map from any terrain library that they wish.
  4. A simple web-based graphics editor. Not really so much for creating graphics as for clipping, arranging animations and such. Can make the graphics editor more complicated later.
  5. Web-based map editor. Their is none, map edits would be made by the GM/Owner in real time in the game world itself. Why create two version of the same thing.

The to do list ...

  1. A Super-Basic RPG

    1. Basic Client Side Graphics Development

      1. Create the Draw Class

        1. This class is responsible for all the drawing

      2. Create the Sprite Class

        1. This is an extension of the ‘Draw’ class as it gives it the ability to use tiny buffers to perform animations and movement.

      3. Create the Timer Class

        1. This is what controls the Sprite Class and Draw class in order to insure that everything runs at the same speed across all supported types of computer systems.

      4. Map-Drawing Layers

        1. Ground Layer

        2. Object Layer

        3. Mini-map

        4. Character Map

      5. Create the Panel Class, this utilizes the Draw class to display the panel information. But all the information itself is contained within this class. The “Overall Display” is a series of Panels so that they are more easily moved and migrated as required.

      6. Primary Information Panel

      7. Overall Generic Display Setup

    2. Basic Server Side Database

      1. Tables

        1. MOB

        2. Map

        3. Player

        4. NPC

        5. Scripts

      2. Encapsulation

      3. Write DB Access scripts, ultimately should support SQL and postGreSQL, (access support would be useless to include, so don’t!)

        1. Methods … (Check W3C? or another Open Source Solution first?)

          • Open

          • Get

          • Set

        2. Properties

    3. Basic Server Side Data Server

      1. Basic AJAX setup, XML

      2. Challenge-Pass.( Insure login through every connection via Sessions and Privacy Protection.)

      3. XML Packages …

        1. Note: Packages should ultimately be scriptable though an Admin section. The packages will be XML Templates with pre-programmed variables and scripting methods. This is done to ease later programming and increase the overall flexibility of the server.

        2. MAP Package

        3. Player Package

        4. MOB Package

        5. NPC Package

        6. Script Package

        7. Graphics Package

    4. Navigating the Map

      1. Now we add the ability to move around. Phase 1.1 is where we test our ability to draw the map. This is in all encapsulated in a draw class.

      2. Create the MOB class, “Mobile Object”

      3. Create the Player Class

        1. Add ability for the player to move

        2. Add animations

      4. Create the NPC Class

        1. This first instance is super generic and only displays the NPC as a static object. We give it the ability to move later in Phase 1.06.

      5. Create the Collision Class

        1. An extension of the Map Class but does no drawing.

        2. Prevents the player from moving into certain area’s

        3. Controls trigger areas

      6. Create the Script Class

        1. The script class load/unload scripts

        2. Is what the Collision class activates, specifically triggers.

    5. Our first battle

      1. Loading from remote server

        1. Battle-map

        2. Players

          • The first battle this will be a single player

        3. Enemies

          • Initial Monster will be the standard ole Green Slime. After that it will be a combination of slimes and/or goblins.

        4. NPC’s

          • The NPC will be the second part to this phase, buy a mercenary from the shop and it will participate in the battle with you.

      2. Initial Drawing Setup

        1. Map

        2. Mini-Map

        3. Battle Panel Overlay

        4. Pre-load and Pre-draw Common Animations for speed

      3. Initiative Phase

        1. Determine type of battle (turn-based or real-time)

        2. Set Initial Initiative Matrix

      4. Battle Sequence

        1. Using Initiative Matrix begin the battle

        2. When in turn-based mode everyone goes one-at a time.

        3. When in real-time mode everyone goes at the same time.

        4. Keep repeating until one team is victorious

      5. Ending Sequence

        1. Give out items and experience to winners if the player is victorious.

      6. Cleanup

        1. Close and destroy all object and classes created in this battle. Each object is stored in an object array called ‘trashcan’ when it is created.

      7. Draw player onto map

    6. Interacting with NPC’s

      1. Simple NPC Shop

        1. The NPC should already be drawn by this time.

        2. Setup NPC animations

        3. Setup shop window

        4. Setup shop XML Package. Refer to 1.3.3.a for details on this

        5. Retrieve Data Package from server for specific NPC