Tag Info

New answers tagged

1

You can use the even-odd algorithm. In summary it does the following. Loop thru each scan line Intersect the scan line with each polygon edge Sort the intersection points by x value Fill interior pixels between intersection points using the even-odd rule to determine interior points Note, you have to guard against degenerate cases like intersecting with ...


-1

For game maker you can use this tutorial https://youtu.be/LUw78Tk70bM


1

It's all about tradeoffs. But first, occlusion culling is to hide what is being hidden by other objects, not what falls outside the viewing frustum. What you described is called frustrum culling. Sure, you can do that and only request to draw polygons that you will see, but those calculations, along with the time required to update the index buffer may ...


0

As mentioned in one of the comments, you want to partition the world into sections by using oct/quad trees. Then as the player moves, using the tree you can quickly get all the nearest elements in your world. Only those closest to the player are the ones you have to react to.


2

Typical approaches to reduce processing are: Spatial subdivision / coherence - Don't process everything in the whole world, instead only do so in pertinent regions - usually only those in close proximity to the player(s). - Group units close together as a single unit to reduce overall count (Rome: Total War). Common in real-time rendering fields. ...


4

One way to go is to split the whole world into chunks, and load just the chunk the player character is currently in (or any number of chunks that are closest). This way you only have to listen for events in this chunk. This does not mean you have to split everything into "levels". Minecraft is a fairly good example of splitting a giant world into chunks that ...


0

With r being the circular area view radius; Make a mesh that covers the polygon where the nodes are at most 2r apart and connect the nodes with neighbours. Based on the distance and wind/water current between each node, add a difficulty value to progress through the arcs; arcs are bi-directional and don't have the same value (for instance for node A to B ...


0

An possible algorithm, expsed in python language: def get_distances_for_points(object_position, max_distance): points_distances = {} points_to_looks = [object_position] for current_distance in range(max_distance): new_points_to_looks = [] for looked_point in points_to_looks: around_points = <here return around ...


0

I guess terrain is 2d from the picture. If it is terrain the {x} axis distance between every vert should be constant. I also condider both players are grounded. Now lets have such varriables: Player 1 : p1where we have p1.x and p2.x Player 2 : p2 same as player 1 Let's also say player p1 is before p2 in other words he is behind him vert array: V with ...


1

Pathfinding algorithms like A* can deal with inertia (or any other dimension you can throw at it) just fine. The key is to treat them as an additional dimension, and create a higher-dimensional search graph to search in. To keep things simple, let's suppose we have only two speeds: slow and fast, and this path: A --(sharp turn)-- B ----------- C ...


2

The only new constraint that inertia lays onto path-finding is continuity, which means no sudden breaks in velocity. Start by generating an A* path, but with a big twist. The reason A* by itself is not appropriate is because it violates continuity, so lets make a new one. A* chooses the best path as the shortest path, but with inertia the shortest path is ...


4

So what you want is like this? As Stephan says, you have the right idea, just repeat it until you're all out of movement. 1. Measure length to next vertex along first slope. while( impending movement vector > length to next vertex ) { 2. Subtract length from impending movement vector. 3. Position impending movement vector at vertex... 1. ...


1

You are describing the proper algorithm. If you loop while you have remaining movement left, it wont matter how many segments you have to cross over. All of the calculations you describe are O(1) calculations so performance isn't an issue. Keep in mind that all terrain is triangles under the hood, so Trig and/or Dot Products may possibly offer some ...



Top 50 recent answers are included