Jump to content

  • Log In with Google      Sign In   
  • Create Account

Mr. Big

Member Since 02 Apr 2011
Offline Last Active May 02 2013 08:34 PM

Posts I've Made

In Topic: Drawing 2D in 3D World (2.5D)

27 April 2013 - 05:37 AM

Yeah that's basically what i'm looking for. Just the characters/enemies are 2D yet all the surroundings 3D. That video illustrates what I'm trying to do exactly..


Now that I know the terminology for it, I'll take a look around at some resources. Thanks!


Edit: Wow. Looks tricky.. this should be fun...

In Topic: Terrain generation in 3D Tile Based Game

25 April 2013 - 11:50 PM

The plan was to draw a 256x256 map, and have a "portal" somewhere on the map that leads to another map. So loading all the maps when the game loads is out of the question.


My plan was to have a text file for each map with a whole bunch of vertices, followed by objects on the map with a position to draw it at.


map1.map, "Home Town";


"House.obj", 56,0,56;
"Car.obj", 56,0,80;



I have absolutely no idea how XNA loads objects, but this was my thought on how to do it.


Edit: Oh, and didn't need collision detection as I was just going to define each tile as walkable or not-walkable.


Does this sound like a reasonable, efficient way to draw a map?


Edit2: Actually, since the maps will all be 256x256, there's really no point in storing the x and z vertices in a text file since they will all be quads (tiles). The only thing that needs to be stored is the height of each group of 3 vertices. Which I suppose could be done with a height map image?

In Topic: Terrain generation in 3D Tile Based Game

23 April 2013 - 09:53 PM

Ok cheers for the tips. I only chose triangle strip because I thought it was more efficient at drawing triangles. That was what they taught us at university anyway, but that was a long time ago. Haven't really done any game programming since I finished - this is my first foot back in the water.


Are there any tutorials on drawing triangle lists? Or some jumping-in-to-xna guides? I tried following the MSDN tutorials but they seem to miss out key important parts to get things done that a fresh person to XNA wouldn't have any idea about.


Edit: This is what I've come up with so far but its not drawing anything.


using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace RO3

    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
        Matrix worldMatrix;
        Matrix viewMatrix;
        Matrix projectionMatrix;

        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        GraphicsDevice device;
        Effect basicEffect;

        VertexPositionColor[] primitiveList;

        int points = 8;
        short[] triangleListIndices;

        public Game1()
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

        protected override void Initialize()
            graphics.PreferredBackBufferWidth = 1000;
            graphics.PreferredBackBufferHeight = 1000;
            graphics.IsFullScreen = false;
            Window.Title = "RO3";



        protected override void LoadContent()
            device = graphics.GraphicsDevice;
            basicEffect = Content.Load<Effect>("effects");

        private void InitializeTransform()
            worldMatrix = Matrix.CreateTranslation(new Vector3(-1.5f, -0.5f, 0.0f));

            viewMatrix = Matrix.CreateLookAt(
                new Vector3(0.0f, 0.0f, 1.0f),

            projectionMatrix = Matrix.CreateOrthographicOffCenter(
                1.0f, 1000.0f);

        private void InitializeTriangleList()
            primitiveList = new VertexPositionColor[points];

            for (int x = 0; x < points / 2; x++)
                for (int y = 0; y < 2; y++)
                    primitiveList[(x * 2) + y] = new VertexPositionColor(new Vector3(x * 100, y * 100, 0), Color.White);

            triangleListIndices = new short[18] { 0, 1, 2, 2, 1, 3, 2, 3, 4, 4, 3, 5, 4, 5, 6, 6, 5, 7 };

        protected override void UnloadContent()
            // TODO: Unload any non ContentManager content here

        protected override void Update(GameTime gameTime)

        protected override void Draw(GameTime gameTime)

            basicEffect.CurrentTechnique = basicEffect.Techniques["ColoredNoShading"];
            foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)


            RasterizerState rs = new RasterizerState();
            rs.CullMode = CullMode.None;
            device.RasterizerState = rs;

            //drawing code goes after this



        private void DrawTriangleList()
                0,   // vertex buffer offset to add to each element of the index buffer
                8,   // number of vertices to draw
                0,   // first index element to read
                6    // number of primitives to draw