So I haven't told much about my game other than it having epic spells, "living" AI and things to build from items to cities and governing of cities, what I've yet to tell you is that as you, the player, can be mostly anything in the game and I'll try to make it interesting, of course being a peasant can get quite dull after some time but you can always move on from that from a peasant to a dictator having peasants.
What I'll try to achieve in this game is a living world where the npcs can do something big which can change a city by a lot, for example an npc finds a book of undead and decides if he should start reading it or not, if the npc begins reading the said book he will probably change into a necromancer and built a cult somewhere near the city and most likely attack the place after the npc has gained enough power. This might sound big and very scripted, sure there is "scripting" involved but I'll try to make it very random on how it will proceed based on the npc's personality.
There is also a concept of good and evil but its not based on what we declare what is good or evil but
based on the religion of the village, which can change over time, a village might find cannibals saints and people who help others evil.
Speaking of religion the gods of a religion might or might not exist at all depending on how many believes in a god of specific religion, by this way it is possible to make the people of a vast land believe or fear you so much that you might gain divine powers, what you can do with these divine powers I've yet to design but one possibility is creating a new race (which should be easy as everything is random generated), it would also be possible that npcs could disguise them as you or some other god and gain popularity in areas or possibly even overthrow you as their god.
Now you might think that doing all this is impossible or a project that will last for an infinity, you might be right but that's why it's called a seemingly impossible project. All of the things above need careful planning and designing before they can be programmed and I've already began doing all the planning and designing. Most of the world will be simulated in a very high level by using time as the controlling variable, everything important like kings and queens, leaders, necromancers, people you meet, people you love, people you work with are simulated in a low level so they actually do stuff in the game, the more you are involved with an npc the finer the npc is simulated.
Of course that's not all there is to the game as you can do all sort of things from crafting to skinning beasts, you will level up your skills as you do a specific task over and over, for an example if you poke enemies with your dagger enough you will be a master poker and a master in using daggers but you also gain better skill to weapons in the same category of one-handed weapons.
That is all for now, in a moment I'll forget everything and I'll have to read all of this before I can continue working on the game again, but hopefully at some point, at some, most likely a distant year I've finished this project (Seriously though I'll be working on this game every week and most likely everything here that I mentioned might be removed or changed, who knows).
Thursday, March 10, 2016
Wednesday, March 9, 2016
Rivers, streams and more optimizations
I found a way to optimize the noise function I'm using by reversing how I calculate it and without calling it for all the cubes in the same X and Z coordinate in one chunk, but just changing the Y calculation in the end of the noise function. This allowed me to create the heightmap 100 (or something like that) times faster.
Why I began poking around the noise function was because I'm trying to add water to the game but
adding rivers and streams is very hard (at least making it fast enough), so incidentally looking for a way to add rivers via heightmap I found the optimization, although it didn't help me much in adding the rivers. I need to add some sort of flood fill algorithm to the noisemap to add rivers (streams are harder) and modify the values accordingly, though this is quite hard as overflow of the water can happen easily...
I also received new GUI graphics from Samuli which I have to add to the game, but before that I have to reprogram the GUI framework so I can modify the GUI more easily and add more features to it as well, I'll also add support for players to modify the GUI.
Here's also a webm of the trees that I got working in the game, I'm a little worried on how much objects I can actually let the player see before it fries their GPU.
Why I began poking around the noise function was because I'm trying to add water to the game but
adding rivers and streams is very hard (at least making it fast enough), so incidentally looking for a way to add rivers via heightmap I found the optimization, although it didn't help me much in adding the rivers. I need to add some sort of flood fill algorithm to the noisemap to add rivers (streams are harder) and modify the values accordingly, though this is quite hard as overflow of the water can happen easily...
I also received new GUI graphics from Samuli which I have to add to the game, but before that I have to reprogram the GUI framework so I can modify the GUI more easily and add more features to it as well, I'll also add support for players to modify the GUI.
Here's also a webm of the trees that I got working in the game, I'm a little worried on how much objects I can actually let the player see before it fries their GPU.
View post on imgur.com
Saturday, February 20, 2016
Data, so much data...
These past two weeks I've been fixing and creating the saving functionality and adding trees to the game, as I began to add trees to the game, I noticed how much data I have to store and process.
Currently I only store chunks that have been modified by anyone in the game and I'm looking at storing the noisemap, heightmap, treemap and biomemap, currently the problem is storing the treemap, it's easy to store if a certain location in a 2D plane has a tree but if I want to store multiple trees into a certain location, I have to store the height and the type of the tree, of course I could store this data in chunks like.. the chunks, but I could save quite a bit of space if I don't store the type of a tree but just the height but even then it's quite much.
I'm planning on creating a map of a size of 131072 * 131072 * 512 which is quite large (I don't plan on creating an infinite map because there is no point in that), the treemap for multiple trees in a certain spot would be a short type which is 16 bits which in turn is 16 trees upwards, this means that the treemap would be 274877906944 bits which is 34 gigabytes, sure I could compress this to make it smaller but I don't see the point because I plan to have the data ready to be used in the game and compressing and decompressing takes time (Because I plan to have multiple save slots I will compress the whole save to save space), but just as I wrote earlier I will be storing these things in chunks so the game won't eat the whole 34 gigabytes from beginning.
As I don't know how much of the world a player will actually discover I can't really estimate how much space a single game would take, so I'm just trying to plan ahead and try to minimize how much space a save will take.
The cube chunk is stored directly in bytes, int index, float x, float y, float z and then all of the 2048 cubes but only the cube type which is a short, so in total a chunk is 4112 bytes which is around 4 kilobytes.
If you're interested in what I've already done, check the older post to view the list of tasks.
Currently I only store chunks that have been modified by anyone in the game and I'm looking at storing the noisemap, heightmap, treemap and biomemap, currently the problem is storing the treemap, it's easy to store if a certain location in a 2D plane has a tree but if I want to store multiple trees into a certain location, I have to store the height and the type of the tree, of course I could store this data in chunks like.. the chunks, but I could save quite a bit of space if I don't store the type of a tree but just the height but even then it's quite much.
I'm planning on creating a map of a size of 131072 * 131072 * 512 which is quite large (I don't plan on creating an infinite map because there is no point in that), the treemap for multiple trees in a certain spot would be a short type which is 16 bits which in turn is 16 trees upwards, this means that the treemap would be 274877906944 bits which is 34 gigabytes, sure I could compress this to make it smaller but I don't see the point because I plan to have the data ready to be used in the game and compressing and decompressing takes time (Because I plan to have multiple save slots I will compress the whole save to save space), but just as I wrote earlier I will be storing these things in chunks so the game won't eat the whole 34 gigabytes from beginning.
As I don't know how much of the world a player will actually discover I can't really estimate how much space a single game would take, so I'm just trying to plan ahead and try to minimize how much space a save will take.
The cube chunk is stored directly in bytes, int index, float x, float y, float z and then all of the 2048 cubes but only the cube type which is a short, so in total a chunk is 4112 bytes which is around 4 kilobytes.
If you're interested in what I've already done, check the older post to view the list of tasks.
Wednesday, February 3, 2016
Onwards
For now I've finished the basics of cube construction and removal so that the player's character
will move and do the certain tasks. I've also gained more GUI graphics, textures and trees from Samuli which I need to add.
Here are some of the things that I thought of that need to be either fixed or done.
-Fix the mouse raycast to work better, specially to be able to fire upwards. // Fixed and optimized.
-Fix the problem that the character floats when building or removing.
- Fix the movement of the character so it does not get stuck.
-Fix the pathfinding lag when building/removing cubes.
- Fix the issue when using actionpoints in pathfinding that the character is
not able to move to the edge of the map.
-Update the GUI with Samuli's new graphics.
- Refactor map generator and make it so that it can generate much bigger maps.
- Add a timer bar above the character when it's building or removing cube.
- Gain cubes when mining them and use cubes when building.
-Saving and loading of chunks.
-Saving chunk exists check to a file.
-Saving and loading of other map related things and characters.
-Add the trees Samuli made and so that they can be cut down.
-Create tree creator.
- Add iron veins.
- Add crafting (food, potions, equipments).
- Add equipment and items weapons/armor/potions/etc.
-Add graphics for items.
-Add the rest of inventory functionality (dragging items done).
- Add better way to build or remove cubes.
-Add a 3D model for the character.
- Add magic functionality.
- Finish the combat system, so you can dodge/block/etc when an enemy is attacking.
- Add weapon skills.
- Add enemies and neutrals to roam around.
- Make npcs fight each others.
- Add loot and equipment to npcs.
-Add foraging for food.
- Add "fluid simulation"
- Add basic survival gameplay.
- Program so that the character can be seen indoors, possibly by cutting everything above the character and do a sort of reverse frustum culling to the camera so it cuts everything between the character and camera.
- Try to find a way to view stuff inside a house or cave so they don't get cut out (possibly do a some sort of fluid simulation).
- Add interraction with npcs.
-Add water and plants.
- Add caves.
-Possibly recreate the GUI system.
-Add better functionality to the cube creator.
will move and do the certain tasks. I've also gained more GUI graphics, textures and trees from Samuli which I need to add.
Here are some of the things that I thought of that need to be either fixed or done.
-
-
- Fix the movement of the character so it does not get stuck.
-
- Fix the issue when using actionpoints in pathfinding that the character is
not able to move to the edge of the map.
-
- Add a timer bar above the character when it's building or removing cube.
- Gain cubes when mining them and use cubes when building.
-
-
-
-
-
- Add iron veins.
- Add crafting (food, potions, equipments).
- Add equipment and items weapons/armor/potions/etc.
-
-
- Add better way to build or remove cubes.
-
- Add magic functionality.
- Finish the combat system, so you can dodge/block/etc when an enemy is attacking.
- Add weapon skills.
- Add enemies and neutrals to roam around.
- Make npcs fight each others.
- Add loot and equipment to npcs.
-
- Add "fluid simulation"
- Add basic survival gameplay.
- Program so that the character can be seen indoors, possibly by cutting everything above the character and do a sort of reverse frustum culling to the camera so it cuts everything between the character and camera.
- Try to find a way to view stuff inside a house or cave so they don't get cut out (possibly do a some sort of fluid simulation).
- Add interraction with npcs.
-
- Add caves.
-
-
Thursday, January 14, 2016
Work work
I've been currently working on the gameplay so I could present this project to other people and for myself so that I can see if this project is going to work or not, as well as making this an actual game rather than a tech demo.
What I've already done are rather simple things such as basic turn-based combat where the player can move a certain amount and strike the enemy if the player has enough actionpoints, the same thing is done for the AI, it moves closer to the player and attempts to kill the player, it's crude and not finished but it's still something.
Other than that I've been working on spell list and inventory, I've create an item creator from which I can in the future add items with descriptions and other things, this data is then stored in an XML file (I don't really like XML but as it is native to C# it was the quickest way) which a player can modify as well.
I only programmed the item creation so far as I have yet to figure out what I actually need to store into an item but for the moment these are the variables :
int id;
string name;
string description;
string iconSpriteName;
ItemTypes itemType;
int maxStack;
string cubeName;
int cubeIndex;
The ID is self explanatory as is name, description, icon sprite name, max stack and item type, but for the cube name it's actually the cubes ID from which I can get the cubeIndex, the reason why I use cube name as the ID is because as I started creating the cube editor I figured it was all I need, but it dawned on me, it would be easier just to use and actual integer ID like that for the item... So the cube index is gained at runtime with the help of each cube name.
What I've yet to create and finish are the inventory so that a player can pick up items, use and equip them, spells also need to be programmed as I have not yet touched them, I also need to add more tasks for the character so it can shovel/mine cubes and place cubes but this requires the inventory to function and lastly I need to add levels and other statistics for the players character which will increase as the players does something.
I don't know if that was all that I will be adding but I only really want to create the basic structure of the gameplay so I can expand it and modify it if does not work.
There are some things that worry me, like the angle of the projection from which the world is seen from because as I create a pretty big world can it be seen in all it's glory from that angle, is the player satisfied with it? Other thing that worries me is the gameplay if its fun to play but that is an universal problem with every game so I do try not to worry about it.
After I have finished or should I say satisfied with the basic gameplay I will continue on the world generation for a short while to adjust things and maybe add an optimization, the optimization is that I will unwrap every cube's textures into a single large texture so I can combine verticies together, currently all sides of a cube are rendered separately, so if I stack one cube's textures next to each other I can use them like this cube unwrap.
After that I'll move on to programming the first village, I will start by simulating the village in a very high level which would only mean generating resources and expanding the village only by calculating and then continue to a very low level at which I will simulate every characters needs and such.
What I've already done are rather simple things such as basic turn-based combat where the player can move a certain amount and strike the enemy if the player has enough actionpoints, the same thing is done for the AI, it moves closer to the player and attempts to kill the player, it's crude and not finished but it's still something.
Other than that I've been working on spell list and inventory, I've create an item creator from which I can in the future add items with descriptions and other things, this data is then stored in an XML file (I don't really like XML but as it is native to C# it was the quickest way) which a player can modify as well.
I only programmed the item creation so far as I have yet to figure out what I actually need to store into an item but for the moment these are the variables :
int id;
string name;
string description;
string iconSpriteName;
ItemTypes itemType;
int maxStack;
string cubeName;
int cubeIndex;
The ID is self explanatory as is name, description, icon sprite name, max stack and item type, but for the cube name it's actually the cubes ID from which I can get the cubeIndex, the reason why I use cube name as the ID is because as I started creating the cube editor I figured it was all I need, but it dawned on me, it would be easier just to use and actual integer ID like that for the item... So the cube index is gained at runtime with the help of each cube name.
What I've yet to create and finish are the inventory so that a player can pick up items, use and equip them, spells also need to be programmed as I have not yet touched them, I also need to add more tasks for the character so it can shovel/mine cubes and place cubes but this requires the inventory to function and lastly I need to add levels and other statistics for the players character which will increase as the players does something.
I don't know if that was all that I will be adding but I only really want to create the basic structure of the gameplay so I can expand it and modify it if does not work.
There are some things that worry me, like the angle of the projection from which the world is seen from because as I create a pretty big world can it be seen in all it's glory from that angle, is the player satisfied with it? Other thing that worries me is the gameplay if its fun to play but that is an universal problem with every game so I do try not to worry about it.
After I have finished or should I say satisfied with the basic gameplay I will continue on the world generation for a short while to adjust things and maybe add an optimization, the optimization is that I will unwrap every cube's textures into a single large texture so I can combine verticies together, currently all sides of a cube are rendered separately, so if I stack one cube's textures next to each other I can use them like this cube unwrap.
After that I'll move on to programming the first village, I will start by simulating the village in a very high level which would only mean generating resources and expanding the village only by calculating and then continue to a very low level at which I will simulate every characters needs and such.
Sunday, December 20, 2015
The beginning
It's been 2 years since I started this project and I've been developing it on Unity when I have had time, the project itself has been scrapped once, because I changed the world from 2D to 3D just because it was easier to handle everything.
Anyway, for the moment this game is an open world rpg from an isometric angle with a terrain made of cubes like Minecraft.
The project started with a single chunk which had 16x16x8 cubes, why that number? because unity has a limit for verticies on a gameobject, which is 65534 and 16x16x8x20 (20 is the amount of verticies a cube can have) is 40960. With that I created the first chunk
After that I created a cube creator from which I could create new types of cubes and modify settings of the world like biomes.
From there I created a larger landscape with multiple chunks and started using Mathf.PerlinNoise function to create better landscape, however as the perlin noise in unity is 2D noise I needed a 3D noise to actually make decent looking terrain, for that I got help from a friend of mine Kalmomestari and with his help I was able to create a 3D noise function (which is not that fancy).
While at the same time as I continued on the landscape I created a character that could move on the landscape, I wanted to be able to move in real time when outside a battle so I had to create a simple collision detection (which took quite some time as I had some miscalculations in getting a cube with an index). I also added A* pathfinding so you just could click to move (This also took some time because there are no colliders for the chunks or cubes itself so I had to create a custom raycast).
I also began working on the turn-based combat, I created a basic structure for it and some basic commands but postponed it as I wanted to continue on the map creation. At this point I wanted a larger map so I had to do some very basic occlusion culling (not rendering faces of a cube if they are not visible from any direction). I also got help from Samuli Lautjärvi who created some concept art and UI graphics.
I still wanted to have bigger maps but ran to a problem which was memory and not being able to render the whole map anyway as the GPU could not handle it, so I just generated and rendered the map as the player moved while clearing the old meshes.
Note to self, need to add the youtube video here.
Now even if I could view larger maps but in tiny portions I needed to actually see a much bigger landscape, so I started creating a renderer which rendered the map to an image chunk per chunk, this really took some time as there were some problems specially when I wanted to render trees. The cubes were 3x2 pixels (3 width and 2 height) but later changed it to 2x2 pixels as it looked better and more like the cubes in the game. I also removed the perlin noise at this point completely.
Even though I could render the map to an image it din't look that good, but once I added some shading, shadows and colors it looked pretty good.
This is when I changed from 3x2 to 2x2 pixels per cube.
Now that I could render to an image I programmed some more settings to the cube creator as well as biomes which are created from humidity and temperature maps, I also created a tree map from the biome map.
Biomes applied to the renderer.
I also began to test how large of a map I could render before running into problems (the limit was 2048x2048x258 cubes). Note, I had to downsize these to 30% from the original size as it otherwise started slow down the website.
Adding trees followed after which were a huge pain in the ass...
Biomes and trees working now.
And lastly this is the last image I took of the map.
I also made a recording of the process as it renders the map to a picture (this recording is not of the current version and I've sped up the process quite a bit).
After all that I discontinued working on the world creation and began to focus on gameplay and this is when I created this blog.
You can also view all the pictures and more at http://imgur.com/a/osKMZ
Anyway, for the moment this game is an open world rpg from an isometric angle with a terrain made of cubes like Minecraft.
The project started with a single chunk which had 16x16x8 cubes, why that number? because unity has a limit for verticies on a gameobject, which is 65534 and 16x16x8x20 (20 is the amount of verticies a cube can have) is 40960. With that I created the first chunk
After that I created a cube creator from which I could create new types of cubes and modify settings of the world like biomes.
From there I created a larger landscape with multiple chunks and started using Mathf.PerlinNoise function to create better landscape, however as the perlin noise in unity is 2D noise I needed a 3D noise to actually make decent looking terrain, for that I got help from a friend of mine Kalmomestari and with his help I was able to create a 3D noise function (which is not that fancy).
While at the same time as I continued on the landscape I created a character that could move on the landscape, I wanted to be able to move in real time when outside a battle so I had to create a simple collision detection (which took quite some time as I had some miscalculations in getting a cube with an index). I also added A* pathfinding so you just could click to move (This also took some time because there are no colliders for the chunks or cubes itself so I had to create a custom raycast).
I also began working on the turn-based combat, I created a basic structure for it and some basic commands but postponed it as I wanted to continue on the map creation. At this point I wanted a larger map so I had to do some very basic occlusion culling (not rendering faces of a cube if they are not visible from any direction). I also got help from Samuli Lautjärvi who created some concept art and UI graphics.
I still wanted to have bigger maps but ran to a problem which was memory and not being able to render the whole map anyway as the GPU could not handle it, so I just generated and rendered the map as the player moved while clearing the old meshes.
Note to self, need to add the youtube video here.
Now even if I could view larger maps but in tiny portions I needed to actually see a much bigger landscape, so I started creating a renderer which rendered the map to an image chunk per chunk, this really took some time as there were some problems specially when I wanted to render trees. The cubes were 3x2 pixels (3 width and 2 height) but later changed it to 2x2 pixels as it looked better and more like the cubes in the game. I also removed the perlin noise at this point completely.
Even though I could render the map to an image it din't look that good, but once I added some shading, shadows and colors it looked pretty good.
This is when I changed from 3x2 to 2x2 pixels per cube.
Now that I could render to an image I programmed some more settings to the cube creator as well as biomes which are created from humidity and temperature maps, I also created a tree map from the biome map.
| Biome, tree, humidity, temperature maps (in that order) |
Biomes applied to the renderer.
I also began to test how large of a map I could render before running into problems (the limit was 2048x2048x258 cubes). Note, I had to downsize these to 30% from the original size as it otherwise started slow down the website.
Adding trees followed after which were a huge pain in the ass...
And lastly this is the last image I took of the map.
I also made a recording of the process as it renders the map to a picture (this recording is not of the current version and I've sped up the process quite a bit).
After all that I discontinued working on the world creation and began to focus on gameplay and this is when I created this blog.
You can also view all the pictures and more at http://imgur.com/a/osKMZ
Friday, December 18, 2015
By the pressure of others
Hello there, welcome to a place with horribly written text of a seemingly impossible project by a finnish programmer, who just wants to create something cool and games that are fun.
I might at some point tell you, readers, about past projects that I've been involved in, but for now I'll write things about this project and rants. What rants you might be wondering? Well mostly about C#, Unity, games and life (short of).
I've been wanting to play a game in which you can create stuff, has role-playing elements and has less gimmicks than most games these days. I want to have epic magic spells, NPC's with an AI that actually does something instead what it was scripted for and to be able to build houses, villages, cities and to govern them. There is no such game at the moment that has all of these included or if there is the focus on either part is so shallow it gets boring fast. So for this project I am going to focus on turn-based combat, magic, AI and the simulation of a living world.
Games like Minecraft, Crusader Kings II, Stronghold Crusaders, Dwarf Fortress and some other games that escape me for the moment, these games have inspired me to start this project and to keep making games.
And lastly as I mentioned, I'm a programmer, I'm from Finland and I adore games, I work on games for a living as well as when I have free time. As a programmer, I am mostly interested in algorithms, AI and graphics programming.
I might at some point tell you, readers, about past projects that I've been involved in, but for now I'll write things about this project and rants. What rants you might be wondering? Well mostly about C#, Unity, games and life (short of).
I've been wanting to play a game in which you can create stuff, has role-playing elements and has less gimmicks than most games these days. I want to have epic magic spells, NPC's with an AI that actually does something instead what it was scripted for and to be able to build houses, villages, cities and to govern them. There is no such game at the moment that has all of these included or if there is the focus on either part is so shallow it gets boring fast. So for this project I am going to focus on turn-based combat, magic, AI and the simulation of a living world.
Games like Minecraft, Crusader Kings II, Stronghold Crusaders, Dwarf Fortress and some other games that escape me for the moment, these games have inspired me to start this project and to keep making games.
And lastly as I mentioned, I'm a programmer, I'm from Finland and I adore games, I work on games for a living as well as when I have free time. As a programmer, I am mostly interested in algorithms, AI and graphics programming.
Subscribe to:
Posts (Atom)




