Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Ugg boots posted:

What does cells[x,y].GetTexture() do?

Returns a texture2D from a dictionary based on the cell type. Each cell has a CellType enum that has entries like Stone, Wood, Dirt, etc.

Adbot
ADBOT LOVES YOU

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
How does one create merged circles like the one in the image? I'm essentially trying to programatically recreate the two-tone outlined circles in this mock-up.



When I have only 2 overlapping circles (as is the case near 'Blam'), it's pretty easy to find the world coordinates of the two intersection points, and calculate the two arcs needed to draw the new shape. When I have 3 or more circles that all overlap, however, the problem seems to be more difficult -- especially if those circles belong to disparate players (and therefore the area needs to be split).

My first thought was to pass an array of points (in the above image there would be 5) to a pixel shader. Then, as I passed over the image, determine the distance of every pixel from the center of one of the points, and check to see if it was within some threshold. That, however, balloons really quickly, as every pixel must be checked against every point to determine it's ownership.

The next thought was to determine the intersection points, the center, and the radius of each circle and draw either an arc, a line, or nothing between the sets of points. However, this breaks down if more than 2 circles encompass a single area. Imagine if each of the three circles in the diagram below was a separate player. I'd have to do a second pass to check for line intersections to ensure the center area got split evenly between the three players.



This seems like a pretty standard game algorithm, but I can't figure out what to call it so I can google further.

I also thought that I could do something like render a circular gradient around each point, and draw my perimeter using a pixel shader to sample for a specific threshold value. The problem there is that my perimeter does not maintain the nice clean consistent width it does in the diagram above. This method also requires a channel for each player. Suddenly I'm way over my head as far as shaders go. I've written simple ones to handle color swapping and simple blur effects before, but that's about it.

Any suggestions?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Avenging Dentist posted:

You're going to hate me for this, given how long your post is compared to mine: given all your circles, draw all of them slightly larger than necessary. Then draw them at normal size over the enlarged ones.

(If you need them to be translucent, do the drawing onto an off-screen texture and then draw that texture to the screen with some alpha-blending stuff.)

Wow, that works nicely. Although, it doesn't handle the case where two players have overlapping areas that need to be split. Still, it provides a nice clean 'easy path'.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
In the first example: Do you want two for loops there? Draw all the centers, then all the perimeters? What advantage does drawing 1 center then 1 perimeter give you?

I've never used the stencil buffer before. I've previously had to get as fancy as to render to a different rendertarget so I could use a pixel shader on the output of rendering my whole scene, but that's the extent of my knowledge. OpenGL is also not my strength. Just to make sure I understand what's going on here:

1.) I draw my background elements -- stars, etc.)
2.) Draw the centers, making sure the stencil buffer is flagged on upon drawing that pixel. The GL_ALWAYS ensures we'll always draw our center. Is the stencil buffer 32 bit? Are we setting the value to 0xFF? (Although, if we draw semi-transparently, won't overlapping sections be drawn with more saturation?)
3.) Draw our perimeters. Only draw where the stencil buffer is not 0xFF?
4.) Change my stencil mode back to GL_ALWAYS and draw my foreground elements and HUD.

Once again, I've never actually worked with OpenGL, but I can Google well enough to think I know what that code is doing. I'm more familiar with XNA, but translating between them is easy enough. I'm going to hold off on handling two intersecting circles of enemy territory at this point, and just try to get this working correctly.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
I modified the example you gave me, and it works like a charm for one player. Wow the stencil buffer is nice to have. Now I just need to figure out a way to deform the circles where two player's areas overlap. I could just award them to no one, and use a the stencil buffer again, I suppose.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Hubis posted:

Oh, clever.

Can you explain why this is clever? I'm not sure I understand.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

6174 posted:

The intersection of the two spheres defines a circle. When viewed so that the circle appears to be a line, it will define the boundary point for the "D" shape that Hubis mentioned a few posts up.

I visualized it on my ride home. That really is pretty clever. I'll have to try it out this evening.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
So I was thinking about putting together a simple 4x space game for the iPhone. Has anyone heard anything about Cocos2D-iPhone? It seems like a pretty standard graphics/audio/physics framework, but before I dive too deep into their docs, I'm curious if anyone has used it at all.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Anyone know of any tools that would let me load up a sprite/animation, draw a polygon over it, and export the vertices? We're at the stage where we are importing content into our engine, and we are going to need lots and lots of physics polygons drawn for our sprites, and we're looking to speed up this process a bit. We could write our own tool, but we figured that this problem has probably already been solved hundreds of times. We also considered using marching squares to build our polygons for us, but were worried the results would either have too many/few vertices (or take too long to code) for our purposes. We're using Box2D as our physics back end, and I've scoured their forums for a similar tool with little luck.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Avenging Dentist posted:

Do you really need perfect accuracy for this? You'd have to provide more details, but you can fudge stuff quite a bit, and you might even be able to stick with AABBs for most objects. If that's not enough (and I'd suggest you test the behaviour with AABBs before you do anything else), a quick-and-dirty solution might give good-enough results.

There's also the comedy "import sprite data into Illustrator and vectorize it in there" option.

Unfortunately we are using space ships with somewhat unusual contours. We've tested both AABB and circle based solutions, but as physics is a core component of the gameplay (lots of tugboat style maneuvers), we need slightly more accuracy. Honestly, in most cases, we could make due with 8-12 points (and in some cases fewer.) We've been doing them by hand by opening the image in photoshop, and clicking around to get our point list, but that's tedious in the extreme.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Actually, after playing with marching squares today, I've managed to postprocess my list of vertices down from several thousand to a few dozen without much thinking. Once I put some thought into intelligently removing points, this should be no problem.

Edit: Got it, went from 1000+ points into the 18 (or thereabouts) most representative points. It only does one object per image right now, but this is going to save so much time. For example this (1092 points):



Became:


(Can't really see the spots in this image)

My Approach:
Use the standard 'marching squares' algorithm to build a list of x,y coordinates at one pixel apart. If the algorithm would place two points going the same direction (two 'UP' points in a row) don't place a new point in the list, just keep travelling until the direction changed. (This alone reduced my point list by nearly half.)

The next step was to iterate through the list and remove any point that was either too close to its neighbors, or had a low angle. Suppose points A,B,C were in this list, and the angle between A and B was 10 degrees, and the angle between B and C was 12 degrees. In that case I just removed B, and got a reasonable approximation of the shape. This algorithm turned out to be a decent first stab, but it doesn't work perfectly. (Ie, given a square, it would not spit out exactly 4 points, maybe 6 or 8.)

Then, I wrote a wrapper that slowly relaxed the tolerances and reran the post processing algorithm on the remaining points. Obviously, some fidelity is lost in the shape of the object, but that's sort of the point, right? It actually held together pretty decently down to around 6 points for that complex shape above.

I'd say it worked pretty well. Also, apologies for using this thread as a sounding board. Sometimes it helps me to think through a problem if I have to sit down and actually explain what the possible approaches are, and what courses of action I might take.

Pfhreak fucked around with this message at 00:35 on Jun 18, 2009

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

bloodychill posted:

2. Should I even bother to encrypt in the first place? I plan to make money from the project but is there are a problem in the industry with people stealing copyrighted sprite graphics for other uses?

Like the poster above me said, jam them into one data file, but don't bother encrypting them. No one is going to steal your content. This is one of the biggest concerns people have, yet it is totally unfounded. Yes, there will probably be some highschool kiddie out there who unpacks your content and pokes around. Maybe uses it in some personal project. Another developer might some day come along and use it as placeholders for their own game. But honestly, you are putting the stuff on screen, it's not like it isn't easily accessible there.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Yeah, don't look at C or C++ books for C# wisdom. You'll end up creating a nightmarish abomination in code. I program in C# all day every day for a living, and I love how quickly I can get business apps up and running in it. XNA is definitely fun too.

What level of programming skill are you? Could you, say, put together Pong in XNA do you think? (A game that can be done pretty much procedurally.) Are you already comfortable with interfaces and polymorphism? Or do we need to start a little before those concepts? (Just trying to narrow down a book recommendation for you.) Also, any questions you have about XNA, feel free to ask. I've taught a few classes about it up here at WSU.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

BizarroAzrael posted:

In XNA? I couldn't say, certainly I could do it in Flash. My only C# project has been for work, a GUI that outputs batch files to run automated tasks. I think I understand polymorphism, but had to wiki it to check.

When you say interfaces, do you mean from a design and layout perspective or something more technical? My degree had a heavy HCI element to it anyway.

Regarding XNA, does it have any drawbacks when using 3D graphics? I've come away with the impression it is most suited to work with 3D, but the first project I have planned, which I think might be a bit large and unsuitable for Flash, calls for 2D graphics.

Honestly, I've used it predominantly for 2D at this point. Actually, I'm just about to start a project to see if I can't train a set of simulated traffic lights to time themselves correctly via a genetic algorithm.

When I say interfaces, I mean something like an abstract base class. Not like graphical user interfaces. It's the foundation of polymorphism (you can also use a base class rather than an interface.) That sounds too technical. Let me try an example.

You are probably familiar with Pac Man, and most likely know that each of the four ghosts had different logic for movements. One moved randomly at each intersection, one went straight towards the player, etc. The naive approach to solving this problem would have you make 4 different ghost classes. The reason this is naive is because the ghosts have a lot in common. They all turn blue the same way, besides choosing a path they all move the same. They die the same, etc.

A better solution is to use polymorphism to create a basic ghost class that handles all the common stuff. It might look something like:

code:
interface IMoveLogic
{ // Generic interface for move logic types. Basically a parent
  // to RandomMove, etc.
   public GetNext();
}

// The colon (:) denotes that this inherits (is a child of) IMoveLogic. 
// This type of IMoveLogic moves the ghost in a random way
class RandomMove : IMoveLogic
{
   public GetNext()
   {
      // Code for a random move goes here
      return (some randomly determined move);
   }
}

// This type of IMoveLogic moves the ghost in a targeted way
class TargetedMove : IMoveLogic
{
   public GetNext()
   {
      // Some code goes here
      // Figure out where the player is, and return the move that brings us closest
      return (a move targeting the player);
   }
}


// Our base ghost class. It handles all the stuff that is the same between Inky, Blinky, Pinky, and Clyde. 

class Ghost
{
   // Calling this method you can pass in a random move or a targeted move
   // That way you can change the way the ghost moves without having to create a whole new ghost for each type of movement.
   public void SetMoveLogic(IMoveLogic newLogic)
   {
       moveLogic = newLogic;
   }

   public void Update(GameTime gameTime)
   {
      if (isAtCorner)
      {
         newDirection = moveLogic.GetNext();
      }
   }

   public void Draw();

   IMoveLogic moveLogic;
}
Obviously this is a highly protracted example. But you can see how using interfaces to define things like movement logic can make your initial class into a powerhouse. Say, later, you also wanted a movement type where the ghost would always travel east if possible. It's easy, just write the class that implements the IMoveLogic interface, and you can hot swap in the new movement type without ever changing your ghost class. If you are going to be building a project of any scope, you are going to need to concretely understand this concept.

I've got a great C# book on my desk at work, I'll have to check for the title. It's written by some Microsoft MVP. I'll get back to you.

One more thing, are you comfortable using matrices to handle your scaling, rotations, and transformations? If your project is going to involve any sort of scrollable area, and you think you will need to convert screen coordinates (0-800x0-600) to world coordinates, brush up on some matrix math. XNA provides some pretty hefty matrix methods to help you out.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Seems like you could split out the components better. The smoke from that bottle he's holding, the character, and the skull could all be separate. Every time you've copy-pasted in your sprite sheet you've likely done something wrong.

But I know XNA supports textures of less than 32bit color too. Consider that as an option.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Also, do not use line numbers as keys for the strings. That will only bring tears, and pretty much destroy any chance at localization.

Don't ever manually edit that file either. You should build a tool to do it for you, and only use that tool.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Avenging Dentist posted:

What's to elaborate on?

code:
dialogue = "Paragraph 1\nParagraph 2"
paras = split(dialogue,'\n')
for i in paras
    display(i)

Newline isn't the best character to use for this, but yeah, this is the concept.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Walorski posted:

I was wondering how much programming I should know before I jump into a little game I want to make. I've taken college beginning programming roughly 3 times (2 high school + college) and Programming I starts in about a month, and II the semester after. If I had the free time to learn it all twice I would, but I'd rather wait till it comes up in class. The game I want to make is more focused on RPG elements, like an Animal Crossing/Harvest moon type game, and preferably I'd like to make a game mod for Half Life 2 or something, it'd be way too much work to do it all with an engine or making it from the ground up. Sorry if this all sounds retarded or idealistic, but I'll know what I'm talking about after I learn a thing or two.

This post has a lot of words, and no content.

What languages do you have experience with?
Do you want to do 2D or 3D?
Have you written any games before? (Even text based games.)

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Krackbaby posted:

I'll give a generic answer of sorts to keep it simple. Imagine a world of 3000 people, each of those people have a set of attributes. Every person knows every other person, but they all know varying numbers of each others attributes. Example:

John & Bob both know Jane likes the color red.

Every person has a table titled "knowledge" that is filled with 2999 sub-tables that list what attributes they know for each other person. So John & Bob have a "knowledge" sub-table titled "Jane" that lists "likes color red".

Every turn, everyones attributes could change. So in my example, Jane decides one day that she also likes cats as pets. Since John is particularly perceptive, he now knows that Jane likes pets, but since Bob isn't as perceptive, he doesn't learn of this new information.

John's "knowledge.Jane" table gets updated, Bob's doesn't.


There are certainly some optimizations I can and will do (not to mention some I've already done). But ultimately I want to know how far I can push things as far as expanding the data sets involved further. I was just wondering if anyone who has used the Lua C API had any input as to what kind of performance gain is realistic for iterating over large numbers of Lua tables.

You either need to change the problem or change your solution, based on the info you gave I'm not really sure which it is.

If you really have a worst case situation where every single entity can update every single sub-entry, then you can't beat O(n^2) in the worst case. You are stuck with a huge rear end iteration. Switching into C might buy you some speed improvements, but my guess is they won't be drastic.

However, there's no reason you should be doing an O(n^2) iteration in the average case. My guess is that this could be done in O(nlogn) (roughly 35,000 compares, a savings of 99.6%). If you were clever with dynamic programming, kept everything properly sorted, or I knew more about the problem domain, there's a reasonable chance that you could do it with fewer than that.

So my recommendation is to evaluate your algorithm before you start trying to get tricky by switching to C.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Krackbaby posted:

Just wanted to thank everyone for their replies, since I forgot to do so during the distraction of the holidays.


It's too bad Lua doesn't have a more straightforward way to implement parallelization as this seems like a good problem to leverage it for (since each of the updates to the various tables is discrete).

Well, parallelization isn't generally an enormous boost. Remember that O(n^2) = O(1/4*n^2). Ultimately you'll get a bigger boost from limiting the set of operations you have to do somehow.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
So I've done plenty of 2D games and demos in my past, but I want to write a simple 3D rts. (Or at least play around with placing buildings, handling pathing, that sort of thing). Thing is, I've written one too many engine in my day, and I know I get bogged down in working on the engine, and never really finish the gameplay.

Is there a decent 3D engine for XNA? (Preferably something with some GUI elements available). I've done some 3D development with Ogre in the past, and I took my university's awful graphics class that mostly went over how to draw a line in opengl, so I know a little bit about working in this area.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
So, I'm trying to figure out the best data structures to use to create a tile based 3D terrain a la Evil Genius. (Ie, you can interact with square areas of the game world, place objects in cells, etc.) My thought was to use an NxN array of structs. Each struct would contain information on how to render the cell (are there floors/walls/ceilings in this cell?), walkability (cost of movement through cell, can place objects in this cell), or any other information I might need on a cell by cell basis later (like team ownership, for example.)

From there, I was thinking of maintaining a separate list of entities (dropped objects, critters, etc.) that would be able to navigate the cell grid, while being rendered on a heightmap. Each on would maintain a position in world coordinates, which I suppose could be translated to grid coordinates through scaling. In my original prototype, my entities were children of the cell they were in which made it pretty easy to move them about within a cell (and control where they entered the next cell) it added a lot of overhead of passing entities between cells. Maybe a hybrid solution is best? (Have each cell maintain a list of entities in it, have a separate entity manager maintain a list of all the game's entities for quick iteration.)

I figure I could then construct a scene graph using the terrain as a root node, with the entities more or less being children of that root. Eventually I'd like to have train/tram objects that the entities could ride. It seems like a very broad scene graph when I visualize it mentally (with almost everything a child of the root).

I've done very little 3D development before, although I've done plenty of 2D development, so I'm looking for input on what you've done that works, avenues to research (just learned how to properly use MVP matrices), or any resources that might help me approach the design for a 3D tiled environment.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Yeah, that's certainly a lot less coupled than having the cells try and maintain what is in them. Thanks for giving me an extra set of eyes on the problem.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
How do you guys (and gals) manage entities in the game world? Do you just keep them all in the scene graph itself? It seems like keeping game logic out of the scene graph is a cleaner design, but then entities need to maintain a reference to one (or more) objects in the scene graph and update those references frame to frame.

Are there accepted design patterns for entity management and inter-entity communication?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
So each, say velociraptor, would maintain it's own position, velocity, etc. They would also share a reference to a single velociraptor model. When it's time to render, each individual critter sets the appropriate transforms for the single model and submits it to be rendered.

When you are working with your entities, particularly message passing, do you have a manager class orchestrating the whole venture?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Interesting read, but he doesn't seem to pose a solution. He suggests, and correct me if I'm not reading this right, that your game is more or less too narrow of a domain for a broad use data structure. That you'll eventually hack in links between the objects for your own specialty purposes -- keeping caches fresh for example.

However, for the hobbyist developer like myself, they seem to provide a simple means of managing object hierarchy, and allow me to make minimal changes to my entities state to propagate changes in positioning.

I'm interested now that you brought that article up in how adopted these things really are. I thought the scene graph was a de facto standard, but it seems I may have been wrong. Your thoughts?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Morpheus posted:

Could someone direct me to a tutorial on Modal Windows? In XNA/C# if possible. Basically I just want to be able to make a line of code that's essentially:

window = new Dialogue("WHAT DIRECTION")
direction = window.returnDirection();

Where that dialogue will open up a window, ask the user to press a direction, loop within the window until the user presses a direction, and then most importantly, return the direction that was pressed.

I'm not entirely sure I'm describing this correctly.

Look into the Nuclex framework: http://nuclexframework.codeplex.com/wikipage?title=Nuclex.UserInterface&referringTitle=Home Seems pretty decent.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Hanpan posted:

Does anyone have any recommendations for 2d physics with XNA? I think someone here recommended Farseer, but it doesn't seem to get updated very often. It's a shame that there is no direct implementation of Box2D :smith:

Yeah, farseer isn't updated often, but it is a Box2D port in progress.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
I just spent a couple hours banging out a quick diamond-square generator to build heightmaps, and I'm pleasantly surprised at how well it works. I've gone ahead and written a quick box filter to smooth out the heightmap, which is a nice touch.

I've taken care of filtering out areas of all white/all black by preventing values greater than 1 or less than 0 for the height. I'd like to eventually use these terrains for a game like Tropico. Only, everything I'm reading online about XNA suggests that just building vertex/index buffers out of these heightmaps is an inefficient use of resources. (Obviously, rendering every heightmap every frame is going to chew up resources.)

My thought was to break up each heightmap into smaller patches, and produce smaller LoDs for each one, then determine which LoD to render by the distance to the camera. Is this a decent way to do this for a hobby type game? Is there a better approach? I want to have an arbitrary world size some time down the line, so I'm trying to plan for managing loading and unloading groups of these patches from the hard drive so I can roll around all over Mars or something.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Any of you devs maintain blogs about what you are learning? It's pretty interesting, as a hobbyist, to read about what actual devs are doing/learning.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

HicRic posted:

Can anyone recommend good sources (websites/books) that deal with networking, with a focus on networking for games? And/or perhaps recommend a good c++ library for doing such things?

I've used Raknet in the past with great success. It abstracts most of the networking code away, which may or may not be something you are interested in. It has a lot more than simple networking though, so it may be more than you need.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
I always though this powerpoint on L4D AI had some interesting insights. You'd have to figure out how to build your own navmesh though.

Pfhreak fucked around with this message at 22:38 on Mar 21, 2010

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Avenging Dentist posted:

That's actually exactly what BSP would help you with.

Yes, yes it would. Somehow I totally missed that post.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Morpheus posted:

I'm not entirely sure, but aren't navmeshes best used for 3D maps, where it isn't feasible to make a 'grid' layout? Or perhaps the article I read merely said that it's preferable to other options, when using 3D.

If you think about it, a grid is a navmash, just a really naive one. Each part of the mesh connects with 4 (or 8) neighbors. In a 1x1 pixel grid, this results in a LOT of space that doesn't need to be individual nodes. For example, let's say your game has nice big rectangular bridges, maybe 20x50 pixels. That's 100 pixels and 100 entries in your pathfinding algorithm.

If you generate just one quad that sits on top of that bridge, it drops to 100 pixels, but only 1 entry in your pathfinding algorithm. The enemy unit is free to wander around anywhere inside that quad, because we know the entire center area is free. If a unit wants to move across the bridge, the number of nodes they have to expand is two orders of magnitude fewer.

You can generate the navmesh pretty easily using BSP or a quadtree. Imagine your empty pristine world has 1 navigable quad, so all your entities are free to just cruise about. When the player drops in a structure, the bsp/quadtree adjusts whatever the smallest subtree they have is to accommodate the change. Now, all that being said, I've never actually built anything like that, so I can't point you to good how-to type resources.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Paniolo posted:

For a 2D topdown game with irregular geometry I would use a quadtree instead of a grid. The world's still divided up into squares, but only to the extent that's needed to accurately represent the collision geometry. So you can get pixel accuracy where needed without needing to store a pixel-level grid for the entire world. It's also easy to dynamically add and remove geometry.

There's no reason to use a navmesh for a 2D game. The only reason for using one is to allow layered geometry in levels (rooms on top of other rooms, bridges, etc.) and it is significantly more complex, which is one reason most early 3D games simply didn't allow layered geometry.

I thought a navmash was a label for a graph that a character could traverse. If you are using a quadtree to designate wide areas for traversal, how is that not a navmesh?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Separate question. If I draw a trianglelist with a vertexbuffer and indexbuffer in XNA, does it matter in which order I add the triangles to the indexbuffer?

I am NOT asking if it matters which order the vertices are added. I know that winding order is very important.

I am asking if it matters which order I have the triangles in the indexbuffer.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Another question: I've got my heightmaps working, generated by the Diamond-Square algorithm, and smoothed with some basic box smoothing. Nice rolling hills, but pretty useless from an actual gaming standpoint. I'm working on a simulation game a la dwarf fortress/evil genius, and I'm trying to figure out if I should bother with random map generation.

It seems like getting a heightmap generated that has wide flat areas, realistic transitions, and a decent sense of flow would be pretty hard. Are there any ways of improving the playability of a randomly generated heightmap? The only one I can think of is to do some sort of 'clumping' algorithm where I pick a point on the heightmap and do a walk outwards from some point, flattening as I go.

The other part of me thinks that I should just shelve random maps for now, get myself a decent level, and trust that should I ever actually finish this project, other people will contribute levels.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

OneEightHundred posted:

I'd recommend reading this:
http://oddlabs.com/download/terrain_generation.pdf

Exactly what I was looking for. It's going to be a fun weekend. :D

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

OneEightHundred posted:

Plus, you you can do things like track the erosion and use to determine what surfaces are like (i.e. rockier where erosion occurs, sandier at deposit sites).

Also Perlin noise tends to be the preferred way of getting a good base terrain these days.

Neat, I'll have to see about playing with that. What is it about generating Perlin noise that makes it superior?

Adbot
ADBOT LOVES YOU

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Your code can't be that complex, if all you are doing is drawing a sprites. My guess is you've made a mistake somewhere that we could catch just by eyeballing it. A profiler at this stage is probably a little overkill. Maybe toss it up on pastebin or something and I'd be happy to take a look.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply