Making a game

Stigg's picture

So, I might have mentioned it here before, but I am currently enrolled to start my Masters in CompSci. Unfortunately, since I did not take any programming classes at college, I have been unable to getout of the CompSci pre-reqs. So I am currently enrolled in Introduction to Programming with Java. The problem is, I'm a decent programmer, so this class is excruciatingly slow. Since I have to take it, myself and a friend have decided to attempt to make a game using Java. Right now we are working on the backend and will add graphics much later.

So what is this game? We don't really know. But, the basic gist is a world sim. We are trying to do this from a true 'world' perspective. We have a procedurally generated world made up of individual tiles. We have this world generated with realistic temperatures (polar regions are cold, equator regions are hot, high elevations are colder than lower, etc), rivers, ponds, springs, mountains, ground saturation, etc. Right now our world is populated with deer, bison, wolves, grass, and bushes. The vegetation has parameters that determine spawning, such as ground saturation (proximity to water), temperature, and elevation. The vegetation determines the spawn of herbivores (deer and bison) by calculating the general 'calories' each of these animals consume in a 'turn' (currently turns are one season). Once we have the herbivores spawned, we spawn the carnivores (wolf) based on how many calories they consume per turn and the number of herbivores we have present in that region. My buddy just added an omnivore (bear), but I haven't looked at that spawn yet. Currently all of these animals are part of a 'herd' of sorts.

Once these animals are spawned from those parameters, they mate on a regular basis to produce more spawn based on their average gestation rates. (Ex: A deer gets knocked up on turn 1, deer have a gestation rate of ~7 months, so after 3 turns that deer has a baby). Of course, they also eat their required calories per turn of grass, which has its own 'regeneration rate'. Wolves mate and eat just like the deer (no idea what the gestation rate is we have in place for wolves). If an animal can't find food for a few turns, they will migrate to a new region or suffer deaths.

While my buddy was taking care of that side, I worked on the world generator. I made the map via procedural generation. You can specify the corner elevations of the square map, and from there the heightmap is generated randomly. I have a parameter in place to determine how much 'ocean' you want, which will always land within 1%. From there, I placed springs in the mountains and have rivers formed from them down to termination points of either ponds (if the river flow down elevation changes didn't make it to a body of water) or to the oceans. I've created watersheds for each of the low points on the map, then added wind directions following the earth's model for weather. Every point on the map has a calculated ground saturation, which is based on the proximity to water (whether ocean, pond, spring or river). Then I added storms which vary in intensity and location. When it storms, ground saturation for the regions the storm is in increase. Each turn, the weather system moves according to the wind pattern until its intensity drops to 0. If the ground saturation of a tile reaches > 100%, that tile floods. I added rocks to all the mountains, and have some of these rocks contain special ores (gold, iron, copper, tin).

My buddy has been knee-deep in the animal generation, so I have begun work on humans. Humans at map start will spawn in 'very suitable regions', aka fresh water is available (oh, the fresh water comes from the springs and rivers and ponds, while salt water is in the ocean). Since that is the case, then plants and animals will be rampant.

Humans will have a ton of statistics linked to them. They will be very similar to the omnivore animals, but will have skills, inventories, and a whole lot of other stuff linked to what we think of humans. For now though, we are keeping it simple.

I've started creating 'careers'. These careers each have a skill level. Since we are trying to have this be a full world sim, these humans are going to start as hunter/gatherers. The Gatherer 'career' has a few different abilities in it. At skill level 0 (which all humans have) they can simply harvest (read: pick berries). (Note: My friend is implementing berries as I type this). Each time they successfully harvest, there is a chance their skill at Gathering increases. Once this skill reaches X (where X is currently undetermined) then they can create a bowl. This bowl requires either wood or fur (both are harvestable, though wood is harvested from a gatherer and fur is harvested by a hunter). Once they have a bowl in their inventory, they can harvest more goods per turn. (This is simplified quite a bit). As they progress their skill level in Gathering further, they will 'Discover' the idea of planting seeds. This will drastically increase their return on harvesting. Once they reach Y (again, undetermined) skill level, they will discover the career 'Farmer'. Of course, since learning a skill point is low, not every person that gathers their entire life will learn to be a Farmer, and the way its going right now, its going to take many many generations to reach these new careers.

Similarly, hunters will learn things as they do more hunting. Spears, organized hunts, and eventually the career herding.

Crafting will be tied to their skill level in their careers. If you have a skill at hunting of say, 20, you can make a spear. A spear would require 1 Wood and 1 Stone. The wood would be consumed to make the spear, and the stone would not (this is just a wooden spear, no 'spearhead', so the stone is just to carve the tip. Later on, at a higher skill they can craft a spearhead (one stone consumed, one stone not consumed) which can then be added for a better chance at actually killing an animal.

=========== Current spot of development ============

Each/Most of these careers will have a chance to learn a new 'career'. Of course, humans die, so each human will need to have an apprentice to carry on their careers. This will be implemented via family trees. If a Farmer has a child, that child might go directly to farming and get his skill high from the start before the teacher (father/mother) dies. With the increased rate of learning as an apprentice, their skill points will increase faster, giving them a better chance to reach a new career.

So, how do we make this a game? No freaking idea. Our current thought was to have each person have a 'personal goal list' and each civilization have a goal list, where the 'player' can change this goal list. Of course personal goal list would probably be something like: Food, Water, Shelter, Family, Money, etc. But, making this into an actual enjoyable game will be difficult.


tanitha's picture

You need to come sit down with me, have a drink and chat this through.

Stigg's picture

Haha, if only I could!

Chunderpants's picture

You need a brown paper bag. Now sit down and blow into it repeatedly.

Justin's picture

Sounds awesome.

Referring back to your database post. Sorry if this is a bit basic, but a lot of my commercial programming (and a bit of game programming) has been about managing data.

It helps to define the different types of data.

Metadata - data about stuff. Ie DeerGestationDuration = 7
Data - actual data in the world, usually organised as a hierarchy and instantiated. For example you may have a data string you want to store about each deer. So you would have a class of SimpleAnimal, with attributes of Family, Classification,Sex, IsPregnant, HowPregnant, etc (perhaps use standard scientific classification)

Databases allow you to directly address that data outside of the game itself and is usually more useful. As Tan said, using something SQL compliant means you can do things like (bad form, I know) update deer set sex= 'f',Ispregnant='1',HowPregnant='7'; then run the game and watch the wolf banquet.

Same old principles - hardcode as little as possible. Config files (or config table) + data tables. If performance is affected, cache the data tables in memory

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.