Game Update May 6, 2018

I have managed to get a start to my game’s UI off the ground and integrated with wfBase to persist the changes. Here is a quick video of what that looks like:


I spent the last several weeks updating my UI code that I already had spent untold amounts of time creating in the first place. I basically created a set of classes to wrap Unity UI system to allow for creating UI using code. Time will only tell if this was a wise use of time. Regardless, I am very happy that I am finally to the point that I can start concentrating on adding content to the game itself.

I have given a lot of thought on what to work on first. Recently I sent an email to Philharmonia Orchestra to inquire about using their sound samples in my game. I was not sure if my intended uses conflicted with their license, but they graciously responded to my email and let me know that it would be ok to use their sound files. I have some ideas about adding dynamic/interactable instruments to my game. I am looking forward to seeing if I can create what I have imagined in my mind.

Game Update April 16, 2018

My focus over the last week was to start using wfBase to persist game data. I ran into a situation where I needed to key some records off of a string. Without getting into to much detail, I had been working on wfBase’s table class, which is accessed via a numeric id field. WfBase has an index class that can be used for keying off of other data types like the string, but during the refactoring of wfBase, I had been mostly ignoring the index class. It still compiled, but I felt it was likely broken.

I was correct, I had let a few logic bugs creep into the code. I have spent several days trying to bring the index class back up to speed. For the most part, I think I am there. I still need to create some more test to make sure the index system is working as intended, but I am getting good results at the moment.

As part of refactoring the index class, I realized that I was keeping the entire index tree in memory. In my test case of writing a million records with a 50-byte key, the program was using 150mb of memory. I added some code that would flush out the index nodes every 1000 updates. Now the same programs uses only 20mb of memory. I thought that would slow things down, but instead, the code ran a bit faster. When I flush the nodes instead of deleting the nodes I now add them to a node cache to be reused. This turned out to speed things up enough to counteract the slow down of having to periodically reload nodes back into memory.

Since I was already messing about with the code I looked to see if there were any other ways to speed things up a bit. I relized that I was spending a lot of time writing a node back to disk everytime the node was updated. I change the code to delay the writing of the node back to disk. Now I only write the changes when the nodes are flushed, or the index is closed. This change basically doubled the performance of my index class. However, by delaying the write to disk I increased the chance for corruption of the index in situations like an unexpected power outage. To minimize that issue, I added code to check for corruption, and if the index looks to be corrupted I now rebuild it.

The following table shows results for writing, then reading 1 million records. The records I am writing contain 6 fields. Overall I think the test shows respectable results:

Writing 1 million table records with no index: 3.54 seconds
Reading 1 million table records with no index: 2.82 seconds
Writing 1 million table records with 50-byte index: 7.16 seconds
Reading 1 million table records by 50-byte index: 3.37 seconds

I was going to show some comparisons to SQLite, but then I decided not to spend the time learning SQLite enough to create the comparison test. One of the main reasons for creating wfBase in the first place was so that I would have a library for persistent storage that just worked no matter what platform I compiled my code on. WfBase meets that need, and the speed that I am getting is more than fast enough for my needs.

Game Update April 10, 2018

The last update I promised a video. I am a bit late, but here it is:

Wamfish Update April 2018 from John Hamilton on Vimeo.

I have managed to reach a personal milestone with my c# data storage solution that I named “wfBase“. I have finalized the file structure and internal memory structure for the tables. This will allow me to actually start using it to store game data. This has been a big roadblock for game related code that I wanted to work on.

Most of the game content I want to create needs to be dynamic. What I mean by dynamic is I want the player to be able to add content to the game at runtime. Most Unity games the content is baked into Unity’s asset system. Unity’s asset system is read-only at runtime, With dynamic content, you need to be able to update data storage at runtime.

I could have used SQLite or some other such solution for this, and to be honest, that may have been the smart move. The problem is “wfBase” is sort of an itch that I have been trying to scratch for a long time. I have long wanted a c# based general-purpose system for this type of thing, and now I have a good start to that.

You may have noticed I have avoided calling it a database. That is because while it does similar things to a database (store data). This is a much simpler beast, but not without some unique features that make it handy for storing game related data.

Not much else to talk about other than I did add a few video links in the Cat Videos section. Take a look if you have time.

Game Update October 13, 2017

It has been a long time since my last update. I thought I would make a quick post about the status of my project, and also the reasons for the delay:

I am still making progress but at a slower rate over the last several months. I have made a number of updates that would have made good topics for this BLOG, but I was uncertain if I was going to change the direction of my project and I was wary of making a lot of posts that I would need to backtrack from.

I think I have sorted out the issues that had me distracted, and hope that I can get back to a more consistent update process. In a week or two I hope to provide an update with a video that shows off a little of what I am working on. Until then you can enjoy this:

Wamfish World – The New Story

In my previous blog post, I had announced and then I canceled a story line that I had created for my game. I have decided instead to go with a simplified scenario that leaves all the same game elements of the previous story, but with a greatly simplified back story.

When the user starts the game he will be given a screen where he has to login to Westerfield Animatronics server. Once the player clicks the login button, a connection screen will be displayed:

Welcome to Westerfield Animatronics!

We are connecting you to your remote account for Model: Fish-2065

Please wait …

