I'm currently playing with making a game in C# using XNA libraries.
It's all a bit complicated. I understand the majority of it, but it's still pretty mindblowing.
I'm not expecting to actually be able to make some amazing huge MMO, but it's what i'm aiming towards as I experiment with stuff (i've got a good idea for a game).
Currently working at trying to generate a sky dome :)
using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using QuickStart; using QuickStart.Graphics; using QuickStart.Physics; namespace QuickStart.Entities { public class SkyPlane : BaseEntity { public VertexBuffer VertexBuffer { get { return this.vertexBuffer; } } private VertexBuffer vertexBuffer; public IndexBuffer IndexBuffer { get { return this.indexBuffer; } } private IndexBuffer indexBuffer; public VertexDeclaration VertexDeclaration { get { return this.vertDeclaration; } } private VertexDeclaration vertDeclaration; public Effect TerrainEffect { get { return this.terrainEffect; } } private Effect terrainEffect; public Material Material { get { return this.material; } } private Material material; private Vector3 offset; private int squaresize = 60; private int[] indices; private int width = 0; private int height = 0; public SkyPlane(QSGame game) : base(game) { this.terrainEffect = game.Content.Load<Effect>("./Effects/Terrain"); this.terrainEffect.CurrentTechnique = terrainEffect.Techniques["MultiTextured"]; this.vertDeclaration = new VertexDeclaration(this.Game.GraphicsDevice, VertexPositionTexture.VertexElements); } public void Initialize(Vector3 offset, float viewDistance) { this.width = (int) viewDistance / this.squaresize; this.height = (int) viewDistance / this.squaresize; this.offset = offset; CreateVertexBuffer(); CreateIndexBuffer(); this.material = this.Game.Content.Load<Material>("Material/Terrain"); } public void CreateVertexBuffer() { vertexBuffer = new VertexBuffer(this.Game.GraphicsDevice, typeof(VertexPositionTexture), width * height, BufferUsage.WriteOnly); VertexPositionTexture[] vertices = new VertexPositionTexture[width * height]; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { vertices[x + y * width].Position = new Vector3((x * this.squaresize), 0, (y * this.squaresize)) + this.offset; } } vertexBuffer.SetData(vertices); } public void CreateIndexBuffer() { int numberOfIndexes = (width - 1) * (height - 1) * 6; indexBuffer = new IndexBuffer(this.Game.GraphicsDevice, typeof(int), numberOfIndexes, BufferUsage.WriteOnly); int counter = 0; indices = new int[numberOfIndexes]; for (int y = 0; y < height - 1; y++) { for (int x = 0; x < width - 1; x++) { int lowerLeft = x + y * width; int lowerRight = (x + 1) + y * width; int topLeft = x + (y + 1) * width; int topRight = (x + 1) + (y + 1) * width; indices[counter++] = topLeft; indices[counter++] = lowerRight; indices[counter++] = lowerLeft; indices[counter++] = topLeft; indices[counter++] = topRight; indices[counter++] = lowerRight; } } indexBuffer.SetData(indices); } public override void QueryForRenderChunks(ref RenderPassDesc desc) { RenderChunk chunk = this.Game.Graphics.AllocateRenderChunk(); chunk.Indices = indexBuffer; chunk.VertexStreams.Add(vertexBuffer); chunk.Declaration = vertDeclaration; chunk.WorldTransform = Matrix.Identity; chunk.VertexCount = width * height; chunk.StartIndex = 0; chunk.VertexStreamOffset = 0; chunk.PrimitiveCount = indices.Length / 3; chunk.Material = this.material; chunk.Type = PrimitiveType.TriangleList; base.QueryForRenderChunks(ref desc); } } }
I'm gonna have a play with "axiom" (an Ogre port) and Mogre (an Ogre wrapper).
Decided I can't be arsed with getting things to work on an xbox anymore, and for PC only development Ogre seems a lot more established than any XNA framework out there.
On a side note, I finally understand things a bit better :) I can do vertex and pixel shaders and I can make a skydome with clouds and sunset/rise and stars and whatnot :)
Now i've just gotta make the game :?