• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

114 Neutral

About skuhtz

  • Rank
  1. [quote name='LordRhys' timestamp='1354637069' post='5007108'] This is a bit of code obtained from Nick Gravelyn's RPG tutorial which will bounce the player character away from an nc character it collides with, you could possibly make something useful out of it. Sprite is the PC that is moving into s which is the npc, the Origin is the Position + an offset which is where you determine collision points. if (AnimatedSprite.AreColliding(sprite, s)) { // we are assuming that npcs will never move Vector2 d = Vector2.Normalize(s.Origin - sprite.Origin); sprite.Position = s.Position - (d * (sprite.CollisionRadius + s.CollisionRadius)); } [/quote] I modified the code using ideas out of this, but I still can't get it working properly. This is the only thing I've had major problems with and it's so aggravating [img]http://public.gamedev.net//public/style_emoticons/default/blink.png[/img] Although this doesn't work maybe some tips can be salvaged out of this? [CODE] Vector2 direction = Vector2.Normalize(collisionPoint - player1Origin); player1Pos = collisionPoint - (direction * player1Speed); [/CODE]
  2. I've gotten a lot closer with this... still not quite working correctly but I feel like I'm on the right track. I've basically divided the player's ship into 4 quadrants and adjusting the response based on the location of the collision in relation to the quadrants. I'm hitting the sack though, hopefully I can resolve this tomorrow [img]http://public.gamedev.net//public/style_emoticons/default/unsure.png[/img] [CODE] if (fgACollisionP1.X < (player1Pos.X + (player1.Width / 4)) | fgACollisionP1.Y < (player1Pos.Y + (player1.Height / 4))) player1Pos -= Vector2.Normalize(player1Pos - fgACollisionP1) * player1Speed; else if (fgACollisionP1.X > (player1Pos.X + (player1.Width * 0.75f)) | fgACollisionP1.X > (player1Pos.Y + (player1.Height * 0.75f))) player1Pos -= Vector2.Normalize(fgACollisionP1 - player1Pos) * player1Speed; [/CODE]
  3. Thanks for the reply. I couldn't make out anything useful from the code you posted, but what you said before got me thinking a little differently. I revised the code to look like this: [CODE] if (fgACollisionP1.X <= player1Pos.X) player1Pos -= Vector2.Normalize(player1Pos - fgACollisionP1) * shipSpeed; else player1Pos -= Vector2.Normalize(fgACollisionP1 - player1Pos) * shipSpeed; [/CODE] subtracting the collision point from the players position works fine while colliding with the back end of the ship and subtracting the player's position from the collision point works the same as before. The problem though, is when I put them into this if statement the first line doesn't read. I would figure this statement would check to see if the collision takes place to the left or right of the ship? Also, it's not actually a bouncing effect I'm getting, it's the opposite. The angles that aren't working properly actually suck the ship into the image rather than negating the movement.
  4. I've been struggling with this for a while and was determined to figure it out on my own, but I give up. I'm using per pixel collision detection in a scrolling shooter, which works just fine - It's the collision response that I've been struggling with. The bit of code bellow works perfectly fine while colliding with the terrain directly bellow the ship, but in any other direction the collision responds differently. What I'm trying to do with the code bellow is find the coordinates of where the collision takes place, turn that into a direction and then negate the ships movement based on that direction... Or at least I'm pretty sure that's what I'm trying to do. I've been staring at it for too long and it's almost 3am lol. fgACollisionP1 is where the collision takes place. [CODE] Vector2 newPos = player1Pos - fgACollisionP1; player1Pos += Vector2.Normalize(newPos) * 8; [/CODE] Can anyone shed some light on this?
  5. I'm following the book "C# Game Programming for Serious Game Creation" to learn c# and I've hit a wall... I've written Rendering and Sprite classes according to the books direction, but when I run the program nothing is rendering. I've checked for syntax errors and checked my code against the code in the book and even compared it to the code given on the CD bundled with the book. I'm fairly certain all of the needed references are accounted for, I'm really at a loss here x.X Any sort of guidance would be super duper All of this should be the only relevant code... [b]Renderer Class[/b] [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using Tao.OpenGl; namespace GameStructure { public class Renderer { public Renderer() { Gl.glEnable(Gl.GL_TEXTURE_2D); Gl.glEnable(Gl.GL_BLEND); Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA); } public void DrawImmediateModeVertex(Vector position, Color color, Point uvs) { Gl.glColor4f(color.Red, color.Green, color.Blue, color.Alpha); Gl.glTexCoord2f(uvs.X, uvs.Y); Gl.glVertex3d(position.X, position.Y, position.Z); } internal void DrawSprite(Sprite sprite) { Gl.glBegin(Gl.GL_TRIANGLES); { for (int i = 0; i < Sprite.VertexAmount; i++) { Gl.glBindTexture(Gl.GL_TEXTURE_2D, sprite.Texture.Id); DrawImmediateModeVertex( sprite.VertexPositions[i], sprite.VertexColors[i], sprite.VertexUVs[i]); } } Gl.glEnd(); } } }[/code][b] [/b] [b]Sprite Class[/b] [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace GameStructure { public class Sprite { internal const int VertexAmount = 6; Vector[] _vertexPositions = new Vector[VertexAmount]; Color[] _vertexColors = new Color[VertexAmount]; Point[] _vertexUVs = new Point[VertexAmount]; Texture _texture = new Texture(); public Sprite() { InitVertexPositions(new Vector(0, 0, 0), 1, 1); SetColor(new Color(1, 1, 1, 1)); SetUVs(new Point(0, 0), new Point(1, 1)); } public Texture Texture { get { return _texture; } set { _texture = value; // By default the width and height is set // to that of the texture InitVertexPositions(GetCenter(), _texture.Width, _texture.Height); } } public Vector[] VertexPositions { get { return _vertexPositions; } } public Color[] VertexColors { get { return _vertexColors; } } public Point[] VertexUVs { get { return _vertexUVs; } } private Vector GetCenter() { double halfWidth = GetWidth() / 2; double halfHeight = GetHeight() / 2; return new Vector( _vertexPositions[0].X + halfWidth, _vertexPositions[0].Y - halfHeight, _vertexPositions[0].Z); } private void InitVertexPositions(Vector position, double width, double height) { double halfWidth = width / 2; double halfHeight = height / 2; // Clockwise creation of two triangles to make a quad. // TopLeft, TopRight, BottomLeft _vertexPositions[0] = new Vector(position.X - halfWidth, position.Y + halfHeight, position.Z); _vertexPositions[1] = new Vector(position.X + halfWidth, position.Y + halfHeight, position.Z); _vertexPositions[2] = new Vector(position.X - halfWidth, position.Y - halfHeight, position.Z); // TopRight, BottomRight, BottomLeft _vertexPositions[3] = new Vector(position.X + halfWidth, position.Y + halfHeight, position.Z); _vertexPositions[4] = new Vector(position.X + halfWidth, position.Y - halfHeight, position.Z); _vertexPositions[5] = new Vector(position.X - halfWidth, position.Y - halfHeight, position.Z); } public double GetWidth() { // topright - topleft return _vertexPositions[1].X - _vertexPositions[0].X; } public double GetHeight() { // topleft - bottomleft return _vertexPositions[0].Y - _vertexPositions[2].Y; } public void SetWidth(float width) { InitVertexPositions(GetCenter(), width, GetHeight()); } public void SetHeight(float height) { InitVertexPositions(GetCenter(), GetWidth(), height); } public void SetPosition(double x, double y) { SetPosition(new Vector(x, y, 0)); } public void SetPosition(Vector position) { InitVertexPositions(position, GetWidth(), GetHeight()); } public void SetColor(Color color) { for (int i = 0; i < Sprite.VertexAmount; i++) { _vertexColors[i] = color; } } public void SetUVs(Point topLeft, Point bottomRight) { // TopLeft, TopRight, BottomLeft _vertexUVs[0] = topLeft; _vertexUVs[1] = new Point(bottomRight.X, topLeft.Y); _vertexUVs[2] = new Point(topLeft.X, bottomRight.Y); // TopRight, BottomRight, BottomLeft _vertexUVs[3] = new Point(bottomRight.X, topLeft.Y); _vertexUVs[4] = bottomRight; _vertexUVs[5] = new Point(topLeft.X, bottomRight.Y); } } } [/code] [b]Sprite Class Test State[/b] (using this state to test the rendering system) [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using Tao.OpenGl; namespace GameStructure { class TestSpriteClassState : IGameObject { TextureManager _textureManager; Renderer _renderer = new Renderer(); Sprite _testSprite = new Sprite(); Sprite _testSprite2 = new Sprite(); public TestSpriteClassState(TextureManager textureManager) { _textureManager = textureManager; _testSprite.Texture = _textureManager.Get("face_alpha"); _testSprite.SetHeight(256 * 0.5f); _testSprite2.Texture = _textureManager.Get("face_alpha"); _testSprite2.SetPosition(-256, -256); _testSprite2.SetColor(new Color(1, 0, 0, 1)); } public void Render() { Gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); Gl.glClear(Gl.GL_COLOR_BUFFER_BIT); _renderer.DrawSprite(_testSprite); _renderer.DrawSprite(_testSprite2); Gl.glFinish(); } public void Update(double elapsedTime) { } } }[/code]