Archive

Archive for October, 2010

XNA 3.1 to 4.0 Conversion – Rendertarget

October 25th, 2010 admin No comments

XNA 3.1 code causes following error when compiled with XNA 4.0:

Error 5 ’Microsoft.Xna.Framework.Graphics.RenderTarget2D’ does not contain a constructor that takes 5 arguments.

XNA 3.1 code:    renderTarget =new RenderTarget2D(device, width, height, 1, device.DisplayMode.Format);

XNA 3.1 had 4 overload versions:

RenderTarget2D.RenderTarget2D(Graphics Device graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format)

RenderTarget2D.RenderTarget2D(Graphics Device graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format, RenderTargetUsage useage)

RenderTarget2D.RenderTarget2D(Graphics Device graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format, MultiSampleType multiSampleType, int multiSampleQuality)

RenderTarget2D.RenderTarget2D(Graphics Device graphicsDevice, int width, int height, int numberLevels, SurfaceFormat format, MultiSampleType multiSampleType, int multiSampleQuality, RenderTargetUsage useage)

In XNA 4.0 this has reduced to:

RenderTarget2D.RenderTarget2D(Graphics Device graphicsDevice, int width, int height)

RenderTarget2D.RenderTarget2D(Graphics Device graphicsDevice, int width, int height, bool mipMap, SurfaceFormat prefferedFormat, DepthFormat prefferedDepthFormat)

RenderTarget2D.RenderTarget2D(Graphics Device graphicsDevice, int width, int height, bool mipMap, SurfaceFormat prefferedFormat, DepthFormat prefferedDepthFormat, int prefferedMultiSampleCount, RenderTargetUsage useage)

The changes to RenderTarget were required as there were too many opportunites to generate errors (eg if you changed the rendertarget but not the depthbufffer) . See Shawn Hargreaves Blog and Shawn Hargreaves Blog for full explanation.

Categories: XNA 4 Tags:

New Page: References

October 22nd, 2010 admin No comments

I created a new page of the books I have used todate. See Referencees tab above. This has essentially been my reading list for past 12 months. There were many other books that I have trawled through but i will only reference those I feel worthy.

Categories: Reference Tags:

Keep in Formation!

October 19th, 2010 admin 1 comment

The individual infantry should maintain their formation as they move. They do maintain position and their own correct individual facing, but the overall formation facing is not correct.

For example the formation should be in the same direction as the movement arrow. Only the lead unit at position D maintains its correct position and orientation in the formation.

The problem was because I was doing a only Matrix.CreateTranslation(unitPosition) * MatrixRotationZ(unitRotation) and was resolved by an additional Matrix.CreateTranslation(formationPosition) .

The formationPosition is based upon unitPosition[0].
Thankyou Scott in Cambridge.

Solution now looks like:

No they are NOT cybermen!

Unit formations showing : Line, Column, Square and Skirmish

Categories: Bugs, Development Screenshots Tags:

Fog and Water Animation

October 14th, 2010 admin No comments

Fog and Water animation now working using HLSL, but will need to return to fog, so that the fog overlaps the fog of war boundary and not cut off at the hex edge. Could also add animation where water breaks on the sure line.

Categories: Development Screenshots, To Do Tags: