# Trillian

Member

844

410 Neutral

• Rank
1. ## Position and velocity at the surface of a sphere

Thanks for your input, Emergent. I did not think about using an atlas of projections, though I did read about charts on wikipedia. It looks like a good approach but a bit touchy to handle. When using those, do you represent velocities in the projected space or in "normal" cartesian coordinates? For the "embedding" solution, how well does this work in practice? I would imagine that as the speed of an object gets faster relative to the radius of the sphere, the actual distance moved on the surface of the sphere gets smaller after clamping, though maybe an iterative solution could diminish the problem. As I said I'm not too familiar with quaternion so maybe my suggestion makes no sense, but would it be possible to use them for position and velocity? Is attempting to represent velocity in non-cartesian coordinates a flawed idea?
2. ## Position and velocity at the surface of a sphere

I've recently played Super Stardust HD (youtube video) and have been curious about how positions and especially velocities could be represented in such a game. I'm currently in an internship where we develop a software which does simulation on the surface of the earth, and positions are represented using latitude/longitude/altitude at the macro level (when manipulating the globe like in google earth) and cartesian coordinates at the micro level (where it looks more like an RTS game). However, I'm no math guru but I'm quite sure using cartesian coordinates cannot work for a small sphere like that of Super Stardust HD. Spherical coordinate systems using a latitude/longitude approach seem better than cartesian coordinates but, while they can easily represent positions, I have the feeling they'd break pretty fast when trying to represent velocities. Also, the precision of the longitude value changes radically as the latitude changes, and I get the impression that poles would have to be handled with special cases to prevent divisions by zero or similar problems. I guess a mixed approach could be used where the velocity is in cartesian coordinates and everything is mapped back to spherical coordinates after moving but that doesn't seem very robust. I have nearly no experience with quaternions, but I've been thinking that they could possibly be used for that purpose. It seems to me that a position and rotation on the surface of a sphere is pretty much analogous to an orientation, and that quaternion slerps could be used to "move" (or "rotate") on the surface of the sphere without the limitations of angles. Could this work? Are there other representations I didn't consider? Could hybrid approaches work? I'd love to hear input on this. Once again, I'm no math guru, so please link to explanatory articles if your replies get math-heavy.
3. ## What Does Everyone Think About The New Site Layout?

I like the feel of it but I'll add my vote to reduce the height of most elements. Too much scrolling needed.
4. ## Adapting a room from DOOM's E2M7 to the TI-83+ calculator

This project is totally cool. I'd love to see it in motion. Is there a way I can convert it to run on a Voyage 200? Otherwise, a Youtube video would be great. Great job, it's really impressive.
5. ## Would you use this VS2010 extension?

I just tested, embedding explorer windows works well. When I say "works well", I mean it's useable. Applications typically do not behave perfectly once docked in VS, and I don't think there's much to do about it as I consider my docking trick to be a hack. For example, embedded explorer windows do not seem to receive mouse wheel events, so you have to scroll using the scrollbar. Another example: once you've detached a google chrome tab, you cannot attach it back inside a docked window.
6. ## Would you use this VS2010 extension?

Yeah, multiple displays (and virtual desktops) rock, I agree they are generally much more useful than my extension. It is a more of a small gimmick that can be useful once in a while. I can't say I've used it often myself but it has still been fun to have it the few times when the need has arisen.
7. ## Just went from WinXP to Win7 (nanoRant)

I actually love pasting in a command window. You can do it with this cool keyboard shortcut: alt+space, E, P It's even cooler if you're using Windows in french, as I am: alt+space, M, O Yes, it's weird, but it impresses work collegues :)
8. ## Would you use this VS2010 extension?

Hi GDNetters, I've developed an extension for Visual Studio 2010 which enables to dock any window within the VS Shell. It's currently very bare-bones. It works, but exhibits quite a few glitches, although it's fine for my personal usage. For example, while working on an AA Tree implementation, I had docked google chrome with a few reference sites, mspaint to draw trees and Windows Media Player for music: Another use case: I had hosted notepad++ in a tab group in order to have ASM syntax coloring (which VS doesn't have) and have C code in another tab group beside it. It can even host whole games (Portal worked fine) so you can have them in a code tab and quickly ctrl+tab when the boss is coming :) So, I was wondering: am I the only guy crazy enough to use this or should I polish it up and submit it to the Visual Studio 2010 Extension Gallery? Would you use it?
9. ## Fishy A* behavior

I've done some additional tests and am now I understand more of what's going on, and it seems it could be normal. First, I've tested what happens if the path is perfectly diagonal. In that case, shorter path to open nodes are never found either. It only happens when the path is in semi-diagonal (between 0 and 45 degrees). The pathfinder follows a north-east diagonal, but and then "comes back" to attempt going east directly as the diagonal was "too costly". It seems to me that in this situation, binary heaps will perform poorly as the open nodes' G cost will have to be modified almost as frequently as the best open node will have to be popped.
10. ## Fishy A* behavior

I've just checked and it seems to happen only when the unit has to move diagonally. I still can't quite understand why there would be two paths diverging and merging back, as you (MortenB) suggest. I'll have a closer look at this.
11. ## Fishy A* behavior

Oops, sorry, I should have mentioned it: I'm using a simple euclidian distance for the movement cost between grid cells as well as the H cost. Diagonal movements are allowed and have a cost of sqrt(2).
12. ## Fishy A* behavior

Hello GDNet, long time no posted :) While looking into my A* pathfinding code, I've noticed that a condition which I thought happened quite unfrequently was actually happening very often: when attempting to add nodes to the open list, finding that the node is already in that list with a higher cost from the source ("G" cost). For example, in a pathfind where there are no obstacles in the way: 2817 nodes were opened. From those, 2128 nodes were later closed. In the process, a shorter path to an open node was found 1762 times. I don't understand how that last number could be so big. I thought that having a proper heuristic to estimate the destination distance ("H" cost) would make it an infrequent thing. Do these numbers seem fishy to you? Is it normal that a shorter path to an open node is found so often? Thanks for any help.
13. ## RTS Algo to detect serounding units

In my RTS game, I take the non-hierarchical grid subdivision approach. Depending on the size of the map, I split it in, say 8x8 rectangular "regions" which are really just a collection of units. As the units move around, they get added to the regions which they are in. This grid is also used for resource nodes. I currently allow units to be in multiple regions simultaneously, although that forces me to use a hash set on the results of my spatial queries to eliminate duplicate results, which is quite uncool, but as it doesn't seem to be a performance bottleneck, it's probably going to stay like that. One thing I've done to (somewhat prematurely) optimize memory usage is to have a pool of buffers shared by the entity collections in each region. That way, if there's a big army that moves on the map, it does not leave all the visited regions with big allocated buffers. Regions get their entity buffers from a pool and when the number of entities get low enough, they put their buffer back into the pool and get a smaller one. That worked quite fine for me and seems to be friendly enough on performance.
14. ## Wheeee

Now that we know the problem, what's the fix? You could force the execution of the query with a ToList() or similar, but if the deferred execution was intended, the only way I can think of implementing it is to code your own IEnumerable<ContentItemHeader> and IEnumerator<ContentItemHeader>, create your ArticlesDataContext in IEnumerable<ContentItemHeader>.GetEnumerator and dispose it in IEnumerator<ContentItemHeader>.Dispose. But that seems to be a lot of trouble...
15. ## Rotating normal-mapped sprites

Actually, WorldMatrix doesn't contain any projection for now. I'll need to implement proper projection later, but for now I work with an identity projection so coordinates within (-1,-1) to (1,1) are mapped to my viewport. WorldMatrix is a simple rotation matrix around the Z axis, this is why I did not normalize the normal after its transformation. As my transformation is only a rotation, I expected that using the same transform for the vectors and the normals would have done the job but, as I said, it makes no visible difference.