I'm not sure if anybody but automated bots visit this blog, but just in case anyone is reading this, I'm still here! I've started a computer science course at Newcastle University, and I've been learning a lot of interesting things. I've learned a lot about computer architecture, and I've began inventing my own CPU, called the "Simple Architecture Machine" or SAM for short (see what I did there?)
I have a lot to blog about, I'm also working on the next version of 'Create', it's going to be a lot faster paced, there's going to be a cleaner interface, and should be easier to understand what's going on.
I'll upload a video tomorrow with how it's going to work. I'll then explain more of what the gameplay is going to be like.
ZeroXstuff
Wednesday 6 January 2016
Wednesday 19 August 2015
Simulating Rainfall
I have a 72 megapixel height map of Great Britain, however as each pixel needs to be taken into account for the simulation, I'm going to scale that down to 18 megapixels or possibly smaller depending on the speed of the simulation.
I've also grabbed some rainfall data and photoshopped it into several frames, which can be used as the source of rain in the simulation, it's not at all realistic, but it should be interesting to see what happens :)
I will start by breaking up height map into individual cells (with one pixel corresponding to one cell). The cell with have the following properties:
- Absorption potential (i.e. how much water that cell can hold before becoming saturated and surface water starts to accumulate)
- Water level (how much water is actually in this cell)
- Elevation (Each cell will attempt to pass water to cells at a same or lower elevation than itself)
- List of neighbouring cells
- Add Rain (takes a value and adds it to the water level)
- Distribute Rain (simulates the flow of water down hill)
- Get Water Level (returns the value of the current water level)
- Set/Get elevation
- Set number of neighbours
- Connect cell to neighbour
- Get/Set absorption potential
Here is what that all looks like in code:
Next I will have to read in the height map, and create a new cell for each pixel. The algorithm is:
- Open image
- Iterate through each pixel
- For each pixel, create a new cell with the X and Y coordinates of the pixel, and an elevation determined by the pixel colour.
- If the pixel colour is black, set its absorption potential to zero, and its water level to 1000 (black pixels in the height map represent the sea, land is grey, higher land is white)
- After creating all the cells, iterate over all the cells, connecting them with their neighbours
I also created a simulation class, with a method called 'createCells' which implements the above algorithm:
Now to actually start the simulation, I will create another method simply named 'startSimulation' in the Simulation class. The algorithm will be:
- Start at iteration 1
- If the iteration is less than or equal to 7, load the rainfall data image
- Iterate over each pixel of the rainfall data
- If the pixel is completely white, there is no rainfall, proceed to the next pixel
- Add the rainfall amount to the corresponding cell
- After adding all the rainfall data, iterate through each cell and call distributeRain()
- Generate an image of the current water levels and output it
Here is the code:
It was interesting to observe that the water actually drains into valleys and follows the paths of rivers. The resulting image is a bit grainy, but that's partially due to the resolution of the topography data.
Thursday 13 August 2015
Galaxy Generation Algorithm
Today I've been thinking more about the galaxy generation, so I came up with an algorithm and implemented it. Here is how the algorithm works:
- Load a target image of a galaxy
- Divide the image into n by m cells
- For each cell:
- Sum the red, green and blue components of each pixel
- Calculate the average
- Divide by the maximum possible value (255 * width of n * height of m)
- Store this value for this cell -> v
- Calculate the rgb value for this cell with 255 * v
- Generate a certain number of randomly placed pixels with the rgb value found in step 3.5, the number of pixels is a user specified number multiplied by v
- Output image
- Rotate image a fraction of a degree
- Go back to step 1
Here is the result:
Wednesday 12 August 2015
Graphing Progress
I'm working on writing the graphing code, this isn't the first time I've done this, however it does require careful coding as it's so easy to get off by one error with these.
Screenshot:
I will edit and update this post as I progress.
Update:
The graph is now working, however I need to make the game save a history, if something is going to go wrong, it's going to go wrong here.
Screenshot:
I will edit and update this post as I progress.
Update:
The graph is now working, however I need to make the game save a history, if something is going to go wrong, it's going to go wrong here.
Feature Ideas
I just had an idea for something that could possibly be added to the game. I'm wanting to be careful about adding features to the game, because it means more to learn for new players, and could potentially put people off from playing.
The idea is an 'entropy bomb'. Usually once you get the value of an entropy cell from -100 to 0 or greater, the cell becomes active in the game. What I was thinking about was having a small chance that this cell becomes a 'bomb'. It would be set to a random number (within a reasonable range), and it would decrease by one each time any cell on the grid is clicked. If it reaches zero, it destroys a part of your inventory.
It would add a nice challenging element to the game, however getting the balance of this right is important. If it's too easy, it's just an annoying thing hindering the game, if it's too hard, why bother playing if all your hard work is repeatedly destroyed?
I was also thinking of adding a graph screen, where it would simply plot the mass of your universe along with the number of particles against the current level you are on.
Finally, an idea which would have to be implemented much later is to actually be able to place your clusters of galaxies and stars etc. You would then have to find habitable zones, and place all the humans and animals you have created in these zones, you complete the game once they are all safely placed.
What do you think? Please leave a comment or email me at ElderSamKennedy@gmail.com and let me know :)
The idea is an 'entropy bomb'. Usually once you get the value of an entropy cell from -100 to 0 or greater, the cell becomes active in the game. What I was thinking about was having a small chance that this cell becomes a 'bomb'. It would be set to a random number (within a reasonable range), and it would decrease by one each time any cell on the grid is clicked. If it reaches zero, it destroys a part of your inventory.
It would add a nice challenging element to the game, however getting the balance of this right is important. If it's too easy, it's just an annoying thing hindering the game, if it's too hard, why bother playing if all your hard work is repeatedly destroyed?
I was also thinking of adding a graph screen, where it would simply plot the mass of your universe along with the number of particles against the current level you are on.
Finally, an idea which would have to be implemented much later is to actually be able to place your clusters of galaxies and stars etc. You would then have to find habitable zones, and place all the humans and animals you have created in these zones, you complete the game once they are all safely placed.
What do you think? Please leave a comment or email me at ElderSamKennedy@gmail.com and let me know :)
Tuesday 11 August 2015
Nice Numbers: A follow up
I think I've taken up a bigger challenge than I thought when I decided to try and give players of 'Create' a sense of the magnitude of the number they are working with.
I had the idea of representing the numbers using a grid representing the chessboard in the wheat and chessboard problem. I soon realised however that all I was doing was changing the representation of the number into binary, bringing me back to the original problem.
I've been thinking of an analogy to this problem and I think I have it, so bear with me.
Take this sentence for example: "The old man died."
What sort of images and ideas come to your mind?
If I change that sentence to: "The old man was murdered."
What sort of things do you think of then? Probably very different and maybe more violent images.
Now imagine somebody who has never been introduced to the concept of murder, would they have the same images come to their mind? The only reason the word 'murder' carries the weight it does is because of what experiences the reader associates with the word. If the reader has no concept of the word murder, it doesn't matter how you write it or in what language, they will not fully comprehend what you are saying.
It's the same problem with huge numbers. Most of us have an idea of quantities in the millions or billions, which is why I wouldn't have a problem if the numbers in the game were that small. However we rarely, if ever deal with numbers the size in this game. When you convert 10^50 helium atoms to create a star, I don't think any experience you've had before can help you relate to this number.
It makes sense that the only way to adequately describe these numbers is to relate them to something people are already familiar with. If you don't know how much one quadrillion is, it's easily explained as one thousand-trillion. You just take an unfamiliar concept and break it down into two familiar ones: 'Thousand' and 'Trillion'. Maybe the best way to convey the number 10^50 is by the amount of game time required to reach that point?
I had the idea of representing the numbers using a grid representing the chessboard in the wheat and chessboard problem. I soon realised however that all I was doing was changing the representation of the number into binary, bringing me back to the original problem.
I've been thinking of an analogy to this problem and I think I have it, so bear with me.
Take this sentence for example: "The old man died."
What sort of images and ideas come to your mind?
If I change that sentence to: "The old man was murdered."
What sort of things do you think of then? Probably very different and maybe more violent images.
Now imagine somebody who has never been introduced to the concept of murder, would they have the same images come to their mind? The only reason the word 'murder' carries the weight it does is because of what experiences the reader associates with the word. If the reader has no concept of the word murder, it doesn't matter how you write it or in what language, they will not fully comprehend what you are saying.
It's the same problem with huge numbers. Most of us have an idea of quantities in the millions or billions, which is why I wouldn't have a problem if the numbers in the game were that small. However we rarely, if ever deal with numbers the size in this game. When you convert 10^50 helium atoms to create a star, I don't think any experience you've had before can help you relate to this number.
It makes sense that the only way to adequately describe these numbers is to relate them to something people are already familiar with. If you don't know how much one quadrillion is, it's easily explained as one thousand-trillion. You just take an unfamiliar concept and break it down into two familiar ones: 'Thousand' and 'Trillion'. Maybe the best way to convey the number 10^50 is by the amount of game time required to reach that point?
Nice Numbers
Something I've been debating about since yesterday was whether the 'nice numbers' feature is really necessary. Right now numbers such as 24 billion are output as 2.4E10, and while people would be more familiar with the concept of 24 billion than with the standard notation for it, what about numbers like 1.2E24? Would 1.2 Septillion be that much more descriptive?
Most people (including myself) are only familiar with the names of large numbers up to trillion and maybe quadrillion. If I ever worked with numbers above that I would resort to standard notation, so the challenge is, how do I display to the user large numbers, while giving them a sense of the magnitude of the numbers they're working with?
Since this is a universe creation game, it's inevitable that large numbers are going to become a part of the game. I don't want to scare people away from the game who think you need to know a lot about physics or mathematics in order to play the game, so my goal for today is to figure out how to make the game appear more user friendly and less intimidating.
I was thinking maybe something like this:
But then all that's really happening is replacing zeros with boxes, which still doesn't quite transmit the idea of the scale of the numbers very well.
Any ideas? I'm all ears! :)
Most people (including myself) are only familiar with the names of large numbers up to trillion and maybe quadrillion. If I ever worked with numbers above that I would resort to standard notation, so the challenge is, how do I display to the user large numbers, while giving them a sense of the magnitude of the numbers they're working with?
Since this is a universe creation game, it's inevitable that large numbers are going to become a part of the game. I don't want to scare people away from the game who think you need to know a lot about physics or mathematics in order to play the game, so my goal for today is to figure out how to make the game appear more user friendly and less intimidating.
I was thinking maybe something like this:
But then all that's really happening is replacing zeros with boxes, which still doesn't quite transmit the idea of the scale of the numbers very well.
Any ideas? I'm all ears! :)
Subscribe to:
Posts (Atom)