September 30 – October 2 2012

I figured out the rivers.   Realistic rivers are VERY CPU heavy.  I think I spent 16 hours trying to tweak it.  Until some genius with a lot of time on her/his/its hands figures something better out, I’m dropping reflections out.  Here are the basics:

  • Create a flat surface model.  Say, 2 triangles combined to make a square.  Put it on the ground or where you want your river.  We now have a surface.
  • Create a bunch of normal textures that are slightly different for the surface to use.
  • Create a refraction on that surface to move the pixels around and make it look pretty (some minor CPU power no big deal).
  • Create a completely flipped over version of the computational reality that is being rendered each time the screen refreshes, make it transparent, and place it on the river exactly so that it looks like a reflection as you move around the water with an inverse plane associated with it.
  • Now make two or more of these and watch your frame rate drop significantly and your laptop become very hot.
  • Oh, and your entire river has to be completely flat and even for this to work.

I hate to say it, but I may have to ixnay out part of my “vision” scene.  Or not, because I can make that scene small and independent to be unloaded as soon as its purpose is made.  In any case, reflective water has no place in terrain landscapes for this project.  Same with trees with branches that realistically flow with the wind.  However, it would have a place in small and tightly controlled environments.

I did manage to make a good looking river that I’m happy with.  I learned how to get a list of every object in the Sunburn scene and put them into my own array to play around with as I like.  For instance, I’m going to use this method to split meshes out of the models, remove them, and resubmit them with different attributes.  Why make the whole tree a collision object when the trunk will do.  I want particle effects to swirl around the wrists of the hand, etc.  I also created several components to allow me to attach objects together and do funky cool things with them. I plan on creating components that automatically turn an object into something cool when they are applied to it.

All-in-all, it was one of those long learning sessions where not much was actually done.  Next up:  Getting back to my grid terrain idea.
After that:  Fun with trees and bushes
After that:  Populating the terrain with some grass (mix of models and billboarded meshes)

If you are a Sunburn coder and want to know how to grab all of the objects in the scene let me know and I’ll reply with sample code.

Final Water Style

This is my final water style.  I will change the transparency and color based on the lighting and such but this is the gist.  I’m going to cover up some of the flaws with bridges and such.  I really don’t want to have to mess with the terrain to fix them.

Posted in Game Development | Leave a comment

September 26 – 29 – 2012

After an honest week of focusing on my day job, I was ready to get back to work on my project.

I wish I could have worked on this during the week, but I did get the chance to think about how I wanted to go forward.  One decision I made was to switch everything from forward rendering to deferred.  Sunburn lets you do this rather easily and I’ll put out the easiest way for those technical folks in case someone is wondering how to do it.

First, I changed the content processor for all of my 3D models, content.repo ,and terrains to the deferred version.  For instance, "Model - Sunburn Lighting System" was changed to "Model - Sunburn Deferred Lighting System".  Next, I modified my sceneInterface.CreateDefaultManagers(...) code and changed RenderingSystemType.Forward to .Deferred.  Next I did a mass project find/replace on every USE statement that ended in .Forward to .Deferred.  Finally, I edited my Content.repo file and did a mass find/replace from "LightingSystemModelProcessor" to "DeferredLightingSystemModelProcessor".  After that everything came up.

Done!  If you do a search on deferred rendering, you find that it is one of many new rendering processes.  It lets you put a lot of dynamic lights in your scene.  I also wanted to use it to render water and render textures dynamically with it later on.  From what I’ve read, deferred rendering doesn’t work too well with anti-aliasing, but hopefully Sunburn adopts other methods like FXAA which does.  Or maybe one day I can modify it myself.

Another decision I made was to create a river in my terrain and to see if I can split my terrain up.  I’m pretty sure this is possible because I can create an array of terrains and coordinate them on an x/y system.  In any case, I did some major tweaking of my terrain and created a river base like so.

River with no water

The original terrain looked great, but I couldn’t put more than four textures into one terrain at a time and I wanted a riverbed mapping.  So I simplified it a little bit but I think I kept the overall look.  This will probably be a non-issue when I separate the terrains. That hill needs more hilly textures.

I spent the rest of Saturday researching how to create a river.  Once I get it fully figured out I’ll post a separate blog.  For now, here’s my river.  I’ve been switching back and forth from deferred to forward rendering but I’m still having some trouble getting it to properly reflect and look watery.  Still not too shabby.

Terrain with river take one (or 10 actually)


If anyone comes across this blog and has questions on how I did something feel free to comment and we can start a discussion.

Posted in Game Development | 2 Comments

(September 22 – 25)

I zipped up all of my code, archived it, and created a new Sunburn Professional project. I decided to purchase Sunburn Professional because of the great world editor and the complete programmatic control over everything in that world editor. I may make my own one day, but I’ll probably just keep this and write plugins for it if I can’t get it to do something I want. I ported over most of my classes and modified it to work with my modified Microsoft Game State Management system. I rationalized this cost for a while and then released I officially had an expensive hobby.

I created a new Input class a new camera class with two camera styles. One for follow and one for first-person. Camera follow is going to require some collision detection algorithms so I don’t put it underneath the terrain and outside of buildings when I’m in them. I’m thinking I’ll make the camera an invisible collidable sphere and check the direction it comes from, the direction of the object it hits, and make it stay in that direction and slide it along. I wish I could use it with the Sunburn controllers but I don’t think that will work. I may go deeper into the BEPU physics engine to check it out. I was also able to get a smooth mouse-scroll zoom in and out function so it otherwise looks good and professional.

I scrapped my 3D Model terrain and created a heightmap using a free tool called World Machine Basic. I spent so many hours going through all sorts of terrain generation tools. Remember Sim City’s terrain tool with the basic pull up, push down, and spread options? That’s all I wanted man! The funny thing is that World Machine was the first one I tried, but it was incredibly complicated so I moved on to others. It ended up being the one I ended up with because I realized how powerful it is. I spent almost all of Saturday, Sunday, and Monday after work learning it without coming up for air. Later I decided that if I could do terrain generation for a living I would. I’m an odd one I guess.

I’ll model other things like ledges, big rocks, paths, and roads. If I need a big flat surface I will create a depression in the terrain and overlay a surface model on top of it or see if I can use another tool to modify the heightmap without butchering it.

I also created what’s called a splatmap (or blendmap) for this terrain which is basically a big red/green/blue overlay that goes on top of the terrain. I then opened up my paint program and modified some free textures grass, dirt, and rock textures I found on the internet. I overlaid the grass, dirt, and terrain over its respective color and voila! We have landscape!

Later on after some tweaking

I also spent some time taking pictures of various textures, of trees I want to create models for, of houses, and of the first finished scene I want to make.

Here is the first vision I want to create, sans the fence.  So we shall see how this goes!

Posted in Game Development | 2 Comments

Week 11 (September 14 – 21)

I spent a while figuring out how to plug the Sunburn Framework into my game state management system. Then I tried plugging my camera movement and input classes into Sunburn. Didn’t work so well for the player, but it was great for non player objects that I wanted to move around. I decided to rewrite my movement code and save what I had made for non player objects into a holder class.

Posted in Game Development | Leave a comment

Weeks 9-10 (September 1 – 13)

So Guild Wars 2 game out at the end of August. Did I mention I was a gamer? Yeah so I had to check this out. I also ran into a slew of house projects that my girlfriend was sick of me putting off. I don’t blame her. After running my first Guild Wars 2 instance, which ran for FOUR fricking hours, I decided that it was time to get back to game creation. I also decided that my game would never compel anyone to spend hours of their life to accomplish one minor silly goal.
Good grief.

Posted in Game Development | Leave a comment

Month 2 (August 2012)

I started researching terrain collision detection.  It turns out this is not easy.  I created a class that took the mesh data of models passed through and checked to see if they collided with my player object.  My end result was so bad that I realized it would need some heavy tweaking, smoothing, and so on in order for it to be presentable.  I wanted to release a game sometime this decade, so I researched if there was anything decent available already.  I eventually arrived at the Sunburn Framework which is used with and compatible with a physics engine called “BEPU”.

I also spent much of the month researching alternatives to XNA.  It dawned on me that XNA has been “dead” for about two years and Microsoft isn’t talking about its future.  I spent time learning the ins and outs of engines like OGRE and one promising game engine called Delta Engine.  It looked great and I was willing to order a license.  However, the code hadn’t been updated for quite some time and there was literally no documentation and community support for it.  They had a new version release date of September, but it came and went and the next release date was moved to November.  If I was an experienced game programmer a year into designing and coding 3D games I might have gone for it anyway, but I’m not, so I didn’t!

In any case, the general consensus is that XNA is going to morph into Windows Metro.  It’s also strongly hinted that the community is close to modernizing XNA on its own. I took the chance and decided to keep the project XNA through its entire life regardless of the consequences.

Posted in Game Development | Leave a comment

Month 1 (July, 2012)

I needed to decide on a language.  My initial search on where I should start with that turned up hundreds of other people asking the same question, and almost always getting the same answer.  I will paraphrase a few common responses:  “WHAT A STUPID QUESTION!”  “YOU ARE AN IDIOT!”  “THERE ARE ALREADY OTHER DISCUSSIONS ON THIS *insert broken hyperlinks*!!”  Ok so it’s the internet. Ask any question and you’ll mostly get answers from people who think you are an idiot.  In the end, it came down to C++, C#, or Java.

Java… Java Java Java… I am not your biggest fan.  I use your applications in day-to-day middleware administration and they are slow, clunky, and suck Suck SUCK.  Java sucks!  There I said it.  It’s out there now.  So it really came down to C++ and C#.  C++ looks completely doable for an amateur and has all sorts of support and existing engines.  However, the general consensus I found was that it is time-consuming to get started, but runs faster and gives the programmer more control. I wanted to make something right away!  So I picked C#.  I still think C++ would have been fine, but C# had XNA and that made getting into the thick of things incredibly easy.  I like easy!  I figured I could always go to C++ later on if C# was really that horrible.

I ran through many online tutorials about how to get started with C# and fully decided that XNA was the easiest way to get into it.

Tutorials I ran thorough:

  • Virtually every RB Whitaker tutorial @
  • Riemer’s tutorials about terrain, 3D flightsim, HLSL, and about half of the advanced terrain.  I tabled it to come back later when I needed to get a grip on water.
  • Dozens more tutorials including game state management (of which Microsoft’s version seemed to be an excellent base).

* I found that Microsoft really picked up the ball in their examples and provided some amazing starter code.  Also, XNA comes with a ton of sample templates so I checked those out.  Unfortunately, since Microsoft stopped talking about XNA, there is little to no new activity on the Microsoft sites.

This took roughly the entire month of going through each tutorial, learning C#, and re-learning how to program properly.  It was a boring dragdown slugout to do but I knew that if I didn’t get a good basic foundation of knowledge I would be sorry.

I then created a basic chase camera system and applied it to Riemer’s flight sim tutorial.

 Not exactly what I had, but I had to recreate this from old code that had moved on past the buildings.  Close enough.  The ball shot fireballs at the balloons and blew them up as per the tutorial.  It also rotated correctly like a flying moving dodging ball should.
Posted in Game Development | Leave a comment