When the connection is established, the user now controls his Animatronic fish and its companion orb. The user receives a constant video feed of what the fish sees, and can also switch to the orb’s camera for viewing. You have complete control over moving your fish about, using a number of different methods of transportation.

Even though the fish is hundreds of thousands of miles from earth, thanks to the quantum communication device that WA invented, you have near instantaneous control and feedback from your fish/orb combo.

Your fish is in a large dome in space, something like a large football stadium. You are paying Westerfield Animatronics large sums of money for the privilege of owning your own world, so what you do with your expensive toy is pretty much up to you.

Now if you are like me, you might be thinking: How do know that Westerfield Animatronics is actually connecting you to a remote world. They could be faking the whole thing by using some fancy computer animation system? Aha!

Wamfish World – Chapter 1

Sadly this will be the first and last chapter of the book. You see I have been working on several story lines for my video game. I had thought I was going to use the below story line, but I ended up changing my mind.

The problem is not so much with Chapter 1, but the back story behind it. You see WAM stood for “We Are Mars”, and our new orb friends have recently blown up Earth. And while Wamfish thinks he is just a fish, WAM actually wired him up to a brain harvested from a dead human. Sort of like a human brain – fish hybrid.

Given that I will be targeting K-6 for at least the educational games, I decided maybe that the back story was going to be a bit much for young kids. I am going a slightly different direction with my game instead.

I would like to thank my author/sister Aretta for her time in helping me edit my first draft. Not wanting to waste the effort that went into creating Chapter 1, here it is for posterity’s sake:

Wamfish World

Chapter 1 – March 1, 2065:

This is a story about a friend of mine. His name is Wamfish.

Seven years ago there was a fish just swimming, along enjoying the sunny day. The water was so warm and crystal clear that the little fish couldn’t help but feel content to be alive on such a beautiful day.

As he swam along, he began to hear a beeping noise in the distance. Being a very curious little fellow, he quickened his strokes and set out to search for what was making the noise.  As his fins quickly moved through the water, the sound became louder and louder.  Just as he reached the location where the sound was almost deafening, it stopped.

The little fish circled around several times, straining to hear the sound that had brought him to this location. He was just about to head in another direction when a loud clanging shook the waters. The sun disappeared and it became pitch dark. The little fish was afraid and knew this was no place for him to be!

He desperately wanted to swim away, but it was so dark he didn’t know which way to go.  His heart began to pound when as the water began making a swooshing sound all around him. The fish could now feel the water rushing past his body.  He was terrified when he tried to turn and swim away, but his attempt was useless.  He was powerless against the strong force that was pulling him further into the darkness. Just when he was certain he would be completely consumed by the force, he popped out of the stream and landed in a small bowl of water.

The little fish swam furiously around trying to figure out where he was. He was trapped! Trapped in a bowl of water. He looked through the thick glass and saw that he was in a room.  He could see two mechanical-like orbs flying around the room.  Although he couldn’t understand what they were saying, he could tell the two orbs were talking to each other.

One of the orbs saw the fish and flew over to investigate. As it looked into the bowl, the fish could see a device on the underside of the orb that moved about and looked like a small flashlight. The orb pointed this device at the fish, and then a bright, red light flashed on which first stunned the little fish and then within seconds he was totally knocked out.

When the fish came to, he noticed the orbs were again moving about the room. Suddenly something odd began to happen.  The fish could see flashing lights and faded images.  He could tell these images were not part of the outside world, it was as if his brain was generating them and then showing them to him outside his bowl

The orbs were still moving about, and talking with each other, but this time, the words were starting to make sense to the fish. He now could understand exactly what they were saying.

“No, no, no!” One of the orbs shouted.

“Yes! It will work,” the other orb said.

“Hey! Can you hear me?” The fish asked loudly.

One of the orbs turned towards the bowl and said, “Hello!”  He then looked at the other orb and said, “See!  I told you it would work.

I don’t understand where I am,” the fish said. “What is this place?”

“Don’t be afraid.  I will help you on your way,” the orb said.

Then the other orb chimed in, “See, I told you.  Useless!”

“No, this is good!  You will see!”

The fish realized there was something very different about himself now. These orbs had obviously done something to him. Somehow they gave him the knowledge he never had before. “Who or rather what are you?” The fish asked as he continued to gaze through the glass of his bowl.

“I am WAM!” said the orb.

“We are WAM!” The other orb corrected.

“What is WAM?” The fish asked, still very confused.

“We are WAM,” the orb said.

“Yes, yes. We are WAM. Busy, busy. Many things to do, must go!” The other orb said as he flew out of sight.

The little fish then wondered who or what he was.  He didn’t seem to know anymore.  “Who am I?”  He asked the remaining orb.  “What is my name?”

“Name?  You do not have a name.”

“Then what am I?”

“You are a fish, but together we are WAM-fish,” the orb said.

“Is that my name?” The fish asked.

“Sure. If you like, I will call you Wamfish.”

“Thank you. I like my name. I am Wamfish!” He said as he swam around the bowl, no longer afraid.  Having a name made him happy.

“You have much to learn, but I am here to help you. Are you ready to get started?”

Wamfish was starting to like his new home, and even though he did not know WAM very well, he was beginning to like him as well.  “Yes, I am ready to learn. Let’s get started!”