• 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

117 Neutral

About Oyed

  • Rank
  1.   Thank you for your input - I will look in to this!
  2.   I am not, no - but after some google'ing I found this library https://github.com/jriecken/sat-js   Is it worth me implementing my own methods to do this, or using the library? If it's using the library, how can I implement that in to my current loop? I'm a bit confused as to finding out which direction etc. for fixing the collision.   Thanks!
  3.   I think for a Top-Down 2D game made in JavaScript with only rectangles this is a bit of overkill; I wouldn't even know where to start with it.   I just need a base, something simple that actually works. I've been looking at my current system for a long time now and just keep on doing things wrong. As long as the player doesn't collide with the other rectangles and can correct it's position, that's fine.   Thanks
  4.   Could you elaborate please? I'm pretty new to this. Thanks!
  5. Hello there,   I'm developing a HTML5 Canvas Game and am having issues with the method I've taken for collision detection. I can find and retrieve a Tile Object in my Game based on an X and Y position, which led me to believe generating "points" on Entity Sprites and checking each of them for a collision was the best way to go about it. I've had a lot of issues with this and don't really know what else to do.   The points generated on my character look like this when visualised:     Each side of the sprite has points generated for it specifically so I can tell which direction the solid tile is. In the update loop the tiles under each point are fetched and checked for if they are solid, and if they are, it prevents movement in that direction. The problem I'm facing is that when walking left + up in to a wall to the left of the player, the top and bottom collision points are also being triggered due to them being relative to the players position and having the X velocity applied to them before checking.   I can't figure out a way to solve this; below is the code I'm using to generate the points, check them and also correct the X & Y positions of the player.   Generating Points function: generatePoints: function(config) { var points = [], scale = Engine.config('GLOBAL_GRAPHICS_SCALE'), halfTile = (config.tileWidth / 2) * scale, tilesWidth = Math.ceil(config.spritesheet.getWidth() / (config.tileWidth / 2)), tilesHeight = Math.ceil(config.spritesheet.getHeight() / (config.tileWidth / 2)), x = config.x, y = config.y, yOffset = 0, xOffset = 0, directions = config.directions, xVelocity = config.xVelocity, yVelocity = config.yVelocity; for(var h = 0; h <= tilesHeight; h++) { yOffset = ((h == 0) ? 1 : ((h >= tilesHeight) ? -1 : 0)); /* Left Side */ if(directions.left) points.push([ (x + xVelocity), (y + yVelocity) + (h * halfTile) + yOffset, 0 ]); /* Right Side */ if(directions.right) points.push([ (x + xVelocity) + (tilesWidth * halfTile), (y + yVelocity) + (h * halfTile) + yOffset, 1 ]); } for(var w = 0; w <= tilesWidth; w++) { xOffset = ((w == 0) ? 1 : ((w >= tilesWidth) ? -1 : 0)); /* Top */ if(directions.up) points.push([ (x + xVelocity) + (w * halfTile) + xOffset, (y + yVelocity), 2 ]); /* Bottom */ if(directions.down) points.push([ (x + xVelocity) + (w * halfTile) + xOffset, (y + yVelocity) + (tilesHeight * halfTile), 3 ]); } this._points = this._points.concat(points); return points; }, Looping through and checking the points function: checkPointCollision: function(points) { var tile = null, dir = null, solid = false, tempX = 0, tempY = 0, tileWidth = Engine.manager('map').getActive().getTileWidth(), collision = { left: { move: true, x: 0, y: 0 }, right: { move: true, x: 0, y: 0 }, up: { move: true, x: 0, y: 0 }, down: { move: true, x: 0, y: 0 } }; for(var p = 0; p < points.length; p++) { // For all the generated checking points... solid = false; dir = points[p][2]; tile = Engine.manager('map').getActive().findTile(points[p][0], points[p][1]); if(Array.isArray(tile)) { for(var t = 0; t < tile.length; t++) { if(tile[t] != null && tile[t].isSolid()) { solid = true; break; } } }else if(tile != null) { solid = tile.isSolid(); } if(solid) { // If this Tile is Solid... tempX = points[p][0] - (points[p][0] % tileWidth); tempY = points[p][1] - (points[p][1] % tileWidth); switch(dir) { // Switch based on the Tile's direction case 0: // Left collision.left.move = false; collision.left.x = tempX; collision.left.y = tempY; break; case 1: // Right collision.right.move = false; collision.right.x = tempX; collision.right.y = tempY; break; case 2: // Up collision.up.move = false; collision.up.x = tempX; collision.up.y = tempY; break; case 3: // Down collision.down.move = false; collision.down.x = tempX; collision.down.y = tempY; break; } } } return collision; }, And altogether now (Called in the update loop): /* Begin checking Collisions */ while(checkCollision) { var points = this.generatePoints({ x: x, y: y, xVelocity: xVelocity, yVelocity: yVelocity, tileWidth: tileWidth, spritesheet: spritesheet, directions: directions }), collision = this.checkPointCollision(points), hasCollision = false; if(!collision.up.move) { yVelocity = -((y - collision.up.y) - tileWidth); hasCollision = true; } if(!collision.down.move) { yVelocity = (collision.down.y - (spritesheet.getHeight() * scale)) - y; hasCollision = true; } if(!collision.left.move) { xVelocity = 0; hasCollision = true; } if(!collision.right.move) { xVelocity = 0; hasCollision = true; } cycle++; if(!hasCollision || cycle >= maxCycle) checkCollision = false; } /* End checking Collisions */ Variables should (hopefully) be self explanatory, feel free to ask for any information, any help is appreciated, thank you in advance!
  6.   If you look at the image, the top and bottom 3 points are above and below the left and right points, so when standing on a solid tile the left and right points are 1 pixel above the surface and aren't triggered.     This is exactly what I do - but collision for both Left, Right and Down is triggered when the player hits the floor after falling due to checking for collision on all sides and correcting as such, so they loose their X Velocity even if they're just hitting the ground.
  7. Hey there,   I'm pretty new to Game Development and am just learning mostly theory and simple physics by developing a HTML5 Canvas Game before moving on to other languages (Being a Web Developer all I had to learn was the Canvas API).   I'm having some issues with my Collision Detection/Correction. To put it simply, here is a run down of what happens to the Player Entity in every loop:   Apply the physics to a temporary X and Y Co-ordinates to find the new position of the Player (E.g. Friction and Gravity) Generate points around the sprite to check for collisions and assign them directions (Which allows for collision correction based on the direction of the collision) Loop through each of the points, find the Tile each point is on and check whether it is solid. If it is, mark that direction (The direction linked to the point, that I created earlier) as solid. After checking all of the points, only apply the physics to X and/or Y if no collision is detected for that direction. The issue is, that when it's finished checking for collisions, if the player is falling the collision for Left and Right will be triggered, as well as Down. This is because it doesn't order collisions; or limit it to just one collision per loop. Here is a "pseudo-code" version of the loop: LOOP tempX = x tempY = y IF up_arrow IS pressed THEN IF NOT jumping AND grounded THEN jumping = TRUE grounded = FALSE yVelocity = -(speed / 2) * 2 // Ignore division and then multiplication by 2, as I'll be using one as a modifier END IF END IF IF left_arrow IS pressed THEN IF xVelocity < speed THEN xVelocity++ END IF END IF IF right_arrow IS pressed THEN IF xVelocity > -speed THEN xVelocity-- END IF END IF xVelocity *= friction yVelocity += gravity grounded = false // COLLISION POINT GENERATION - See below moveLeft = true moveRight = true moveDown = true moveUp = true FOREACH points AS p thisTile = findTile(p.x, p.y) // Gets the Tile instance for the given co-ords thisSolid = thisTile.isSolid() IF thisSolid THEN SWITCH p.direction CASE 0 // Left moveLeft = false BREAK CASE 1 // Right moveRight = false BREAK CASE 2 // Up moveUp = false BREAK CASE 3 // Down moveDown = false BREAK END SWITCH END IF END FOREACH IF !moveDown THEN yVelocity = 0 jumping = false grounded = true END IF IF !moveLeft OR !moveRight THEN xVelocity = 0 jumping = false END IF IF grounded THEN yVelocity = 0 END IF x += xVelocity y += yVelocity END LOOP Collision Point Generation:   In order to check for collisions around the player, the sprite is used to calculate points in which to check for collisions. The points is generates look like this:   http://uploadir.com/u/7ns2jvm0   Each point has a Direction value so that the collision can be corrected based on that. Each point is also generated using a tempX and tempY value, which are just temporary variables which will have the players velocities applied to them before point generation, and then the point generation will use these values.   So, even if the player falls a long distance and hits the floor, because the new X and Y values it uses are un a tile, the Left and Right points are also in the floor tiles and trigger a collision.   I have no idea how to get around this; so any help is greatly appreciated!
  8. Hello there,   I know you probably hear this a lot, but I'm just starting out really in Games Development and I'd like to start out in C++ Game Development.   I'm not a programming amateur, I'm mainly a Web-based Programmer (JavaScript, HTML, CSS, PHP), but I also know Java and a bit of C++.   My problem is not knowing where to start. I've read a lot and researched Game Development methods and how they work etc., and even made a Game Engine in HTML5 Canvas, what I'm looking for is an up-to-date, well maintained Engine that will aid me in creating a C++ Platformer Game (2D).   And help and feedback is appreciated! :)