Tag Info

Hot answers tagged

125

Metroid's just using tiles, nothing special going on there. Aquaria however is doing something rather clever. If you'll notice, a lot of those rocks on the bed get repeated several times. Here's one of the rocks for instance: It looks like they've just dumped sprites along the edges of their terrain. It's kind of like what Metroid did - a massive arsenal ...


25

Draw a line to infinity and count how many times you cross the shape (even or odd), not counting the segment where the creature lies. Then check whether the creature is going left or right of that line. In this example, we cross the shape twice (so even) and we go to the left. The result is immediate from this table: # Crosses | even | odd ...


13

"Cracks" in the geometry mostly. These games have a few things in common, they have gravity and they have collision detection. These anomalies are locations where the collision detection failed in some way. It could have been sharp edges, gaps or a number of other geometry anomalies. Could even been issues with time steps in the physics engine, where the ...


10

I would advise that even if you are going to write all your own code, that you download Recast and build the sample application as it has visualisations that show the generated navmesh and it allows you to test the path-finding with a simple point and click interface. You can learn a lot just by playing with that. As you have already realised, there are two ...


10

With i going from 0 to n-1 inclusive: pointX[i] = ( sin( i / n * 2 * PI ) * radius ) + xOffset; pointY[i] = ( cos( i / n * 2 * PI ) * radius ) + yOffset; Edit: As Lars Viklund mentioned in the comments, this is only safe in languages like javascript in which integer division returns a floating point number rather than a integer. In other languages you ...


10

The simplest solution is to generate a random point within the rectangle and reject it if it lies in the polygon. You would repeat the process until you got a valid point. This same algorithm is used to uniformly distribute points over an area or volume, except points that are considered outliers are rejected. This type of sampling is known as rejection ...


9

OpenGL wiki's pseudocode (as referenced by Peter Taylor, as well) is correct. What you want is the normal of the plane the triangle, quad or other polygon represents. All you need are two edges of any planar polygon that share a common vertex. The number of edges does not matter. All you need is to get enough information to define the plane, and then get ...


7

For MMO due to their nature, wide adoption is a must to survive. They need to have a window which enables them to run on mediocre pc. So, no matter how tech progresses forward, MMO should be always the least to take full advantage of it. And poly count doesn't matter too much, if you can cover this up with your art style and/or other visual stuff. For ...


5

The easy/naive solution would simply be to take your existing points, and for each point have a corresponding point that's at the same Y position but off screen. From there, create your polygon by taking, say, points 0, 1, 1's pair, and 0's pair and pass that to your DrawPoly method. Then continue on with (1, 2, 2's pair, 1's pair), etc.


5

There are tons of source snippets for a method that performs a test for "point inside polygon". The principle comes from Jordan's curve theorem for polygons (http://www-cgrl.cs.mcgill.ca/~godfried/teaching/cg-projects/97/Octavian/compgeom.html). The naive way would be: having that method, call it PointInsidePolygon(Point p, Polygon poly): bool isInside = ...


5

Technically? Yes. It's no different to, say, a polygon with the shape of a D with 5 points viewed edge-on. A polygon is just a closed shape which has 3 or more vertices and edges. A shape with only two vertices is just a line. Meanwhile a shape with 3 vertices and only 2 edges cannot be a closed shape: most libraries would just join the first and last ...


5

I think it's not possible to say that there is one particular reason why clipping through the world happens. Due to the differences in game engines/ physics procedures between games, any number of reasons can lead to this. Stemming off this, I'm quite sure that falling out of the world has not been eliminated, necessarily. Having a few large-scale game ...


4

Focusing on poly count and other rendering minutae is really putting the cart before the horse. Your question depends entirely on what client engine you're going to use, and so can't be answered. Onwards to predicting future hardware platforms. Many projects have been sunk by assuming that hardware speeds will always advance. Look at what happened during ...


4

I would loop through your array two points at a time, extrapolating two more points (by using the X value for each of the two and making the Y value 0) to give you the bottom of your shape. Pass those four points into ccDrawPoly() and repeat until you run out of array values. so, if you have say: P1 = (0, 25) P2 = (5, 30) P3 = (10, 20) P4 = (15, 25) for ...


4

On OS X, you can use PhysicsEditor. It is a tool for Box2D or Chimpmunk but there is a txt export for your need. The main difficulty is to find a mac. Note: there is a windows version too. But i didn't use it. Try it and add a comment if it is useful.


4

Yes, it's typical to convert into triangles. When reading the mesh in, it's simple to convert a quad into a triangle. It will depend on the format you're exporting to. For example, the format I use, Blender will export all the vertices, then it will export index information for triangles and quads. So it's a simple matter of arranging the indices to take a ...


4

My guess would be that older engines probably used a quick and simple ray vs triangle test to detect collision with the geometry. That means even the tiniest gap (or a precision error in the calculations) could let the player through occasionally. More modern games will probably use a more expensive test with a sphere or capsule representing the player, and ...


4

Why do we use axis-aligned bounding boxes (AABBs) in collision detection? This question has been asked and answered more than once on this site, but I will answer it here again, briefly. AABB checks are an optimisation. And the optimisation works as follows: You do the very cheap check before you even approach doing the order-of-magnitude more expensive ...


4

In general when polygons get smaller than one or two pixels in either width or height you can get aliasing from that. This is generally called Geometry Aliasing. It is most noticeable when the small polygons have significantly different colours to the ones next to them. Different normals can also be a problem because specular highlights will change the ...


4

From my litte experience with terrain rendering, one of the visually most offensive things that happens when naively reducing the polycount with increasing distance is that -for example- the peaks of mountains can get "cut off" or valleys vanish. This obviously will happen when removing vertices uniformly from the mesh and these landscape features simply ...


3

PIX is a fairly low-level data collector/analyzer for D3D. PIX can examine the state of device objects -- including vertex and index buffers -- from within an experiment. The PIX tutorials page has a document on examining mesh data. The tutorials tend to build on each other so it's probably a good idea to at least skim them from the first one. It's not a ...


3

InkScape is a good choice for vectorial images. Size your document to 1m x 1m... Add the bitmap... Draw the polyline... Save as .svg or .xaml document... whose are text based... Develop a light parser to load the data


3

The standard approaches are (pick one): Increase your boundary width AND/OR reduce the maximum speed of your bullet so that it can never jump through a wall in a single update (requiers a bit of Pythagoras to figure out the maxium distances / minimum boundary widths); Perform continuous collision detection (CCD), usually by raycasting to detect collision ...


3

r2d2rigo's answer is almost correct. Here is the correct matrix code to set up a BasicEffect that matches SpriteBatch (from Shawn Hargreaves' blog): Matrix projection = Matrix.CreateOrthographicOffCenter(0, viewport.Width, viewport.Height, 0, 0, 1); Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0); basicEffect.World = Matrix.Identity; ...


3

Google "resting contact" -- physics engines typically handle it as an explicit state, rather than allowing objects to collide continuously, which causes jitter. Check many sources. There are a variety of approaches and none of them are easy, unfortunately. This paper serves as a good overview of all aspects of physics simulation, including resting contact.


3

They use the same models again and again in Trine. They use a lot of batched rendering. Because of their unique camera angle, a lot of the meshes get culled with frustum culling. The levels are hand-made by artist. They are just very good at re-using the same models over and over again.


3

Your question may mean two diffrent things, and for both there is some solutions: You have both the texture and the polygon and know you want to know how to store and draw your polygon. Storing a 2D polygon is a real easy job, you only have to store all the vertices in order in some array. and to apply a texture to your polygon you need equal number of ...


3

You will need an active edge list, which contains a list of all polygon edges intersected by the current scanline. You will also need an in/out flag for each polygon on the scanline. The flags are toggled on/of as you cross an edge for a polygon. The rules are drawing for each pixel along a scanline are; no polygon flags are 'in', then draw background ...


3

I think you'll need to do it in two or three steps: For converting a raster image to polygons you can use pre-existing software like http://en.wikipedia.org/wiki/Potrace Optimizing the result from that to get the best possible result with a specific number of polygons I believe is much harder. However efficiently optimizing an existing mesh down to a lower ...


3

Calculate the center point of your shape. Pick the most distant edge of your shape from the center. (Picking the most distant edge ensures that you don't start from an inverted, concave part of the shape, which would result in getting the clockwise/anticlockwise determination backward for the whole shape) Determine which direction along that edge is ...



Only top voted, non community-wiki answers of a minimum length are eligible