Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 01 Apr 2007
Offline Last Active Jul 16 2013 06:51 AM

Topics I've Started

Procedural Terrain Mesh Generation?

02 July 2012 - 10:21 AM

Hello all,

I'm working on a game of sorts using mostly cubes (fairly minecraft-like).

I'm currently using 3D Perlin Noise with some custom tweaks to generate the terrain which works out fantastic, but I'm not quite sure how I should be going about rendering it in the best manner possible.

I definitely don't want to be over optimizing, but with the level of detail I'm going for, it's quite possible to have several million 'cube' faces visible at once. Instancing of individual faces certainly isn't desired in this case due to the expense there (tried it, obviously failed miserably due to the heavy amount of real time computations needed to translate/texture/etc).

So, my goal at the moment is to create some form of surface extraction algorithm. Rather than recreate the wheel, what might be out there to accomplish this simple task?

I'm obviously not just wanting to create a generic mesh with two triangles per every face, but slim down on those triangles when multiple faces are joined together on the same plane.

Any help, tutorial links, code, etc would be appreciated.

Edit: Thought I better specify, I'm using C# with XNA 4.0. I should be able to port most anything over though, but I'm sure someone has already done this in C# (xna shouldn't be terribly relevant I wouldn't think).


Multi-Layered 2D Tile-Based map, how to render efficiently (culling)?

23 March 2012 - 06:41 AM

Simple enough concept, but it's really confusing for me. Feel free to look at this demo to get an idea of the perspective I'm referring to, but the real map is HUGE and many many layers thick.

It's all 2D, using SpriteBatch in C#. I'm currently checking every potentially visible tile on every potential layer, from back to front, to see if it 'exists' (not just if it's visible) and then drawing it. I am indeed able to compare where the player is with the zoom factor to cut out anything outside of the screen area vertically/horizontally per layer, but as I draw each layer, I'm unaware of a fast method to skip entire layers completely hidden by layers above them or to only attempt to draw single cubes when only a few on a given layer are actually visible.

Any suggested methods of how to ONLY render truly visible tiles, without iterating through all tiles to check for their visibility?


How to pathfind intelligently once target is out of sight

19 March 2012 - 02:51 PM

Working on a turn based, 2D tile based game. Going very heavy on tactics/strategy.

I have field of vision working quite well for players and enemies alike, but I'm struggling with how to have enemies chase a player once the player has left the enemy's sight. Tiles are unknown to characters (enemies/players) until they have been seen at least once, and when not in direct view it is unknown what is actually at that tile even if the terrain is remembered.

The game is mostly within a tunnel like cave system, so an enemy chasing a player could encounter things like the path splitting two ways or even encountering dead ends. The field of view is also a 90 degree cone in front of the character and turns are taken using action points, so a single character could take multiple steps per turn (easily leaving another character's current line of sight).

I'm sure there's some form of pathfinding that could use things like last known position, previous movements observed, etc to 'chase' a target, but I haven't had a lot of luck with Mr. Google today in finding anything relevant to my exact kind of situation.

Any help on this would be appreciated.


PS: If there's anything else I could add to assist someone in assisting me, please just ask. Ty

Surface Area of Circle... sort of

09 March 2012 - 10:47 AM

Hello all,

I'm working on a top down 2D tile based game. I'm working on implementing lighting of a sort, but I'm only lighting entire tiles (either lit or not).

So, say I have a light source that should light all tiles within a radius of 1. That would end up lighting 5 tiles (it's own and those adjacent to it).

That's great and all, but the question arose to me, just how many tiles are going to be lit by using a specific light source (without iteration or implementing it).

Of course I started with just doing a typical calculation of circle surface area, but as an example, a radius of 1 would just result in Pi typically rather than 5.

Any suggestions on how I could implement a function that simply returns the number of tiles that would be lit when inputting a single number for radius? This can definitely ignore walls.

Thanks in advance,

Cellular Automata - Remove isolated sections quickly?

24 January 2012 - 03:50 PM

Hope this is the right forum, if not please point me in the right direction.

I'm working on a roguelike that does level by level design using cellular automata for cave-like dungeon generation.

My issue is that my maps are fairly large. 500x500 grid typically to start with. To have the look that I'm going for, I am still occasionally coming up with disconnected smaller areas of floor tiles.

My question, how would you go about simply removing these smaller areas in the fastest method possible?

I'm writing this in C# using XNA, 2D Sprite based. The map simply consists of wall and floor tiles.

My current method of handling this is:

1. Look through every tile on the map.
2. If the current tile is not in the array BigOList and is a floor tile, use Dijkstra's algorithm to compile a list of all floor tiles within this section.
3. Save this list as an array element within the array BigOList.
4. Go back to step 1 until every tile has been checked.
5. Check BigOList for the largest section, set all other sections to be wall tiles.

The performance issues here may be my bad coding, but if not, I'd love to hear how someone else would or has handled this sort of scenario.