Pages

Friday, June 21, 2013

New Battle System and Inventory

Battle System!!

 I've finally made a little bit of progress on the game, I introduced a basic random-battle system.  I was stuck on how to make a turn based battle system, but after learning what a yield statement actually did it was fairly easy to get a basic "I attack then you attack" thing going. It isn't very pretty yet and all you can really do is attack (damage = attacker's strength - random number from 0 to victim's defense).

The game now also knows what type of biome the player is in.  I'm setting up a database of enemies with one of their properties being "type of biome" so that when a battle occurs in a certain biome, the game can select an appropriate random enemy.

I'll need to have a leveling system for the player of some sort and also appropriately generated loot that will drop from the monsters.  A problem with a "leveling system" for this game is that since the world is generated randomly there are no "zones" so no area will be harder than any other area.  The concept of leveling might not be direct experience and increased stats through time but perhaps how well your shop does.  You will also eventually be able to catch and train monsters as pets so that may factor in somehow as well.

Revised Inventory / The damn loading bug...

This is my new inventory so far, it looks much better than the old inventory and it functions virtually the same other than creating a grid of images rather than a list of words.  I haven't been able to get the items to drag or drop yet but I will. If you click on an item without dragging, it will do the default action, if you right click it will open a context menu, and if you click drag is should drag  The blank space to the left of the larger item image of the hovered item will be where the player will equip his armor, weapon, and accessory.  They may also be able to equip tools (things to gather things in the world) in this same area.

The only bad thing is that as soon as I changed how the inventory was laid out, it will  give me one of these whenever I try to load the inventory from file.  It saves fine, it just doesn't load, and it throws the error in a place that other scripts use all the time without error so I'm really confused...


and I'm sick of seeing it! Blah! All the objects exist, I know it I put them there! It's been a few days of seeing this error now so it made it into the blog, anyways, rant on the error from hell for now, hopefully I'll get to brag about fixing it in the next post.

Thursday, June 13, 2013

An mobile update on my progress

Sorry I haven't posted for a while.  I hadn't really made that much progress, just optimizing things. Here's a list of what I've done

*sprites drop different items when clicked
*took away the radial menu completely because it won't fit in with things I'm planning for the future
*able to save and load games
*when you harvest an item the items sprite flies towards and collects at the player.
*chunks unload after a certain distance away allowing the player to walk as far as he wants without slow down
*lots of refactoring of code to prepare transfering data to and from other scenes
*unified GUI into a single GUI script
*altered biome generation code for more even biomes.

Bugs to fix:
*harvesting an item with a tool that should harvest nothing from the sprite will cause a white square to appear over the sprite.
*saving the game only saves approximate position of the player
*when unloaded chunks reload the features are in different places
*the speed of the player changes depending on how many times the game has been start anew or loaded (sometimes)

Features to add next:
*random battle system
*player stats system
*cities and towns

Saturday, June 8, 2013

Furthering the Item System

I changed how the inventory looks a little bit and plan to change how it looks by a lot before the time that this game is near playable.  Instead of the image of the item being right next to the text all the time it only shows up when you right click on the item.  Later I plan to make the right-click a menu so that you can do different actions with the object (equip, drop, properties, etc).  I also made a radial menu (which is actually a square right now but same concept!) that will fill up with equip-able tools in your inventory when you click on them.  

I made the "ItemHaver" Script more advanced in that it will cause the object to drop different items depending on the tool the player is holding.  I'm to the point now where I need to think of some new items because things are starting to drop some strange stuff.  I want to alter ItemHaver further so that there is a probability component related to what items are dropped, and maybe also relate it to the quality of the tool that you're using.

I'm getting more comfortable with manipulating an "item system" but I'm not happy about how it looks yet.  The next couple days will be trying to get my menus and inventory to looks better since now I've got a fairly good grasp on the code, as well as learning how to serialize and deserialize everything i need when changing levels so the players world can be persistent, which is pretty necessary.  Anyways, here's some pictures of what the menu system looks like right now:

Getting water using a bottle.
The Players equipment menu.

Thursday, June 6, 2013

Items and Alchemy and Headaches Oh My!

Designing the Item System

Over the last couple days I've been trying to work out a way to do the inventory.  I got something basic working but for what I want to do with the alchemy system I'm going to need a more sophisticated way of storing information about items.


Right now as far as an "Item database" I have a text file that is delimited by commas like this:
ID,Name,Basevalue
1,Water,0
2,Mineral,20
3,Leaf,10

The script called ItemDatabase takes this text file and turns it into a String[,] so the information can be looked up using an x and a y coordinate.  This array is then used in a function called GetItem that will return a new "Item" class that can be used in various parts of the game.  The GetItem function should also feed more stats about an item for use in alchemy but they should be generated randomly within the logical range of that object.  For example I want the information about "Leaf" to come from the database file, but then I want the type of leaf, genus of leaf, species of leaf and various chemistry-like information to be stored into the unique item that's created.

The way that items get into the players inventory right now is by the playing being close enough to an object that has an item in it, and then clicking on that object.  When the mouse cursor is over the object the object is highlighted to show that it can be clicked. 



My Ideas on Alchemy so far

My ideas on alchemy are a little fuzzy right now but I'll do my best to explain what I'm thinking, maybe I'll look back at this post later and realize what I was actually talking about.  Anyways:

An "Reactable item" will have these additional variables:
State
Temperature
State Change Points
SNumber (explained below)
Good/Evil Axis Value
Acid/Base/Neutral Axis Value
Natural/Supernatural Axis Value

State/State Change Points:

Every reactable item will be able to be in different phase states (solid, liquid or gas).  But the temperature and pressure that these items change states will vary based on each item; these temperatures and pressures are the state change points of the item.

Temperature/pressure: 

Temperature is not a static variable and it changes with environment, more on how "environment" will play a part in this when I figure out how the hell it will work ;).  

SNumber:

All objects want to get to 0 SNumber, or 0 charge.  For example if an object has an SNumber of 3 and meets an object with SNumber -2 then they turn into SNumber 1 and SNumber 0.

Objects only react if their SNumbers 

Axis Values:

The axis values (Temperature/Pressure/Good-Evil/Acid-Base-Neutral/Natural-Supernatural).  Will be  changeable through procedure and determine the current SNumber of the Item.

Alchemy done in game would be done through actual "pouring" of gameobjects into other gameobjects.  I hope to use a sort of "Atomic weight" variable to upscale so that things can be measured in proper weight and volume.

However, there still seems to be something fundamentally wrong with how I'm thinking about this system.  I want the system to be emergent.  I want as the programmer to be playing with it and go, "Wow, I didn't know I could make that into that!" And I feel like that wont happen with the current imagined implementation, but I just can't put my finger on it. Anyways, here's my crazy Alchemy chart, see what you can make of it:




Wednesday, June 5, 2013

Introduction Post

Beach Biome in my game "Shopkeep"


Game Conecept

In the game you play a traveling salesman and alchemist.  There will be a procedural generated world as well as semi procedural generated items.  One of the main things you'll be doing in this game is wandering the world getting into turn-based battles and searching for herbs, leaves, rocks, or whatever you find interesting and think might be useful in alchemy. You will also be able to catch and train the animals and monsters you fight in a way similar to Pokemon.  In alchemy mode you will use quasi scientific procedures to alter the properties of items to produce new items.  You would then sell these things that you make in your shop to get money to buy more tools in which to make more things to sell or things to aid you in surviving stronger monsters, or for boosting the effectiveness of the monsters that fight for you.


What I'm Working on Now

The first thing I technically worked on was the camera placement and the movement but most of that was code that i'd already written.  The real first thing I started to work on was the procedural generation.  The first aspect of generation was getting a grid of tiles to generate which would later collectively be called a chunk.  After that I learned how to use generic dictionaries to store the chunk index of each chunk (based on its coords) so that appropriate chunks would load as the player reached the end of a chunk.

Each chunk also has an underlying piece of a Perlin noise function whose output is fed to the tiles which is what decides what texture they are (using a Perlin noise function for altitude, and one for rainfall), which is our basic biome generation.  Different biomes have different sets of sprites that spawn in them


What I'll do Next

Now I'm taking a break from world generation and trying to develop an inventory for the player.  I have yet to have an inventory but right now I'm learning how to write table-like data to and from files into some sort of array.  There's also a whole system of alchemy that I'm working out that will be based around actual science, but of course this adds a lot more confusion to everything.