Welcome to Quin's CornerMany of the questions I've seen raised on the forum are not so much about specific Gambas issues; but more around coding in general and some of the bugs in submitters entries have been introduced by less than optimal structure in their written code.
These articles will contain information on how to plan, structure and write application code that is robust and easy to maintain in the long term.
Guest, if you have questions, just start a post on the Ask Quin forum and I'll be more than happy to answer general questions on how to structure your code and will write replies in the newsletter for some of the common questions.
Special note to "Newbies". We were ALL Newbies once, and my philosophy is that:"there is no such thing as a dumb question", so don't feel that you are alone in your quest to learn how to do things. Ask ! It's the best way to learn.
These can contain, binary files, micellaneous text files , image files of a few different sizes, a 'scratch' file location and a home for the database.
I did not want to 'hard code' the paths every time I wanted to access a file so if I changed something while in development, I would not have to
go back and change each reference to a specific file.
My solution was to create a Structure of file paths and reference this throughout each of the applications used in the game.
The structure is declared in the module 'Mod_RDGlobal' which is copied to each of the Rim Dweller application projects source code areas if a change is made.
Root As String
Game As String
Server As String
Help As String
Scratch As String
MiscFiles As String
Player As String
Mods As String
MusicTracks As String
SoundEffects As String
Database As String
SQLBuild As String
SQLData As String
Images As String
Icon16X16 As String
Icon32X32 As String
Icon64X64 As String
GameImages As String
WorldFlags As String
TarFiles As String
Svg As String
Tiles As String
TileSets As String
Logs As String
Public RDPath As New RDPathNames
Then I set the path names in a sub called Mod_RDGlobal.Initialise and build the folder structure.
This becomes very easy and If I want to make a new folder, I just add that to the structure and I can then reference that anywhere in the application.
For example: To reference a 32 X 32 Icon, I would use Mod_RDGlobal.Icon32X32 &/ "MyIconName.png"
This has made it very easy to change things as I build the structure.
'Assign Folder Names to Folder Structure
RDPath.Root = User.Home &/ "RimDweller"
RDPath.Database = RDPath.Root &/ "Database"
RDPath.SQLBuild = RDPath.Database &/ "SQLBuild"
RDPath.SQLData = RDPath.Database &/ "SQLData"
RDPath.Server = RDPath.Root &/ "Server"
RDPath.Game = RDPath.Root &/ "Game"
RDPath.Player = RDPath.Root &/ "Player"
RDPath.Mods = RDPath.Root &/ "Mods"
RDPath.Help = RDPath.Root &/ "Help"
RDPath.Scratch = RDPath.Root &/ "Scratch"
RDPath.Logs = RDPath.Root &/ "Logs"
RDPath.Images = RDPath.Root &/ "Images"
RDPath.Icon16X16 = RDPath.Root &/ "Icon16X16"
RDPath.Icon32X32 = RDPath.Root &/ "Icon32X32"
RDPath.Icon64X64 = RDPath.Root &/ "Icon64X64"
RDPath.GameImages = RDPath.Root &/ "GameImages"
RDPath.WorldFlags = RDPath.Icon16X16 &/ "WorldFlags"
RDPath.Tiles = RDPath.Root &/ "Tiles"
RDPath.TileSets = RDPath.Root &/ "TileSets"
RDPath.MiscFiles = RDPath.Root &/ "MiscFiles"
RDPath.MusicTracks = RDPath.Root &/ "MusicTracks"
RDPath.SoundEffects = RDPath.Root &/ "SoundEffects"
RDPath.TarFiles = RDPath.Root &/ "TarFiles"
With a simple Folder creation routine.
I am also considering 'Pre-Loading' some of the standard Icons that are used on the various Administration foms such as "Add, Change, Delete, OK, & Cancel
so that if I want to change these for different Images at any time , I just need to do this once in the Module and the change will be global.
Note# I tend not to use the stock Icons in Gambas as you can never tell what the final display will look like on various Linux distros.
Any questions or suggestions - Please feel free to add a comment.
Read more 0 comments
Rim Dweller is a Rogue Like Space Trading game written in Gambas.
It's main focus is on exploration and trade rather than combat although there is a simple combat system.
To acomplish this, I have designed the application to procedurally create the universe based on some known physical laws.
Graphics is 2D and used 32x32 'sprites' for most graphical displays.
This Blog will record my learnings, failures, frustrations and progress as the Game development progresses.
I started designing this game around 12 years ago and have many notepads of hand written notes on concepts and ideas
and how to intigrate them all in a single game.
I've build Rimdweller to overcome the frustration I've experienced over the years in with different aspects of playing 'Space Trading' genra and their limitations and 'rules'
ie: You steal a teaspoon on some backwater planet on the distant edge of the spiral rim and immediatly every military and police official knows and will frantically hunt you down.
ie: You are in combat with an enemy ship and it's repair state is 5% but it can still fight like it's 100% while if the tables are turned, you can't shoot, fly or do anything about it but be 'target practice'
That's never made sense to me and it's one of things that I've challanged myself to overcome !
Rim dweller will consist of 5 applications.
The installation program will create all the neccessary structures for the game such as folders and base settings.
Use FTP to automatically download new/updated files from the Rim Dweller web site.
Update the local SQLite database with any changes.
Dowload the scource code for the main game including updates and recomplie automatically. ( this is a challange )
Provide a list of Mods that you can select to intigrate into your game or remove as required.
This is the 'master' administration console that I am currently creating to build the Rim Dweller universe.
Currently sitting at 3 Modules, 67 Classes, 29 forms and around 15,000 lines of code. (I expect this to tripple in size over time)
This is a cut down version of the master administration to allow modders to create Mods for the game.
These mods can be as simple as adding a new Trade Item or as complex as adding a new Alien race to interact with.
You can create Items, Companies, Alien races, Ships, Ship AI units, Missions, Locations, Planets, Moons, Spacestations, Stars, Clusters….
Modders create 'Projects' and are assigned an 'Author' that can be a single person or a team.
The Project data is intigrated into the Main Game if the player selects a specific Mod in the Install Process.
Mods can be removed at the start of a game including the current game.
This is the main engine for the game and 'hopefully' will allow multiplayer intigration. ( a lot of thought needed for this one !)
It can procedurally generate all the objects mention in the RDModder area and controls game behavior including ecconomics and
all the other entities that you can interact with.
This is the main game and the interface that the Player uses to Play a 'Universe' which is created on selecting "New Game"
Players can have multiple games (Universes) that they can play and can save current state of progress.
The player characture has Traits - Strength, Intelligence, Metabolism, Dexterity, Personality and Luck.
Each of these traits have a outcome on differrent aspects of the game.
Players can also have 'Perks' which are described as inate abilities that affect the player statistics.
The 'Bookworm' Perk increases your Intelligence and give a better outcome of any training that you do.
The 'Computer Geek' Perk allows you to better manage your computer systems on your Ship or interact with Location AI systems.
Items that the player used in the game can be of 2 Types.
Trade Items or Interactive Items.
Trade Items are simply that, you can trade with other entities in the game for 'credits' or other Items.
Interactive items can be used in the same way as trade items but you can also interact with them.
You may purchase a Shield Generator. You can have this fitted to your ship provided it is of the correct Model.
You can upgrade the generator with Firmware cards depending on how many 'Slots' it has available ( 0-3)
These cards will ajust the base stats for the Generator in various ways such as increasing the shield strength,
but… may increase the Power requirements and running temperature that will require more cooling.
You can fit Interaqctive items to you ship that are not the required model by using 'Adapter Plates' ( even Alien Tech)
The downside is that Adapter plates decrease functionality by a percent and are not always stable, depending on
the difference in model that you are trying to adapt. The chance of failure get's higher as the device ages.
Ships that the Player uses can be of many types and configurations.
Unlike 3G games, what the ship looks like externally is not as important but how it is configured internally is for Rim Dweller.
At the start of the game you have to do many things manually such as repairs and managing cargo.
As the game progresses, you can buy Droids that can take over many of these mundane tasks for you.
"A good Tech Droid is worth it's weight in Neodymium"
This is a taste of what Rim Dweller is designed to become ( if I live long enough) and I have no idea of a estimated finish date yet.
I'll make posts to this Blog as I make progress and try out new things and refine my knowledge of Gambas ( which is part of the reason why I'm doing this )
If anyone has any ideas for concepts or questions about Rim Dweller or Space Trading Game in general then please leave a comment.
(I've been playing Space Trading Games since 1978 'Galactic Merchant' was the first on my 16K RAM TRS-80, Cassette loaded system )
Read more 0 comments