Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 10 Jul 2011
Offline Last Active Nov 08 2014 08:42 PM

#5179191 Online Computer Science degree

Posted by on 09 September 2014 - 05:08 PM

I looked at a college earlier and decided that a tech school or trade school is the way for me to go! Less general ed classes and more focus on what I want to learn

#5145504 Assigning parameters of a struct

Posted by on 08 April 2014 - 05:30 PM

This is a pretty simple question, but I havent used c# in a while so I'm a bit rusty.

 struct Voxel
            Vector3 Position;
            enum VoxelType
                air = 0,
                grass = 1

This is how I'm going to create the voxel data structure.

for (int x = 0; x < CHUNKSIZE; x++)
                for (int y = 0; y < CHUNKSIZE; y++)
                    for (int z = 0; z < CHUNKSIZE; z++)
                        ChunkArray[x, y, z] = new Voxel();

I populate my ChunkArray with voxel structures. My question is, how do I set the Voxel Position variable using the x, y, and z variables?

Voxel[,,] ChunkArray = new Voxel[32, 32, 32];


I think I solved my problem...

                        ChunkArray[x, y, z] = new Voxel
                            Position = new Vector3(x, y, z),

#5097477 How to get motivated to learn Programming?

Posted by on 28 September 2013 - 12:57 PM

In order to stay motivated, you need to see results of the work you're doing. Type up some code in your language, and then mess around with it until you fully understand what's going on.

rbwhitaker has a wiki for c#. Since you already have some experience, you should be able to fly through them. I used those tutorials coming from java. If programming games is your goal, then take some time to learn about the different libraries available to you when you're not feeling motivated to program. xna is my first choice, but there are many others options out there.

I don't have Skype because i don't have internet right now, but feel free to pm me if you need help. Helping others is the best way to learn

#5078489 Unity vs XNA

Posted by on 17 July 2013 - 11:39 AM

You'd probably need some kind of AI scripting for that. There's also pirating if you're not above that dry.png but for the record I'm not endorsing it. Only the pro version supports path-finding through meshes...Unless I'm understanding that wrong and you can still use AI scripting

#5078485 Unity vs XNA

Posted by on 17 July 2013 - 11:17 AM

Depends on what type of game you want to make. See this link for a comparison:http://unity3d.com/unity/licenses

#5078449 Unity vs XNA

Posted by on 17 July 2013 - 08:52 AM

I'm more of a programmer myself, and you don't really learn much from dragging and dropping objects onto a map. In my opinion, taking the extra month or two to program a map editor is worth it just for the learning experience. My first games were made with programs like GameMaker and RPGMaker, and after making a few with those you realize that there is so much more you can do if you can just modify the code yourself. Using a game making tool sets boundaries, but if you code the whole thing yourself, you can theoretically do anything

#5078443 Unity vs XNA

Posted by on 17 July 2013 - 08:24 AM

I've tried it. Although with unity you see results faster, it's nothing compared to coding everything yourself. XNA makes everything really simple so the results you see will still be faster than something like DirectX or OpenGL

#5078227 XNA questions part 2

Posted by on 16 July 2013 - 01:49 PM

Here comes some more easy to answer questions that don't really need their own thread. 


1) While creating a multiplayer game, I know I can use xna for part of it. But for usernames and information like that, would I need to use SQL and set up a server to host games?


2) Imagine you're looking at stairs from the side:


   _ |



In order to make my player move up the stairs without jumping, would I need to implement octrees into my cube creation?


3)Will HLSL be able to handle effects like creating a beam of light shining onto a player's position from a dark sky, or sparks like the wisps in Warcraft 3?


4)My AI in my game will be simple, much like League of Legends. You will be able to set a spawn point and with a click of a button you can send your troops to attack an enemy wall or tower. If your troops come into range of any other troops or the enemy's structures, they attack. What kind of AI scripting would I need for something simple like this?


Thanks again in advance :)

#5077678 Texture drawing wrong on cubes

Posted by on 14 July 2013 - 02:21 PM

Ohhh woops. I was drawing the face from the bottom left corner going clockwise. Maybe thats the issue there. I did have to draw a cube and label the corners which helped a lot lol




That link says that each cube needs 36 vertices...Doesn't make sense to me though if I'm using indices?

#5077589 No values being added to list

Posted by on 14 July 2013 - 08:47 AM

Oh wow I forgot to call my CreateMap method in my Load Content. Never mind

#5073522 Occlusion culling

Posted by on 28 June 2013 - 02:07 AM

I have an understanding of how occlusion culling works, but I'm not sure how to implement it into my class. 

There are two ways I'm thinking about doing it. Either creating a method that I call from my constructor that checks if a cube has an adjacent cube to another cube, or looping through my list of cubes and changing the vertices/indices then. 

I think my first option would be easiest, so that each cube is automatically checked for adjacent sides when being created. But I have nothing to loop through or check if no list is created.

My cube contains 8 vertices and 36 indices, and the list that stores them stores the position, orientation, and a texture. 

Does anyone have some pseudocode they can provide me in order to get me started? I'm not sure how to check whether one side of the cube is hitting a side of another.


Either I can add code to my for loop:

for (int x = 0; x < mapHeight; x++)
                for (int z = 0; z < mapWidth; z++)
                    //check for adjacent faces here
                    cubes.Add(new Vector3(x, map[x, z], z), Matrix.Identity, grass);

Or create a new method entirely. But in order for these to work, I need to get adjacent faces first

#5069900 Creating and moving a third person camera

Posted by on 14 June 2013 - 10:47 PM

I have a player class and camera class. I want my model to move and the camera to follow it. Simple enough, but when I move my model it decides to fly off the screen and then stops somewhere far in the distance, and then moves up and down on the Y axis. I'm not exactly sure where I went wrong with this one. The camera also doesn't move either, but that's not as much of an issue right now.

