Pages

Tuesday, December 27, 2011

Improvements to my game

Hey Everyone,

Just giving an update to the game I've been developing :)

I successfully created a real time map chunk generator that scans nearby isometric chunk coordinates using a C++ map data set. I designed it on the idea of a central chunk with eight surrounding chunks, I then calculate the isometric coordinates from the camera offset and divide it by the chunk size; shifting it into unit chunk space. After detecting a coordinate change, I then recalculate the central and eight surrounding chunks; generating new ones when they are not found in the map and then once everything is generated I store the new set of chunks in memory to make rendering more efficient. During the generation process I shift the sampling rectangle of the Libnoise engine that I use to calculate the tile biomes in respect to the coordinates of the chunks so that the tiles connect seamlessly with the adjacent chunks. After I got the maths working for the generator, I noticed a pause on the generation which I suspected would happen due to the amount of data generated for each chunk. So I decided today would be the day that I finally implement multi-threading into my game; something I've never actually done before, so I researched a few open source and free multi-threading APIs and stumbled upon the OpenThreads API. I linked the API into my engine and managed to get it to work, but it didn't support processor core affinity which I wanted to use so my map generator would run on a different core. The multi-threading worked perfectly and the map would generate without choking the main thread. Later I discovered that the API was outdated and a much improved version had been moved into a project called OpenSceneGraph as a sub project. So I downloaded the new version and sure enough it supported affinity for cores but for some reason whenever I moved around my map, parts of the map would get corrupted and show tiles where they shouldn't have been. I played around and decided to move back to the older version but for some reason I could never make the linker happy again and I couldn't compile the game. After an hour or two I decided to pull all the code I needed from the library and incorporate it directly into my engine so I could finally compile the game again; I cleaned up a lot of the redundant code it had and brought over the affinity system in the new engine so I could set processor affinity with the older version, I fixed a few bugs with the code and cleaned up the thread killing system too. Finally I upgraded the Mutex class to utilise the critical section that the new code uses to lock memory before making changes. Overall I'm very happy with how it turned out and it's working very well.

After the success with the map generator I felt it appropriate to start working on the isometric tile selection system next. It took a lot of searching to find an algorithm that worked with the design of my map structure but I finally stumbled upon This Site that showed how to calculate isometric coordinates from cartesian coordinates and select tiles. The example was based on Java but thanks to the generic nature of maths I could easily bring it over to C++ and see if I could get it to work. It took a few tries and I had to change the maths slightly so that the coordinates conformed to my map structure but I managed to get isometric tile selection working by the end of the day; just a matter of applying the right offsets in respect to the chunk's position and negating the camera's offset and here is the result :)


Now that I have isometric tile selection built into the engine I feel much closer to the game than I had done before and that I've reached a milestone where I can finally begin implementing game play mechanics into the game. Just to prove to myself that the tiles are really interactable with the mouse, I decided to make a hello world for mouse picking and allow the tile type to change when I click with the mouse and as you can see I'm very happy with it:

That's all I have for today :)
Ashton.

Thursday, December 15, 2011

For those who like Programming

Hey Everyone,

For those more interested in the Programming side :)

I've Decided to post about what I've been working on in my spare time, Similarly to my Myst Island being a form of artistic exercise to improve my art skills I decided to work on a game in my spare time to exercise my programming skills.

I wanted to make a game that would incorporate all the fun aspects of RPG's and combine them with open world sandbox type games similar to Minecraft or Haven and Hearth. The engine's foundation has been long in development as I've been improving and expanding it ever since I started programming. I love the Diablo series how it used a 2.5D isometric projection for its artwork so I decided to begin working on my own isometric engine. It's very basic so far but I'm very happy with how it's turning out; I'm using a noise engine combining Perlin, Fractal and Ridged-Multifractal noise patterns overlayed on each other in respect to a height map to generate biomes for my isometric map generator that are built as chunks in real time. The beauty of incorporating noise into a game is that it looks natural, extends to almost infinity, generates thousands of unique patterns with seeds and you don't need to build a map editor on the side.

I'm currently working on the isometric mouse to tile selection system and finalizing the generator so that it's efficient. After those are in place I plan to design and draw some trees, shrubs, rocks and distribute them in respect to their biomes using another form of noise; perhaps Gaussian.

The sandbox aspect of the game will incorporate a fully interactive and dynamic environment that the player explores and collects resources in; you'll be able to chop trees for wood, examine plants and flowers for medicines, food etc. After the basic exploration you can set up shelter from the rain and the wildlife that might attack you. Eventually you will build tools and equipment that will help you obtain a foothold of the land; build walls to keep out bears, build a home with a fireplace to keep you warm and even start a farm for food and materials. During this sandbox game play there will be RPG elements mixed in similar to Diablo where you can go around and attack monsters and gain experience for leveling your character, though I have yet to decide how that system will work. After collecting resources, you'll be able to smith your own armour out of different materials, reinforce it, build weapons to defend yourself and even make potions and enchant your equipment.

Eventually I'll incorporate different weather effects as well as a complete day / night system which is actually almost finished. The map is very rough at the moment since it's all drawn as isometric tiles without any auto tiling to smooth the transitions between the biomes but I've uploaded an image for those who are curious of what it looks like so far:


The engine is founded on the C++ language and is being rendered with OpenGL through the Simple Direct-Media Layer API. I've learned a lot in a small amount of time already and I look forward to developing this game into something I enjoy and hopefully something others enjoy too :)

Thanks for your time,
Ashton.

I'm making Myst Island

Hey Everyone,

This post is about the artistic side of me :)

As a programmer I couldn't live without the ability to express myself with art, even if it's only programmer art but in my case I taught myself how to model in Maya and use Photoshop to work with textures.

For about 2.5 or more years of my spare time I decided to practice my art skills by copying something I loved when I was a kid. One of the games that is close to my heart is the Myst series; I'll never forget that island and the games that followed after in the series. Myst was revolutionary for its time which today would look like child's play with the tools we have at our disposal; it introduced the idea of using CD's for distributing games too. So I decided one day that Myst Island would be my goal and it's come a long way:


I've built most of the Island completely from scratch using the stock photos that I extracted from the CD it came in, but there's a lot to go before it's finished; It's taken so long to convert the 2D images back into 3D surfaces but I feel it was worth it. I've had to reconstruct a lot of the textures by hand using tools like Photoshop and Illustrator and the rest came from free online sources that I still had to make repeatable textures.

Here's a link to my Picasa web album so you can see all the renderings I've done so far of the island, I've even uploaded comparison images to give you an idea.


and my


I hope everyone likes it so far and I plan to continue working on it into the future, there's still a lot to do and polish but all in good time :)

Ashton.

It's the Little Things

Hi again,

This is probably considered a rant, but it might interest some :P

I was playing Skyrim today after a few hours of programming and remembered something that had gone through my mind a lot. Since I have become proficient in computer game programming I've started to notice these tiny little bits and pieces in games where so little thought had gone into them. Its pretty amazing how destructive these small problems can be for immersion and yet need only a few lines of code or less to fix, small issues that can completely pull you out of the immersive feel. I get this itch to open up the game's source code and fix the problem myself, only to remember that the game isn't open source and already compiled into assembly :(

Not surprisingly I feel this way about the computer's operating system too.

I'm very familiar with Bethesda's games having a common set of random crashes and bugs so I'm actually quite comfortable with it; funnelly enough it would probably worry me if the game become stable which seems to be the case after a recent patch and yet the game still has these issues that I would have thought had been fixed by now. Oblivion had the same problem where if you minimize the game it wouldn't re-synchronize the context for the engine when you tried to open the game again, causing it to appear frozen which wasn't the case; I discovered that windows seems a bit more proficient at it for when you open the task manager and force the program to focus, it would re-sync and stabilize again. This solution also fixes a new bug; when the game suddenly begins to choke and lag terribly after a load screen even though it was running smoothly in the last area: just minimize, focus and all is good but sadly there's like a 1 in 5 chance this will crash the game. This bug indicates that there's a missing event in the game's event management not calling the re-focus function.

The save system does make up for that though as it seems really decent when and where it decides to auto save but I do have an OCD for saving once every minute or less. I love the quick save systems that many games have begun to support now days.

/endrant

Many of the things that make games great is the amount of depth that comes from those little subtle details you notice from time to time. Even after hours and hours of game play you still notice the attention to detail and makes you appreciate the game so much more, Skyrim is no stranger to this and overall I love the game and here's hoping the game get better and better once the DLC comes out :)

Ashton.

Welcome to my Blog :)

Hi, My name is Ashton and welcome to my Blog. I finally got around to setting one up so I can share things I've been working on as well as express my thoughts / feelings.

I have a myriad of interests in pretty much every field of science and technology, programming and art. One of my hobbies is electronics; I made my first light bulb turn on when I was about 3 years old and I'm now working with micro controllers: the Arduino to be specific which I just love for its open source background as well as native support for the C/C++ language which I'm familiar with, for anyone doing electronics I highly recommend it.

So far I've only made a few small things with the Arduino but I have much larger plans for the future. The best project I have made with it so far was a GMail aggregator which parsed my email address every 10 minutes and turned a light emitting diode on and off depending on if I had unread mail.

I love to fix things too and solve problems everyday, I never think of throwing something out without taking a chance to see if I can get it to work again but even if I can't I can usually recycle and use what breaks later in my projects.

That's all I can think of for now but I hope you enjoy your stay :)

Ashton.