Game development

From: Mikee19 Sep 2008 09:23
To: ALL1 of 8
Does anyone here have any experience with 3D game development? Or even C# game development?
From: Chris Cooper (DEATHTERRAPIN)19 Sep 2008 15:55
To: Mikee 2 of 8
I did a fair bit of D3D at uni (got 100% on the games programming module in the second year \o/), and had a play with some OpenGL fairly recently. Never really had any good ideas for an actual game though, so I tend to get bored after making a few fancy graphics thingies.
From: Mikee19 Sep 2008 16:23
To: ALL3 of 8

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 :)

From: Chris Cooper (DEATHTERRAPIN)19 Sep 2008 17:49
To: Mikee 4 of 8
I haven't used XNA myself, but from what I've read it forces you to do things in its own particular ways. If you're not bothered about the xbox360 compatibility then you might want to have a look at SlimDX, its a lower-level d3d wrapper for .net.

Also if you haven't found GameDev.net yet, their forums are pretty helpful.
From: THERE IS NO GOD BUT (RENDLE)20 Sep 2008 09:12
To: Mikee 5 of 8
I can give you some tips on C# which would apply to game development. I had a brief look at the XNA 1.0 beta ages ago and decided life was too short. And 3D maths does my fucking head in.
From: Mikee20 Sep 2008 18:00
To: ALL6 of 8
Ok, here's a question. Maybe someone can answer for me.

I am drawing a plane which will eventually be used as sky. I don't want it to be a flat plane, though, I want to 'pull' the corners down.

Here's what I'm doing to draw the sky..

C# code:
 
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);
        }
    }
}
 
 


Note that QueryForRenderChunks if what the framework calls repeatedly to get a "chunk" to send to the graphics card.


So, this draws me a grid from the vector 'offset' to 'viewDistance' and the size of each square is viewDistance/sqaresize.

How could I pull the corners of the plane down? :/
EDITED: 20 Sep 2008 18:01 by MIKEE
From: Mikee20 Sep 2008 20:09
To: ALL7 of 8
Huzzah.

From: Mikee26 Sep 2008 12:24
To: ALL8 of 8

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 :?