class Player
        Model playerModel;
        public Matrix playerWorld;
        Matrix[] playerTransforms;

        public float speed = 2f;
        public float rotationRate = 0.3f;

        public Vector3 Position { get; set; }
        public float RotationX { get; set; }
        public float RotationY { get; set; }
        public float Scale { get; set; }

        public Player()
            playerWorld = Matrix.CreateScale(.1f);
            this.Position = new Vector3(0, 1f, 0);

        public void LoadContent(ContentManager content)
            playerModel = content.Load<Model>("p1_wedge");
            playerTransforms = new Matrix[playerModel.Bones.Count];

        public void Update(float dt)
            KeyboardState kbs = Keyboard.GetState();

            if (kbs.IsKeyDown(Keys.W))
                playerWorld += Matrix.CreateTranslation(Vector3.Forward * speed  * dt);

            if (kbs.IsKeyDown(Keys.S))
                playerWorld += Matrix.CreateTranslation(playerWorld.Backward * speed * dt);

            if (kbs.IsKeyDown(Keys.A))
                Vector3 temp = playerWorld.Translation;
                playerWorld.Translation = Vector3.Zero;
                playerWorld += Matrix.CreateRotationY(rotationRate * dt);
                playerWorld.Translation = temp;

            if (kbs.IsKeyDown(Keys.D))
                Vector3 temp = playerWorld.Translation;
                playerWorld.Translation = Vector3.Zero;
                playerWorld += Matrix.CreateRotationY(-rotationRate * dt);
                playerWorld.Translation = temp;

        public void Render(ThirdPersonCam cam)
            foreach (ModelMesh mesh in playerModel.Meshes)
                foreach (BasicEffect effect in mesh.Effects)
                    effect.View = cam.view;
                    effect.Projection = cam.proj;
                    effect.World = playerTransforms[mesh.ParentBone.Index] * playerWorld;

That's the player class. The error lies within the draw or update method, but I'm not sure what I'm looking for. When I press "w" it seems like the model moves behind me at first. 

public class ThirdPersonCam
        public Matrix view;
        public Matrix proj;

        public ThirdPersonCam()
            proj = Matrix.CreatePerspectiveFieldOfView(0.78f, 1.7777f, 1f, 10000f);

        public void CameraUpdate(Matrix objectToFollow)
            Vector3 camPosition = objectToFollow.Translation + (objectToFollow.Backward * 10f) + (objectToFollow.Up * 15f) + (objectToFollow.Left * 1f);
            Vector3 camTarget = objectToFollow.Translation;

            view = Matrix.CreateLookAt(camPosition, camTarget, Vector3.Up);

There's the camera class. This doesn't work either, as I have called the CameraUpdate method in my main game class and the camera doesn't move at all. The camera is following the player.playerWorld matrix when I call it.

#5060188 XNA Code Help - Drawing Collision Rectangle

Posted by on 07 May 2013 - 11:20 PM

Rectangle shipBounds = new Rectangle((int)ship.shipPos.X, (int)ship.shipPos.Y, shipSprite.Width, shipSprite.Height);


code from my game. Pretty much you just create a rectangle object with the same dimensions as your sprite


for (int x = bulletBounds.Count - 1; x > -1; x-- )
                for (int y = alienBounds.Count - 1; y > -1; y--)
                    if (bulletBounds[x].Intersects(alienBounds[y]))


This is my collision method. bulletBounds and alienBounds are both rectangle arrays. You can see how Intersects works also

#4995259 different way of learning

Posted by on 29 October 2012 - 08:11 PM

thanks. those are the kinds of things that help me learn. books dont really explain that

#4995257 different way of learning

Posted by on 29 October 2012 - 08:06 PM

alright i made this from scratch, but the paddles dont move. anyone know whats wrong?

[source lang="csharp"] protected override void Initialize() { // TODO: Add your initialization logic here KeyboardState state = Keyboard.GetState(); if (state.IsKeyDown(Keys.Up)) { paddle1Pos.Y -= 3; } if (state.IsKeyDown(Keys.Down)) { paddle1Pos.Y += 3; } base.Initialize(); } /// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here ball = Content.Load<Texture2D>("ball"); paddle = Content.Load<Texture2D>("paddle"); } /// <summary> /// UnloadContent will be called once per game and is the place to unload /// all content. /// </summary> protected override void UnloadContent() { // TODO: Unload any non ContentManager content here } /// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { int minY = 0; int minX = 0; int maxY = 600 - ball.Height; int maxX = 1000 - ball.Width; // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); // TODO: Add your update logic here ballPos += ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; if (ballPos.X > maxX) { ballPos.X = maxX; ballSpeed.X *= -1; } if (ballPos.X < minX) { ballSpeed.X *= -1; ballPos.X = minX; } if (ballPos.Y < minY) { ballPos.Y = minY; ballSpeed.Y *= -1; } if (ballPos.Y > maxY) { ballPos.Y = maxY; ballSpeed.Y *= -1; } Rectangle paddle1Rect = new Rectangle((int)paddle1Pos.X, (int)paddle1Pos.Y, paddle.Width, paddle.Height); Rectangle ballRect = new Rectangle((int)ballPos.X, (int)ballPos.Y, ball.Width, ball.Height); if (ballRect.Intersects(paddle1Rect)) { ballSpeed *= -1; } base.Update(gameTime); } /// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.White); // TODO: Add your drawing code here spriteBatch.Begin(); spriteBatch.Draw(paddle, paddle1Pos, Color.White); spriteBatch.Draw(ball, ballPos, Color.White); spriteBatch.End(); base.Draw(gameTime); } }}[/source]