Heightmaps and Force Fields

2013/02/23 Leave a comment

Work is proceeding on my space war game (SWG); it would be nice if I came up with a proper name for it but for now SWG shall suffice.  For the past couple of weeks I’ve been looking into missile mechanics and shield simulation.  For the missiles I simulate fuel load and consumption, albeit crudely, such that the missile has a limited flight time before tumbling into a fit of self-destructing acrobatics accompanied by a flash of yellow sparkles.

A work buddy suggested that I tackle force fields next and he had the good idea to use a ripple effect – the same sort of ripple effect you get when you drop a badger into a lake.  There is a very simple algorithm[1] that you can use to produce a variable heightmap for use in a water effect and thought this would be suitable for deforming my shields.

The Update method is called once per frame to update the simulation:

Here’s some shots of the ripple effect:

image

image

…and corresponding textured-mesh view:

image

Then of course I went to apply it to an ellipsoid and I was sort of stumped as to how to deformate a 3D object – something with no edges no less.  Realising I was a bit of a buffoon, the obvious answer was not to procedurally modify the mesh via a heightmap but rather use the heightmap as an input into a parallax shader where we can fiddle with the surface normals thus giving the illusion of heightened depth.  So I kept my code above for creating the heightmap but I just tossed the mesh modification.

I wanted my shader to be transparent so the alpha component is merely the heightmap value.

image

Here is a short video of the outcome.

———————————–
[1] “2D Water”, http://freespace.virgin.net/hugo.elias/graphics/x_water.htm

Categories: SpaceSim Tags: , ,

A Space Game in Unity3D

2013/02/10 Leave a comment

Having moved from XNA to Unity3D I thought I would have a play at making a simple space game.  I thought this would be a good exercise at procedural asteroid fields; AI; missile simulation and nebula effects whilst learning how to use Unity3D;

The following video shows my games work in progress from a few weekends in Unity.

Categories: SpaceSim Tags:

How to disable Messenger Auto-sign-in via Outlook.com

2012/11/27 Leave a comment

I must say I am a big fan of Microsoft’s new web front-end for Hotmail – Outlook.com. The UI is very modern, minimalist and fast!

About the only complaint is that any time you browse to outlook.com via a web browser, it will automatically sign you into MS Messenger.  Though initially this may not be a problem, I find that you can rapidly reach ridiculous numbers of logons even though you may only consciously be using say one browser at home and another at work.  It got so bad that I was even prevented from signing into the desktop Messenger app in Windows Live Essentials.  If only there is a way to prevent automatic login.

Luckily there is.  Jonathan Kay has come up with a rather simple way to block auto sign-in which you can read on his blog.

Categories: News Tags: ,

Autonomous Steering Update for Space Simulator

2012/11/07 3 comments

I recently added a behaviour for steering the ship towards a target destination; thrusting up to cruise speed; followed by a final deceleration step.  With a given velocity and breaking deceleration it’s reasonably easy to work at what point to start breaking.  This makes it nice to enter a point in orbit around a planet or perhaps a space station.

Next will be to work out an actual orbit based on either a given velocity or how far the orbit should be.  Fun days ahead!

Other updates include:

Though floating origin works rather well, the next problem is to scale the planets based on how far away they are.  “float”s don’t have the precision to otherwise model ranges of the distance from say the Sun to Jupiter and then to model Jupiter’s diameter.  It seems the solution is to treat things as continuous sub-scenes.  A topic for another day.

20121104 spacesim

Categories: SpaceSim Tags: ,

Space Simulator Screenshots

2012/10/23 Leave a comment

Here’s some spiffy pics of the simulator thus far:

Bridge

image

image

The Earth with a nice atmosphere effect.  A quick implementation of atmospheric scattering

image

Categories: SpaceSim Tags: , , ,

Space Simulator Rewrite via Unity

2012/10/23 2 comments

I’ve switched to Unity 3D, both a game engine and game development environment for my humble Space Simulator hobby project.  Thus far I’m most impressed with the speed that Unity allows me to realise ideas and focus on what is more important – what the game is about. Far more sensible than spending time in other 3D APIs trying to implement a mini-map which may break in the next release of the API.

Unity’s asset and scene browsers allow you to organise your project logically and visually.  Setting up a scene is an absolute joy as opposed to attempting the same in code.   Files that have been created externally in say Blender, 3ds Max or Photoshop for example do not require subsequent import steps, Unity immediately displays changes.

Unity Pro also comes with some nice features such as:

  • Pro Image Effects including shadows; screen-space ambient occlusion (SSAO); bloom
  • Occlusion culling
  • Extended light-mapping (radiosity)
  • Deferred rendering with unlimited lights
  • HDR
  • A pretty dark-grey theme

I did feel guilty about the idea of using a tool such as this but that was quickly laid to rest.  For instance, we use nHibernate, StructureMap, Entity Framework, ASP.NET MVC and IDE’s such as Visual Studio and Xcode so the concept is not new.

Why re-invent the wheel?

Carrier Command: Gaea Mission Metaphor

2012/10/02 Leave a comment

Playing Carrier Command: Gaea Mission without a functional AI is like buying a scuba tank with a hole in it – sure you can still go diving but it would be nice to not have to return to the surface every 20 seconds or so

Categories: Games Tags: