• 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

224 Neutral

About Hypostomus

  • Rank
  1. Very good to know. Guess I need to pay a little more attention in the future. Thanks for all the help and quick replies.
  2. I’m sure the answer to this is quite simple; however, it has got me completely baffled. I’m currently writing a Tetris clone in C# using Monogame. I have run into a problem while trying to implement a wall kick for shape rotations. When a shape needs to be rotated, a new temporary shape is created from the original shape and then rotated. This rotated temporary shape is then used to check whether or not the rotation is valid by checking to see if any part of the shape covers any of the non-falling squares on the board or is out of bounds. If either is true, it tries to kick the shape left, if it’s still invalid it kicks it to the right and so on.   The kick operation is performed using a method named TryKick which accepts the temporary rotated shape as a parameter named aRotatedTetrimino. When trying to kick the shape, aRotatedTetrimino is passed by value to a method named CanKick which determines whether or not the shape can be kicked in the direction specified. This is where my problems lie. When aRotatedTetrimino is passed to CanKick, changes that are made to it are being applied in TryKick. I have no idea how this is happening.   Here is the code:   [spoiler] /// <summary> /// Tries to rotate the tetrimino shape. /// </summary> public void RotateTetrimino(List<Square> aNonFallingSquares) { if (!IsRotateOnCooldown()) { List<Square> rotatedTetrimino = GetRotatedTetrimino(); bool rotateSuccessful = false; if (IsRotationValid(rotatedTetrimino, aNonFallingSquares)) { Console.WriteLine("Good Rotation"); rotateSuccessful = true; } else { Console.WriteLine("Bad Rotation Needs Kick"); rotatedTetrimino = TryKick(rotatedTetrimino, aNonFallingSquares, ref rotateSuccessful); } if(rotateSuccessful) { squares = rotatedTetrimino; currentShapeVariaton = IncrementShapeVariation(); timeSinceLastRotate = 0; } timeSinceLastRotate = 0; //Remove when rotatedTetrimino problem fixed. } } /// <summary> /// Tries to kick the tetrimino received in the parameter left, then right, and then down. /// If the kick is valid, sets the successful rotation flag to true and saves and returns /// the kicked shape, otherwise it returns the original tetrimino shape received in the /// parameter. /// </summary> /// <param name="aRotatedTetrimino">Tetrimino to kick.</param> /// <param name="aNonFallingTetrimino">Non falling tetriminos on the gameboard.</param> /// <returns>A tetrimino shape.</returns> public List<Square> TryKick(List<Square> aRotatedTetrimino, List<Square> aNonFallingSquares, ref bool aRotationSuccessful) { Console.WriteLine("Kicking"); if (CanKick(aRotatedTetrimino, aNonFallingSquares, -1.0f, //Left true)) { aRotationSuccessful = true; Console.WriteLine("Kick Left Good"); } else if (CanKick(aRotatedTetrimino, aNonFallingSquares, 1.0f, //Right true)) { aRotationSuccessful = true; Console.WriteLine("Kick Right Good"); } else { aRotationSuccessful = false; } if (aRotationSuccessful) { aRotatedTetrimino = tempSquares; } return aRotatedTetrimino; } /// <summary> /// Tries to kick a tetrimino in the direction specified in the parameter up to two spaces /// and returns the result. /// </summary> /// <param name="aRotatedTetrimino">Tetrimino to kick.</param> /// <param name="aNonFallingTetrimino">Non falling tetriminos on the gameboard.</param> /// <param name="aDirection">Direction to kick (-1=Left/Down, 1=Right/Up)</param> /// <param name="HorizontalKick">Whether to kick horizontally or vertically.</param> /// <returns></returns> public bool CanKick(List<Square> aRotatedTetrimino, List<Square> aNonFallingSquares, float aDirection, bool HorizontalKick) { List<Square> tempRotatedTetrimino = aRotatedTetrimino; bool canKick = false; //Kick up to two times. for (int a = 0; a < 2; a++) { Console.WriteLine("Num of Kicks {0}: {1}", aDirection == 1 ? "Right" : "Left", a); foreach (Square thisFallingSquare in tempRotatedTetrimino) { if (HorizontalKick) { Console.WriteLine("Original X coord: {0}", thisFallingSquare.X); thisFallingSquare.X += (Common.squareSize * aDirection); Console.WriteLine("Kicked X coord: {0}", thisFallingSquare.X); } else { thisFallingSquare.Y += (Common.squareSize * aDirection); } } if (IsRotationValid(tempRotatedTetrimino, aNonFallingSquares)) { tempSquares = tempRotatedTetrimino; canKick = true; break; } else { canKick = false; } } return canKick; } [/spoiler]   Here is the output from a shape trying to be kicked (Important lines in blue):   [spoiler] Bad Rotation Needs Kick Kicking Num of Kicks Left: 0 Original X coord: -40 Kicked X coord: -80 Original X coord: 0 Kicked X coord: -40 Original X coord: 40 Kicked X coord: 0 Original X coord: 40 Kicked X coord: 0 isValid: False Num of Kicks Left: 1 Original X coord: -80 Kicked X coord: -120 Original X coord: -40 Kicked X coord: -80 Original X coord: 0 Kicked X coord: -40 Original X coord: 0 Kicked X coord: -40 isValid: False Num of Kicks Right: 0 Original X coord: -120 Kicked X coord: -80 Original X coord: -80 Kicked X coord: -40 Original X coord: -40 Kicked X coord: 0 Original X coord: -40 Kicked X coord: 0 isValid: False Num of Kicks Right: 1 Original X coord: -80 Kicked X coord: -40 Original X coord: -40 Kicked X coord: 0 Original X coord: 0 Kicked X coord: 40 Original X coord: 0 Kicked X coord: 40 isValid: False [/spoiler]   The way I expect it to work is the first “Original X coord” value after “Num of Kicks Left: 0” and “Num of Kicks Right: 0” should be the same because they are each from their own method calls which should be using the same value for their parameter. However, as the output shows the first “Original X coord” value after “Num of Kicks Right: 0” is the value that was set on the last kick left ("Num of Kicks Left: 1").   What I need to know is why are the changes being applied to the calling method when it is passed by value?  I would be very grateful if somebody could explain this to me.  
  3. Assign a new Vector2 to it with appropriate values like so:   wormBodyPosition[i] = new Vector2((wormBodyPosition[i].X + wormBodyWidth), wormBodyPosition[i].Y);