Sunday, 18 August 2013

Project ‘Coding Oledium’ – Part 3



In previous posts I warned readers that I was learning on the fly, in this part you'll see evidence of that. As often happens when coding, especially when learning coding, there's a lot of little glitches on the way to getting the code right. Some of those glitches might be simply getting the structure wrong or maybe not knowing how the language in question is structured in the first place.

Other glitches might be the fact that tyoping errors creep in or that when calling remote files to use their contents, it's not the same as having the contents in the same file, though technically it should be right? Just to say it, all these glitches are good. Learning by mistakes is accepted as the winning way these days, so get on with making those mistakes. Fail often and early remember!

At this stage of the project we've got the full set of files to use agreed, they 7 files that have been settled on are:

  • ad_index.vbs
  • ad_class_lib.vbs
  • ad_method_lib.vbs
  • ad_background.vbs
  • ad_hero_generator.vbs
  • ad_help.vbs
  • ad_inventory.vbs

Here's what I think each should contain:

ad_index.vbs
The main control file, with the flow of the game here. It will call all other files and allow us access to the Classes and Methods they contain. 

ad_class_lib.vbs
A library of all the Classes in the game. Some of these will be Hero, NPC, Mob, BackPack, etc. Anything that we want several instance of essentially the same thing and/or we want to have unique attributes.

ad_method_lib.vbs
Similar to the Class_lib, but for Subs and Functions. Maybe we could have them all together but I feel that will mix up what the files do and the design is meant to keep it easy to maintain.

ad_background.vbs
This file will be a collection of strings or arrays full of text. Some will need a dynamic reference to the Hero name which will be part of the Hero generator.

ad_hero_generator.vbs
This will likely be a collection of If statements, Subs and Functions to get the Hero generated. We'll have a bunch of attribute from the Hero_Class (see above) such as Strength and Dexterity. These will be created using some rules about min and max values plus a rnd number generator.

ad_help.vbs
We need a way for the player to know what commands the game supports, these will be in a help file they can call at any time in the game. Like background.vbs, I'm seeing this as a bunch of large text in strings.

ad_inventory.vbs
The world of Oledium will contain artifacts  weapons, armor  treasure, etc. and we need to know what they are, how many, what attributes they have. I'm not sure if this will be a bunch of arrays and text like background.vbs or classes. We'll see on implementation.


# First things first... calling other files

As the plan is to have similar stuff, such as functions, classes, text, hero generation, etc. in dedicated files for ease of maintenance, we need to think how to call other files. That will allow our game to idea work. I've written the code for this before, re-factored from various forums and sites, however I got a bit stuck at the end though.. mystery revealed in the next video (simple issue too!)



YouTube Channel: [WATCH, RATE, SUBSCRIBE]


In part 4 I'll pin down the error and get the Proof of Concept file-linking working, we can then really get moving building out elements of the game!

Mark.


Links for items mentioned in the video:

Functions, Subroutines, and How to Call Them From Other Scripts
http://technet.microsoft.com/en-us/library/ee176984.aspx#EEAA

File System Object
http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx

Open Text File
http://msdn.microsoft.com/en-us/library/314cz14s(v=vs.84).aspx

TextStream Object
http://msdn.microsoft.com/en-us/library/312a5kbt(v=vs.84).aspx




0 comments: