Jump to content
New account registrations are disabed. This website is now an archive. Read more here.

DoubleX

Member
  • Content Count

    81
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by DoubleX

  1. I'm only going to cover simple shapes like Points, Straight Lines, Circular Arcs, Circular Sectors and Simple Polygons, by using cartesian coordinates, basic algebra and Euclidean 2D geometry only. More complex shapes like ellipse and parabolas won't be covered, and more advanced maths like polar coordinates and affine spaces won't be used. No solid proofs will be covered as well. The below aims to always ensure 100% correctness, even for the teleportation cases, although it indeed fails a bit and badly when few and many shapes move quickly respectively. Points It's just an ordered x, y pair in the cartesian coordinate system. Straight Lines It's just the line between 2 specified points. The line will be represented by its corresponding linear equation in the form of y = mx + c. The rotation and translation offsets, valid x and y ranges and midpoint of the straight line will be used as well. Users only has to define those 2 specified points. The rest will be generated by scripts upon initializing the point. Circular Arcs A virtual circular sector will be used to implement a circular arc, which is the real shape. Check below for Circular Sectors. The midpoint is used in the circular arc as well. Circular Sectors It's a system of 3 inequalities in 2 unknowns, including 2 linear ones in the form of y >= mx + c, y > mx+ c, y <= mx+ c or y < mx+ c, and 1 inequality of circle in the form of (x - h) ^ 2 + (y - k) ^ 2 <= r ^ 2 or (x - h) ^ 2 + (y - k) ^ 2 < r ^ 2. The center, radius, rotation and translation offsets, and associated equations for those inequalities will be used as well. Note that the center is also the intersecting point of those 2 linear inequalities. Users only has to define the center, radius, and those 2 linear inequalities. The rest will be generated by scripts upon initializing the circular sector. Simple Polygons It's a system of linear inequalities in 2 unknowns. The number of inequalities is that of the edges. The vertexes, triangles of the polygon touching its edges and their incenters, an arbitrary center inside the polygon, the associated linear equations for those linear inequalities with their valid x and y ranges, the rotation and translation offsets, and the bounding rectangle or circular sector and inner circular sector or rectangle(analogous to inner circle) are used as well. Users only has to define the vertexes, an arbitrary center inside the polygon, and whether a rectangle or circular sector will be used to bound the simple polygon. The rest will be generated by scripts upon initializing the simple polygon. There are 5(5 + 1) / 2 = 15 possible cases: Points vs Points, Points vs Straight Lines, Points vs Circular Arcs, Points vs Circular Sectors, Points vs Simple Polygons, Straight Lines vs Straight Lines, Straight Lines vs Circular Arcs, Straight Lines vs Circular Sectors, Straight Lines vs Simple Polygons, Circular Arcs vs Circular Arcs, Circular Arcs vs Circular Sectors, Circular Arcs vs Simple Polygons, Circular Sectors vs Circular Sectors, Circular Sectors vs Simple Polygons, and Simple Polygons vs Simple Polygons. For all cases, the collision flag and relative positions between 2 shapes will be stored upon change per frame. If the relative positions between 2 shapes remains unchanged, it's certain that their collision flag doesn't need to change and can be used directly. The time complexity here's O(1). Points vs Points Just compare if they have both the same x and y coordinates. The time complexity's O(1). Points vs Straight Lines The point's reference point will be adjusted to be that of the straight line. The time complexity here's O(1). Then just check if the point's x and y coordinates are within the valid ranges of those of the straight line, and if that point's an solution to that linear equation. The time complexity here's O(1). The combined time complexity's O(1). Points vs Circular Arcs The point's reference point will be adjusted to be that of the circular arc. The time complexity here's O(1). Then just check if the distance between the point and the virtual center of the circular arc equals to the virtual radius of that circular arc, and if that point satisfies the 2 virtual linear inequalities in 2 unknowns.The time complexity here's O(1). The combined time complexity's O(1). Points vs Circular Sectors Same as Points vs Circular Arcs, except that whether the distance between the point and the center is less than or equal to, or less than, the radius is checked instead of checking against the equal condition. Points vs Simple Polygons The point's reference point will be adjusted to be that of the simple polygon. The time complexity here's O(1). The point will first the checked against the bounded rectangle or circular sector of the simple polygon. Checking a point against a circular sector goes to Points vs Circular Sectors, and that against a rectangle will be checking if both the x and y coordinates of the point lines between the minimum and maximum x and y coordinates of the rectangle. The time complexity here's O(1). If the point doesn't collide with the bounded rectangle or circular sector of the simple polygon, then that point isn't colliding with that simple polygon itself. The combined time complexity will be O(1). If that's not the case, then check the point against the inner rectangle or circular sector of the simple polygon, which is essentially the same as checking against the bounding ones. If the point collides with the inner rectangle or circular sector of the simple polygon, then so does the simple polygon. The combined time complexity will be O(1). If that's not the case, then check if the point satisfies all the linear inequalities of the simple polygon. The time complexity here's O(E), where E is the number of edges. The combined time complexity will be O(E) in this case. Straight Lines vs Straight Lines Either straight line's reference point will be adjusted to be that of the other. The time complexity here's O(1). Then just check if the 2 linear equations has solutions and whether the they lie within the valid ranges of both straight lines. The time complexity here's O(1). The combined time complexity's O(1). Straight Lines vs Circular Arcs The straight line's reference point will be adjusted to be that of the circular arc. The time complexity here's O(1). Then just check if the linear equation and the equation of circle has solutions and whether they satisfy the valid ranges of the straight line, and the 2 linear inequalities of the circular arc. The time complexity here's O(1). Straight Lines vs Circular Sectors The straight line's reference point will be adjusted to be that of the circular sector. The time complexity here's O(1). The midpoint of the straight line will be checked against the circular sector. Checking a point against a circular sector goes to Points vs Circular Sectors. The time complexity here's O(1). If the midpoint collides with the circular sector, then so does the straight line. The combined time complexity will be O(1). If that's not the case, then it's certain that the straight line won't completely lie within the circular sector, meaning the former must intersect with the perimeter of the latter in order to collide. So checking whether the straight line collides with the linear equations or equation of circle of the circular sector will suffice. They go to Straight Lines vs Straight Lines and Straight Lines vs Circular Arcs. The time complexity here's O(1). The combined time complexity will be O(1) in this case. Straight Lines vs Simple Polygons The straight line's reference point will be adjusted to be that of the simple polygon. The time complexity here's O(1). The straight line will be checked against the bounded rectangle or circular sector of the simple polygon. Checking a straight line against a circular sector goes to Straight Lines vs Circular Sectors. That against a rectangle will be checking the midpoint of the straight line against that rectangle. Checking a point against a simple polygon goes to Points vs Simple Polygons. If the midpoint collides with the rectangle, then so does the straight line. The time complexity will be O(1) but not O(E), as the number of edges of a rectangle's always 4. If that's not the case, then it's certain that the straight line won't completely lie within the rectangle, meaning the former must intersect with the perimeter of the latter in order to collide. So checking whether the straight line collides with the linear equations of the rectangle will suffice. It goes to Straight Lines vs Straight Lines. The time complexity here's O(1). If the straight line doesn't collide with the bounded rectangle or circular sector, then neither does the simple polygon. The combined time complexity will be O(1). If that's not the case, then check the straight line against the inner rectangle or circular sector of the simple polygon, which is essentially the same as checking against the bounding ones. If the straight line collides with the inner rectangle or circular sector of the simple polygon, then so does the simple polygon. The combined time complexity will be O(1). If that's not the case, then check the midpoint of the straight line against the simple polygon. Checking a point against a simple polygon goes to Points vs Simple Polygons. If the midpoint collides with the simple polygon, then so does the straight line. The combined time complexity will be O(E). If that's not the case, then it's certain that the straight line won't completely lie within the simple polygon, meaning the former must intersect with the perimeter of the latter in order to collide. So checking whether the straight line collides with the linear equations of the simple polygon will suffice. It goes to Straight Lines vs Straight Lines. The time complexity here's O(E) but not O(1), as E instead of 1 straight lines have to be checked against. The combined time complexity will be O(E) in this case. Circular Arcs vs Circular Arcs Either circular arc's reference point will be adjusted to be that of the other. The time complexity here's O(1). Then just check if the equation of circles has solutions and whether they satisfy all the 4 linear inequalities of the circular arcs. The time complexity here's O(1). Circular Arcs vs Circular Sectors The circular arc's reference point will be adjusted to be that of the circular sector. The time complexity here's O(1). The midpoint of the circular sector will be checked against the circular sector. Checking a point against a circular sector goes to Points vs Circular Sectors. The time complexity here's O(1). If the midpoint collides with the circular sector, then so does the circular arc. The combined time complexity will be O(1). If that's not the case, then it's certain that the circular arc won't completely lie within the circular sector, meaning the former must intersect with the perimeter of the latter in order to collide. So checking whether the circular arc collides with the linear equations or equation of circle of the circular sector will suffice. They go to Straight Lines vs Circular Arcs and Circular Arcs vs Circular Arcs. The time complexity here's O(1). The combined time complexity will be O(1) in this case. Circular Arcs vs Simple Polygons The circular arc's reference point will be adjusted to be that of the simple polygon. The time complexity here's O(1). The circular arc will be checked against the bounded rectangle or circular sector of the simple polygon. Checking a circular arc against a circular sector goes to Circular Arcs vs Circular Sectors. That against a rectangle will be checking the midpoint of the circular arc against that rectangle. Checking a point against a simple polygon goes to Points vs Simple Polygons. If the midpoint collides with the rectangle, then so does the circular arc. The time complexity will be O(1) but not O(E), as the number of edges of a rectangle's always 4. If that's not the case, then it's certain that the circular arc won't completely lie within the rectangle, meaning the former must intersect with the perimeter of the latter in order to collide. So checking whether the circular arc collides with the linear equations of the rectangle will suffice. It goes to Straight Lines vs Circular Arcs. The time complexity here's O(1). If the circular arc doesn't collide with the bounded rectangle or circular sector, then neither does the simple polygon. The combined time complexity will be O(1). If that's not the case, then check the circular arc against the inner rectangle or circular sector of the simple polygon, which is essentially the same as checking against the bounding ones. If the circular arc collides with the inner rectangle or circular sector of the simple polygon, then so does the simple polygon. The combined time complexity will be O(1). If that's not the case, then check the midpoint of the circular arc against the simple polygon. Checking a point against a simple polygon goes to Points vs Simple Polygons. If the midpoint collides with the simple polygon, then so does the circular arc. The combined time complexity will be O(E). If that's not the case, then it's certain that the circular arc won't completely lie within the simple polygon, meaning the former must intersect with the perimeter of the latter in order to collide. So checking whether the circular arc collides with the linear equations of the simple polygon will suffice. It goes to Straight Lines vs Circular Arcs. The time complexity here's O(E) but not O(1), as E instead of 1 straight lines have to be checked against. The combined time complexity will be O(E) in this case. Circular Sectors vs Circular Sectors Either circular sector's reference point will be adjusted to be that of the other. The time complexity here's O(1). The center of each circular sector will be checked against the other circular sector. Checking a point against a circular sector goes to Points vs Circular Sectors. The time complexity here's O(1). If either center collides with the other circular sector, then so do the circular sectors themselves. The combined time complexity will be O(1). If that's not the case, then it's certain that neither circular sector will lie within the other, meaning their perimeters must intersect in order to collide. So checking whether their linear equations or equation of circles collide will suffice. They go to Straight Lines vs Straight Lines, Straight Lines vs Circular Arcs and Circular Arcs vs Circular Arcs. The time complexity here's O(1). Circular Sectors vs Simple Polygons The circular sector's reference point will be adjusted to be that of the simple polygon. The time complexity here's O(1). The circular sector will be checked against the bounded rectangle or circular sector of the simple polygon. Checking a circular sector against a circular sector goes to Circular Sectors vs Circular Sectors. That against a rectangle will be checking the center of the circular sector against that rectangle and the arbitrary center of the simple polygon against that circular sector. Checking a point against a circular sector and simple polygon goes to Points vs Circular Sectors and Points vs Simple Polygons respectively. If the center of the circular sector collides with the rectangle or the arbitrary center of the simple polygon collides with the circular sector, then so do circular sector and the rectangle. The time complexity will be O(1) but not O(E), as the number of edges of a rectangle's always 4. If that's not the case, then it's certain that neither the circular sector nor the rectangle will completely lie within the other, meaning their perimeters must intersect in order to collide. So checking whether the linear equations or equation of circles of the circular sector will collide with the linear equations of the rectangle will suffice. It goes to Straight Lines vs Straight Lines and Straight Lines vs Circular Arcs. The time complexity here's O(1). If the circular sector doesn't collide with the bounded rectangle or circular sector, then neither does the simple polygon. The combined time complexity will be O(1). If that's not the case, then check the circular sector against the inner rectangle or circular sector of the simple polygon, which is essentially the same as checking against the bounding ones. If the circular sector collides with the inner rectangle or circular sector of the simple polygon, then so does the simple polygon. The combined time complexity will be O(1). If that's not the case, then check the center of the circular sector against the simple polygon, and the arbitrary center of the simple polygon against the circular sector. Checking a point against a circular sector and a simple polygon goes to Points vs Circular Sectors and Points vs Simple Polygons respectively. If the center of the circular sector collides with the simple polygon or the arbitrary center of the simple polygon collides with the circular sector, then so do the circular arc and simple polygon themselves. The combined time complexity will be O(E). If that's not the case, then it's certain that the neither the circular arc nor the simple polygon will completely lie within the other, meaning their perimeters must intersect in order to collide. So checking whether the linear equations or equation of circles of the circular sector will collide with the linear equations of the rectangle will suffice. It goes to Straight Lines vs Straight Lines and Straight Lines vs Circular Arcs. The time complexity here's O(E) but not O(1), as E instead of 1 straight lines have to be checked against. The combined time complexity will be O(E) in this case. Simple Polygon vs Simple Polygons The reference point of the one with fewer edges will be adjusted to be that of the other. The time complexity here's O(1). Their bounded rectangles or circular sectors will be checked against each other. Checking a circular sector against a circular sector and a circular sector against a simple polygon goes to Circular Sectors vs Circular Sectors and Circular Sectors vs Simple Polygons respectively. Checking against 2 rectangles will be checking if the minimum and maximum x and y coordinates of one rectangle is less than or equal to and greater than or equal to the maximum and minimum x and y coordinates of the other respectively. The time complexity here's O(1). If their bounded rectangles or circular sector don't collide with each other, then neither do those simple polygons themselves. The combined time complexity will be O(1). If that's not the case, then check their inner rectangles or circular sectors against each other, which is essentially the same as checking the bounding ones against each other. If they collide, then so do those simple polygons. The combined time complexity will be O(1). If that's not the case, then check the arbitrary center of a simple polygon against the other simple polygon, which goes to Points vs Simple Polygons. If they collide, then so do the simple polygons. The combined time complexity will be O(E1 + E2), where E1 and E2 are the number of edges of those simple polygons respectively. If that's not the case, then it's certain that the neither simple polygon will completely lie within the other, meaning their perimeters must intersect in order to collide. So checking whether a triangle of a simple polygon touching its edges collide with that of the other simple polygon will suffice. As the number of triangles of a simple polygon touching its edges are E / 2 if E's even and (E + 1) / 2 if E's odd, both E1 and E2 are effectively reduced to E1_half and E2_half from now on. Check each triangle of a simple polygon touching its edges against the other's bounding rectangle or circular sector. Checking against the circular sector goes to Circular Sectors vs Simple Polygons. That against the rectangle will be checking the incenter of the triangle against the rectangle and the arbitrary center of the other simple polygon against the triangle, which goes to Points vs Simple Polygons. The time complexity will be O(1) but not O(E), as the number of edges of a rectangle's always 4. If the arbitrary center of the other simple polygon collide with the triangle of the simple polygon, then so do those simple polygons themselves. The combined time complexity will be O(E1_half + E2_half). If the incenter of a triangle of the polygon doesn't collide with the bounding rectangle or circular sector of the other simple polygon, then neither does the other simple polygon itself. The time complexity here will be O(E1_half + E2_half). Now both E1_half and E2_half will likely be further reduced significantly to E1_reduce and E2_reduce, making the last step, which costs O(E1_reduce * E2_reduce), much more efficient, meaning the added O(E1 + E2) and O(E1_half + E2_half) costs will probably be outweighed and the decreased O(E1_reduce * E2_reduce) cost. Finally check each triangle of the simple polygon touching its edges against those of the other, by checking each incenter against the other triangle, which goes to Circular Sectors vs Simple Polygons. If either collides with the other triangle, then so do those triangles, and thus the simple polygons themselves. The combined time complexity will be O(E1_reduce * E2_reduce). If that's not the case, then it's certain that neither triangle will completely lie within the other, meaning their perimeters must intersect in order to collide. So checking whether the edges of those triangles touching those of the simple polygons intersect will suffice. It goes to Straight Lines vs Straight Lines. The combined time complexity will be O(E1_reduce * E2_reduce) in this case. In practice, the average case, which is probably O(E1 + E2), are likely more realistic then the worst case. Shape Collision Detections On Maps Suppose there are n objects on a map. First use a aggregate bounding rectangle to bound those of all shapes. The time complexity here's O(n). Then partition the aggregate bounding rectangle into p parts, where p is the square number closest to n. Their difference should be small enough to treat p as n here, so the time complexity here's O(n). For each partition, check all shapes colliding with that partition to see if any of them collide with the others, by checking all their combinations. The time complexity here's O(n ^ 2) for the worst case, and O(1) for the best and average case, as most of the shapes usually won't concentrate in any single partition for a long time. It also means the average case's more meaningful here. The combined number of collision detections per frame's O(n) for the average and best case, and O(n ^ 2) for the worst case. The combined time complexity of all collision detections per frame's O(n) for the best case, O(n * E_avg), E_avg being the average number of edges of all simply polygons, for the average case, and O((n * E_max) ^ 2), E_max being the maximum number of edges of all simple polygons, for the worst case. Even myself feel and think that this algorithm's extremely dumb and incredibly ridiculous, but as I'm still really a computer science and maths nub, right now that's the best I can come up with. If you've any alternate algorithm, and/or comments on mine, just feel free to drop your 2 cents here.
  2. Those not knowing what concurrency is can check this :P As I only know the fundamental concepts, I can only share the basics here. You're still assumed to have a basic knowledge on graphs though :) As a centralized clock is used to process all components, there can only be 1 decided execution sequence per frame, meaning all those connected graph will be connected simple digraphs. To keep concurrency easier, simpler and more straightforward, its focus will be solely on connected simple digraphs only involving reading states from a component and writing states to a component via atomic operations exclusively. If an arrow is directed from component A to component B, then component A is writing some states of component B using some states read from component A at that moment. Also, the whole concurrency graphs will be entirely generated and then immediately executed per frame, with the aid of the below additional rule set operated as a whole per frame as long as there are still at least 1 vertex in that frame: 1. Only vertexes with the min indegree or arrows directed to those vertexes right before those arrows are removed can be the 1st one to be executed in the execution sequence. 2. Executing a vertex once means executing exactly 1 arrow directed from that vertex once. 3. An arrow will be removed right after it's executed once. 4. A vertex will be removed from the graph right after it becomes disconnected. 5. The execution sequence will be finished when the graph has no more vertexes. Now there are 3 keys factors affecting concurrency - whether the graph's acyclic/cyclic, whether the max indegree of the graph's 1/greater than 1, and whether the max outdegree of the graph's 1/greater than 1. This leads to 8 cases to be considered: Acyclic connected simple digraphs with max indegree/outdegree 1 This is the easiest, simplest and most straightforward case among all the 8. The concurrency graph begins from something like this: Component A1 -> Component A2 -> Component A3 -> ... -> Component An The execution sequence is as follows: 1. As only Component A1 has the min indegree(0 in this case) and no arrows are executed yet, Component A1 will be executed once(Rule 1). 2. As only 1 arrow's directed from Component A1, it'll be executed once(Rule 2) 3. That arrow will be removed right after it's executed once(Rule 3). 4. As Component A1 becomes disconnected, it'll be removed from the graph(Rule 4). Now that graph becomes this in the same frame: Component A2 -> Component A3 -> Component A4 -> ... -> Component An It's crystal clear that the above 4 setups will be repeated until Component An is removed from the graph. As that graph has no more vertexes, the execution sequence is now finished(Rule 5). It's crystal clear and obvious that there are absolutely no concurrency issues in this case at all as there are only 1 possible ordering. Acyclic connected simple digraphs with max indegree 1 To further simplify this case, let's restrict it to be a specific example having max outdegree 2. The concurrency graph begins from something like this: Component A -> Component E -> Component G | | | V V Component F Component B -> Component D | V Component C The execution sequence is as follows: 1. As only Component A has the min indegree(0 in this case) and no arrows are executed yet, Component A will be executed once(Rule 1). 2. An arrow's directed from Component A, it'll be executed once(Rule 2) 3. That arrow will be removed right after it's executed once(Rule 3). Now that graph becomes this in the same frame: Component A -> Component E -> Component G | V Component F Component B -> Component D | V Component C Note that there are now 2 connected simple digraphs and that having Component B is an acyclic connected simple digraphs with max indegree/outdegree 1. Concentrating the other connected simple digraphs: Component A -> Component E -> Component G | V Component F Repeating the above 3 steps will lead to Component A being removed, as it's now disconnected from that graph(Rule 4). Now that graph becomes this in the same frame: Component E -> Component G | V Component F Repeating all the above, the execution sequence will eventually be finished due to the graphs having no more vertexes(Rule 5). It's crystal clear and obvious that there are absolutely no concurrency issues in this case at all as the ordering certainly doesn't change any read nor write result. Acyclic connected simple digraphs with max outdegree 1 To further simplify this case, let's restrict it to be a specific example having max indegree 2. The concurrency graph begins from something like this: Component A Component B | | V | Component C <----+ As both Component A and B have the min indegree(0 in this case), either of them can be executed first(Rule 1). Suppose Component A, B and C have states a, b and c respectively. Assume that: 1. Using state a to write the state of Component C previously being state c will change it to ca. 2. Using state b to write the state of Component C previously being state c will change it to cb. 3. Using state a to write the state of Component C previously being state cb will change it to cba. 4. Using state b to write the state of Component C previously being state ca will change it to cab. If Component A is executed first followed by executing Component B, the final state of Component C will be cab. If Component B is executed first followed by executing Component A, the final state of Component C will be cba. Now concurrency becomes a nontrivial issue, as the result of Component C depends on which of them will be executed first. 1 way to solve this is to implement some deterministic rules deciding which components will always run first for the exact same situation. Acyclic connected simple digraphs To further simplify this case, let's restrict it to be a specific example having max indegree/outdegree 2. The concurrency graph begins from something like this: Component A -> Component B | | V | Component C <-------+ There are 3 possible choices on the execution sequence: 1. Component A -> Component B, Component A -> Component C, Component B -> Component C 2. Component A -> Component B, Component B -> Component C, Component A -> Component C 3. Component A -> Component C, Component A -> Component B, Component B -> Component C Suppose Component A, B and C have states a, b and c respectively. Assume that: 1. Using state a to write the state of Component B previously being state b will change it to ba. 2. Using state a to write the state of Component C previously being state c will change it to ca. 3. Using state ba to write the state of Component C previously being state c will change it to cba. 4. Using state ba to write the state of Component C previously being state ca will change it to caba. 5. Using state a to write the state of Component C previously being state cba will change it to cbaa. Choice 1, 2 and 3 will cause Component C to have state caba, cbaa and caba respectively. Note that both choice 1 and 3 will lead to the same result. It's because right before Component B -> Component C, the Component B will always have the state ba, meaning the ordering between Component A -> Component B and Component A -> Component C doesn't matter at all. Connected simple digraphs with max indegree/outdegree 1 The concurrency graph can begin from something like this: Component A1 -> Component A2 -> Component A3 -> ... -> Component An ^ | | | +------------------------------------------------------+ As all Component Ai(1 <= i <= n) have the min indegree(1 in this case), either of them can be executed first(Rule 1). It means there are n choices on the execution sequence. If Component Ai is the 1st one to be executed, that graph will become this at the same frame after Component Ai has executed once: Component Ai + 1 -> ... -> Component An -> Component A1 -> ... -> Component Ai Suppose Component Ai has state ai and using state x to write the state of a component previously being state y will change it to yx. If Component Ai is executed first, the state of Component Aj(1 <= j <= n) will be: 1. aja(j - 1)a(j - 2)...ai for j > i 2. aja(j - 1)a(j - 2)...a1ana(n - 1)a(n - 2)...ai for j <= i Clearly the state of Component Aj changes as i changes. 1 way to solve this is to cache the state of each component in all cyclic connected simple directed subgraphs right before executing that graph. Now if an arrow is directed from component A to component B, then component A is writing some states of component B using the cached state of Component A. So if Component Ai is executed first, the state of Component Aj(1 <= j <= n) will be: 1. aja(j - 1) for a <> 1 2. a1an for for = 1 It's because the cached state of Aj will always be aj in the same frame. Therefore the state of Component Aj becomes completely independent of i, meaning the choice on the execution sequence no longer matters. The essence of this trick is to make cyclic connected simple digraphs effectively behave like acyclic connected simple digraphs. Connected simple digraphs with max indegree 1 To further simplify this case, let's restrict it to be a specific example having max outdegree 2. The concurrency graph begins from something like this: Component A1 -> Component A2 -> Component A3 -> ... -> Component An -> Component B ^ | | | +------------------------------------------------------+ If the state of all Component Ai(1 <= i <= n) are cached right before executing that graph, the choice on the execution sequence won't matter anymore, as it's effectively the same case as acyclic connected simple digraphs with max indegree 1. Connected simple digraphs with max outdegree 1 To further simplify this case, let's restrict it to be a specific example having max indegree 2. The concurrency graph begins from something like this: Component A1 -> Component A2 -> Component A3 -> ... -> Component An <- Component B ^ | | | +------------------------------------------------------+ If the state of all Component Ai(1 <= i <= n) are cached right before executing that graph, the choice on the execution sequence should be decided by some deterministic rules always giving the same result for the exact same situation, as it's effectively the same case as acyclic connected simple digraphs with max outdegree 1. Connected simple digraphs This is the most complicated, convoluted and toughest case among all the 8. To further simplify this case, let's restrict it to be a specific example instead of using a general form. The concurrency graph begins from something like this: +-------------------------------------------------------------------------------+ | +------------------------------------------------------+ | | | | | | V | | +-> Component B1 -> Component B2 -> Component B3 -> ... -> Component Bn -> Component D | | | | | ^ | V V V V | +-> Component A1 -> Component A2 -> Component A3 -> ... -> Component An <- Component C | ^ | | | | | | | +------------------------------------------------------+ | +-------------------------------------------------------------------------------+ If the state of all Component Ai and Bi(1 <= i <= n) are cached right before executing that graph, that graph will effectively behave as a acyclic connected simple digraphs. Nevertheless, it's better to just cache the states of all components before executing the graph, as sometimes the graph can still have rather troublesome concurrency issues even after solving all the cyclic parts. Summary To solve concurrency issues using a centralized clock: 1. For connected simple digraphs with max indegree greater than 1, some deterministic rules should be implemented to be always making the same choice on the execution sequence on the exact same situation. 2. For cyclic connected simple digraphs, the state of each component in all cyclic connected simple directed subgraphs should be cached right before executing the original graph. When component A is writing some states to component B, the cached state of component A instead of the state of component A at that moment should be read and used. 3. To play safe, consider just caching the states of all components before executing the graph, as sometimes the graph can still have rather troublesome concurrency issues even after solving all the cyclic parts. For those completely mastered concurrency, feel free to correct me if I've made any mistake :D
  3. This post aims to cover the basic knowledge on Component Cohesion/Coupling Digraphs(Com Coh/Cou Digraph, same below). Subsequent replies will demonstrate some practical applications in some plugins. You're assumed to have a basic knowledge on: 1. Block diagram 2. Cohesion 3. Coupling 4. Digraphs Component Diagram Cohesion Diagram Coupling Digraph Com Coh/Cou Digraph Summary That's all for now. As mentioned, I'll use some plugins to demonstrate some practical applications in the subsequent replies.
  4. We all know the RPG Maker communities consistently have dozens of acknowledged excellent scripters, and how indispensable they're to the communities as a whole. While we, including scripters/plugin devlopers, all have our own criteria when judging how excellent a scripter/plugin developer is, it might do even more good if we share ours here and collect them in a single poll. That way, scripters/plugin developers can become even more contributing to the communities when they know what the communities as a whole expects from them. Of course, the choices in this poll are by no means exhaustive nor given, they're just collected by myself using my own scripting/plugin devlopment experience and observation on the communities, and myself(an incredibly nub scripter/plugin developer) as an excellent counterexample of what an excellent scripter/plugin developer means :grin: So just feel free to drop yours here when they're not in the poll, and/or comment on those where you don't feel/think they should be in the poll :) P.S.: I hope this topic won't end up involving countless unending fierce debates that are all completely out of our control, as I don't want this to be locked :P
  5. This topic in RMW triggered my alarm: Plugins from Scripters are being sold without their consent in this site! And the below link is the mentioned site: http://iloverpg.tk/ I know it's not good to cite a topic in RMW here, but I want to make sure that: - All the resource makers as victims are aware of this scam - All of you here will never fall into this scam And I think it's really important, even though those having heard of Victor Sant, one of the victims, will immediately know it's a scam :) To prevent being a victim by buying resources with are actually free via those fraudulent sites, I'd suggest you to search their terms of use before purchasing. If a site ask you to buy a resource without letting you to read its terms of use beforehand, you should have strong enough evidences and reasons to suspect that it's a scam :grin: P.S.: As far as I know, the below resource makers are some of the known victims there: - DoubleX - Soulpour 777 - Victor Sant There are also some tilesets and enemies graphics being utilizes by those liars, but I don't know the names of those resource makers as victims lol
  6. So you mean those specific atb systems, but not the entire atb system concepts right? Agreed. Just be careful that giving too many options can drive some players off(I think it can be easily countered though, like encapsulating the advanced options in the "Advanced Options" selection or something like that).
  7. I want to know what are disliked in specific atb systems or the atb system concept in general. Just feel free to share that :) For instance, I dislike atb systems with: Fixed atb wait condition - Sometimes I might want to be more relaxed, so I might want the atb wait condition to be true whenever a party member can act(the loosest atb wait condition); Sometimes I might want more challenges, so I might want the atb wait condition to be true only when an action's executing or a message's displaying(the strictest atb wait condition). Therefore as a player, I want to be able to change the atb wait condition on the fly. Hidden actor atb bars - To me, it's like hiding the actor hp, mp and/or tp bars. As atb bars display their actors' atb values, which is one of the most important information in atb system battles, I want to be able to keep track of them easily. At least, if the actor atb bars are hidden by default, I want to be able to change that to be shown instead.
×
×
  • Create New...