• 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.

sultanofswing.90

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

111 Neutral

About sultanofswing.90

  • Rank
    Newbie
  1. Hello, I'm developing a collision system for my little isometric engine. I have a PlayerEntity Class with a property [source lang="csharp"]/// <summary> /// Get or set the position of this entity /// </summary> public Vector2 Location { get { return _location; } set { _location = value; Rectangle = new Rectangle( (int)value.X, (int)value.Y, Rectangle.Width, Rectangle.Height ); if( Fixture != null ) Fixture.Location = value; } } private Vector2 _location;[/source] The rectangle field doesn't need any explanation. Well, what is a fixture? the Fixture is a Class needed for collision detection. Every fixture has his shape, for example [source lang="csharp"]public enum FixtureShape { Rectangle, Circle, Rhomb, MouseMap, None }[/source] For example, [img]http://i46.tinypic.com/rqvxnd.png[/img] here the violet circle is the fixture for the player entity. For other shapes is similiar. If mouse map is choosen, the texture is thresholded and for every pixel with an alpha value different from zero, that pixel is set to black. Well, for collision detection i use per pixel collision algorithm, for now i use that from microsoft sample. Here's the function [source lang="csharp"]public bool CheckCollision( Fixture f ) { Rectangle f2Rect = f.Rectangle; Color[] f2Data = f.FixtureData; // Find the bounds of the rectangle intersection int top = Math.Max( Rectangle.Top, f2Rect.Top ); int bottom = Math.Min( Rectangle.Bottom, f2Rect.Bottom ); int left = Math.Max( Rectangle.Left, f2Rect.Left ); int right = Math.Min( Rectangle.Right, f2Rect.Right ); // Check every point within the intersection bounds for( int y = top; y < bottom; y++ ) { for( int x = left; x < right; x++ ) { // Get the color of both pixels at this point Color colorA = FixtureData[ ( x - Rectangle.Left ) + ( y - Rectangle.Top ) * Rectangle.Width ]; Color colorB = f2Data[ ( x - f2Rect.Left ) + ( y - f2Rect.Top ) * f2Rect.Width ]; // If both pixels are not completely transparent, if( colorA.A != 0 && colorB.A != 0 ) { // then an intersection has been found return true; } } } // No intersection found return false; }[/source] And here's how i use it. I have a list of fixtures that are currently in the visible part of the screen, viewedFixtures. Here's the function where i check collision between objects and player [source lang="csharp"]public bool IsPlayerColliding( List<Fixture> viewedFixtures, Vector2 MoveDirection ) { if( PlayerFixture == null ) return false; //take a clone of player fixture Fixture t = (Fixture)PlayerFixture.Clone(); t.Location += MoveDirection; foreach( Fixture f in viewedFixtures ) { if( t.CheckCollision( f ) ) //there's a collision return true; } return false; }[/source] what i do here is checking for collision between the player fixture, [u]moved along the direction the user choosed[/u], and the near fixtures, and this is the function that let the user to move the player in the map: [source lang="csharp"]public void MovePlayer( Vector2 moveDirection ) { if( Player == null ) return; if( !CollisionSystem.IsPlayerColliding( Map.ViewedFixtures, moveDirection ) ) { Player.Location += moveDirection; } }[/source] here, if the fixture in the new location is not colliding, finally move the player and the player fixture along the choosed direction. Finally, here's the update method of the game source: [source lang="csharp"]/// <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 ) { // Allows the game to exit if( GamePad.GetState( PlayerIndex.One ).Buttons.Back == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) this.Exit(); GamePadState padState = GamePad.GetState( PlayerIndex.One ); Vector2 MoveDirection = Vector2.Zero; #region Movement section #region North-west if( padState.DPad.Left == Microsoft.Xna.Framework.Input.ButtonState.Pressed && padState.DPad.Up == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) { MoveDirection = new Vector2( -2, -1 ); } else #endregion North-west #region North-east if( padState.DPad.Right == Microsoft.Xna.Framework.Input.ButtonState.Pressed && padState.DPad.Up == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) { MoveDirection = new Vector2( 2, -1 ); } #endregion North-east #region South-west else if( padState.DPad.Left == Microsoft.Xna.Framework.Input.ButtonState.Pressed && padState.DPad.Down == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) { MoveDirection = new Vector2( -2, 1 ); } #endregion South-west #region South-east else if( padState.DPad.Right == Microsoft.Xna.Framework.Input.ButtonState.Pressed && padState.DPad.Down == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) { MoveDirection = new Vector2( 2, 1 ); } #endregion South-east #region North else if( padState.DPad.Up == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) { MoveDirection = new Vector2( 0, -1 ); } #endregion North #region South else if( padState.DPad.Down == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) { MoveDirection = new Vector2( 0, 1 ); } #endregion South #region West else if( padState.DPad.Left == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) { MoveDirection = new Vector2( -2, 0 ); } #endregion West #region East else if( padState.DPad.Right == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) { MoveDirection = new Vector2( 2, 0 ); } #endregion East #endregion Movement section if( MoveDirection != Vector2.Zero ) world.MovePlayer( MoveDirection ); base.Update( gameTime ); }[/source] Ok. There's a problem but i can't find it. Here's some screenshot: [img]http://i48.tinypic.com/fkxge8.png[/img] [img]http://i50.tinypic.com/11reltw.png[/img] The problem is that the fixture go 'inside' the other fixture...anyone has a suggestion? (sorry for my bad english) Thanks, bye
  2. Hi everyone =) i want to share with you what i done! i'm taking part in a rock guitar contest and i want to know what do you think of my solo. Here's my video [media]http://www.youtube.com/watch?v=fH67y8oPSB4[/media] sorry for the bad quality =\ bye ;)
  3. implement it as a standard height map? Does this mean that i can store all the height in a (for example) integer matrix as big as the map? Ok but every time i have to check the tiles "transition" when i move up/down one...and in certain cases i've to modify a lot of tiles...
  4. up? [img]http://public.gamedev.net//public/style_emoticons/default/rolleyes.gif[/img]
  5. Hi guys, i'm developing a full 2d iso engine with xna (here's a demo [url="http://www.youtube.com/watch?v=2ScRhxLDIAo"]http://www.youtube.com/watch?v=2ScRhxLDIAo[/url]), but now i need an algorithm to raise/fix automatically every tile around a previously moved up/down tile. i.e if i move up a tile at height 0, the 8 tiles around must be modified...etc... What i can do? In my video i modified every single tile... here's a video showing what i need(from 00:26) [url="http://www.youtube.com/watch?v=EN8Y-zoknrY"]http://www.youtube.com/watch?v=EN8Y-zoknrY[/url] bye =)
  6. ok it was a stupid error =) well, i fixed all, that's the result [url="http://imageshack.us/photo/my-images/585/26788978.png/"][img]http://img585.imageshack.us/img585/756/26788978.png[/img][/url] thanks ;)
  7. [quote name='MasterEvilAce' timestamp='1316977972' post='4865827'] Look at how you're actually drawing the tiles. Just looking at the top row you can see what's going on. (Ignoring the Y for now) you're rendering 0,0 then 1,0 then 2,0. If you look at the arrangements of those tiles you SHOULD be rendering 0,0 then 2,0 then 4,0 (etc) THEN render 1,0 and 3,0, etc. 2,0 is physically setup to be behind 1,0, so it needs to render first. As far as the solution goes, I'm not sure the best course of action. But that's what your problem is. I think the best solution might be to setup your grid to where the first actual row is 0,0 then 1,0 then 2,0 then 3,0. The next row (shifted over) is 0,1 then 1,1 then 2,1 then 3,1. However, the rest of your math for click tiles, etc. would have to be modified as well. [/quote] hmm ok i tried this: [source]private void drawBlocks(SpriteBatch batch) { for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x+=2) { if (objectMap[x, y] != null) objectMap[x, y].Draw(batch); } for (int x = 1; x < Width; x += 2) { if (objectMap[x, y] != null) objectMap[x, y].Draw(batch); } } }[/source] but,again, when i click(for example) tiles 2,2 ,4,2 , 3,1 the result is [url="http://imageshack.us/photo/my-images/16/unled4ae.png/"][img]http://img16.imageshack.us/img16/8139/unled4ae.png[/img][/url] =|
  8. [quote name='iEat_Babies' timestamp='1316969407' post='4865796'] What did you do to get to the last screenshot... what "caused" it? [/quote] nothing special....only placed blocks close togheter. The two previous screenshot are two different situation. In the first the blocks have a certain distance, in the second all the blocks are close togheter, but drawed in the wrong order...
  9. Hi people, i'm currently working on a simple 2D isometric engine using a staggered map, i'm thinking about a simcity clone... Drawing the map and the tile picking are ok, but here's the painful part: block placement in the map. So, here's what i've done: I've a map class containing [source]terrainBlock terrain[,]; int height; int width; mapObject objectMap[,]; ...[/source] terrain holds all terrain blocks,object holds the blocks the user can place in the map. Here's the map [url="http://imageshack.us/photo/my-images/221/unledqvau.png/"][img]http://img221.imageshack.us/img221/234/unledqvau.png[/img][/url] When i click on a terrain block i have something like this [url="http://imageshack.us/photo/my-images/196/unled2ydy.png/"][img]http://img196.imageshack.us/img196/882/unled2ydy.png[/img][/url] and this is my Update method: [source]public void Update(MouseState m1) { Point selectedTileCoord = ChechTilePicking(m1); //if we selected a valid tile if (selectedTileCoord.X != -1 && selectedTileCoord.Y != -1) { //if user press the left button if (m1.LeftButton == ButtonState.Pressed) { if (objectMap[selectedTileCoord.X, selectedTileCoord.Y] == null) { //create a new block objectMap[selectedTileCoord.X, selectedTileCoord.Y] = new mapObject(Content, this, selectedTileCoord); } } } }[/source] seems ok but...look at this now: [url="http://imageshack.us/photo/my-images/594/unled3xat.png/"][img]http://img594.imageshack.us/img594/3441/unled3xat.png[/img][/url] Oh no! What's happening here? I don't know how to render all the blocks in the right order, once placed in the map. Here's my draw method: [source]public void Draw(SpriteBatch batch) { batch.Begin(); drawTiles(batch); batch.End(); batch.Begin(); drawBlocks(batch); batch.End(); }[/source] so, i draw first all the terrain blocks(right?), then i draw all the map blocks. Here's the drawBlock method: [source]private void drawBlocks(SpriteBatch batch) { for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { if (objectMap[x, y] != null) objectMap[x, y].Draw(batch); } } }[/source] and this is the draw method for the mapObject class: [source]public void Draw(SpriteBatch batch) { batch.Draw(texture, rect, Color.White); }[/source] where rect is the destination rectangle in the screen. However, the drawBlocks method should draw every block left to right,top to bottom...but it doesn't work correctly! How can i render correctly every block in the map? =\