|
Citizen Erased posted:I think this has been addressed twice now in this thread but I can't wrap my head around it in the context of my application: p := sum of all positions / num verts (the origin of the ring in other words) q := position to look at T-p := Translation matrix along vector -p Tn := Translation directly 'up', n units R := Rotation matrix to 'look at' q-p, from the origin Tp := Translation matrix along vector p Transform for each vertex p' := p.T-p.Tn.R.Tp The only pain in the rear end is if the verts start off pre-rotated and you need to undo that rotation as well (which you can add here: ...T-p.S-1.Tn... ). And also keeping a consistent 'up' direction when generating your look at matrix.
|
# ¿ Dec 6, 2007 19:28 |
|
|
# ¿ Apr 28, 2024 04:49 |
|
f and n need to be negated before being passed in, by the looks of it. Since you're looking down negative Z, then the clip planes are actually at -0.1 and -500.0.
|
# ¿ Dec 12, 2007 14:38 |
|
fryzoy posted:As long as I am not totally misunderstanding you, you should be fine with adding the product of the direction vector (normalized) and thrust scalar to your momentum vector. D - Ship's forward vector V - Ship's current velocity F - Thrust m - Mass of ship dt - Timestep a = F/m V' = V + D*a/dt
|
# ¿ Jan 4, 2008 14:19 |
|
FBz posted:Thanks fryzoy and TSDK, that worked a treat! Now I need to figure out how to limit the speed, but I think I have an idea on how to do that. 1) Introduce drag, such that V' = V*drag ... where drag is between 0 and 1 and proportional to |V| 2) Modulate the thrust downwards proportional to the speed in the desired direction. This is a bit harder to do, and if you don't drop the thrust fast enough then you can end up going very fast just by wiggling from side to side whilst accelerating...
|
# ¿ Jan 4, 2008 15:48 |
|
FBz posted:Just to clarify, is |V| the Length of the Velocity Vector? EDIT: Oops, no it's not - the force is proportional to the relative velocity squared; it's the power required to maintain a constant speed against drag that goes up with the cube... FBz posted:What I had before is that I pre-calculated the maximum momentum vector based on my desired maximum speed and prevented the velocity vector from increasing any further when it hit this value, the ship would be travelling in a straight line when it hit this value. I think this was broken (or poorly implemented). TSDK fucked around with this message at 18:22 on Jan 4, 2008 |
# ¿ Jan 4, 2008 18:20 |
|
Collision detection has always been, and still is, about spatial partitioning. Use bounding boxes for quick checks to trivially reject collisions that can't possibly happen. Maybe subdivide the screen with either a kd-tree or quad-tree so that you don't check object versus object when they're completely contained in different leaves. Once you've pruned out all of the collisions that can't happen at a high level, then you're left with those that may happen at a lower level. How you check those will depend on what sort of sprites you've got and what sort of collision you want. It may be good enough just to subdivide the sprite down further and do overlapping box checks on a smaller scale. If you want to go pixel perfect, then you could alway render the overlap region offscreen using a logical-and mode and then scan through the vram with the cpu to check for non-zero results. Or you could store the min and max extent values for each line of pixel data in the sprite, and then for the overlap lines you're doing a 1d min-max overlap check. Basically, there are loads of options out there, and you'll only figure out which one is best after trying a few, profiling and weighing the cost up against memory footprint etc...
|
# ¿ Feb 18, 2008 19:38 |
|
Nibelheim posted:I'm a little confused on the tree solutions. Care to elaborate? You can put your sprites into two lists - those on the left half of the screen, and those on the right. Note that the lists are not mutually exclusive, as you can have a sprite straddling both. When running through the sprite versus sprite checks for sprites evenly distributed around the screen, then you've cut your work in half. You don't have to check the sprites in the left list against those in the right list, because they're nowhere near each other. For the quad or kd-tree, you recursively split the halves in two, then in two again etc... until you get a suitable level of granularity whereby you've cut down the number of sprite-sprite collisions, but not at too much of a cost in memory or overhead maintaining the list. Note that there are some different flavours of quad-trees, and node storage varies between them. For instance, earlier I could have said make 3 lists: left only, right only, and straddling both. What this means is that instead of duplicating pointers by keeping the elements in multiple lists, you're trading CPU time for memory by adding a traversal step where you check the lists in all of the parent nodes as well.
|
# ¿ Feb 18, 2008 21:25 |
|
Nibelheim posted:Things are much clearer now. Thanks. TSDK fucked around with this message at 13:48 on Feb 19, 2008 |
# ¿ Feb 19, 2008 13:45 |
|
brian posted:While we're on the subject of physics i've been trying to do a simple 2D implementation of Jakobsen's Verlet intergration system of using projection instead of penalty or impulse based collision and i've run into a snag. Basically for some reason the integration when combined with constraints is generating its' own torque and it actually looks pretty realistic if it wasn't for the fact it's not meant to be happening. http://teknikus.dk/tj/gdc2001.htm This gives the constraint satisfaction code as: code:
|
# ¿ Feb 25, 2008 18:57 |
|
brian posted:Thanks for the help, however I linked said paper at the end of my post, the reason for the changed constraint code is because it's using the later faster revision in the paper used to remove using costly sqrt() calls. brian posted:More to the point however, even with the slower and maybe marginally more accurate way from earlier in the paper the same behaviour appears with the constraint causing some odd torque. I really want to get onto intersection tests and proper rigid bodies so this is really annoying me EDIT: The other possibility is just that the order of constraint application is introducing the torque. It's been a few years since I last looked into this method, so my memory is hazy as to what results should be expected. TSDK fucked around with this message at 20:37 on Feb 25, 2008 |
# ¿ Feb 25, 2008 20:34 |
|
Mr Dog posted:This has been doing my head in for most of a day so far. Can anyone please tell me why this minimal Direct3D app is chewing nearly 100% of my CPU? Try doing a few other things whilst the app is running. If other apps run okay whilst yours is going, then the problem is just with the way Task Manager reports usage and not the app itself. Our old PC engine used to do exactly that - it would 'expand' to claim all unused CPU in the Task Manager display, but it would back off whenever other stuff was going on, down to the actual usage level.
|
# ¿ Apr 14, 2008 09:57 |
|
heeen posted:Your engine actually used 100% cpu, its just the premptive scheduler dividing the cpu up on all tasks when you start another one. If it were actually using 100% of the CPU, then you'd expect it to slow down when other tasks kick in. EDIT: On second thoughts, I suppose it could have been the sound thread doing some sort of retarded busy-wait. Our sound guy wasn't exactly the best programmer in the world, and he did do ridiculous things like setting his thread priority so high that it stopped the keyboard drivers from working properly on the low-end spec... TSDK fucked around with this message at 14:14 on Apr 14, 2008 |
# ¿ Apr 14, 2008 14:08 |
|
PnP Bios posted:Mr. Dog, it's because your program is using PeekMessage instead of WaitMessage. Instead of waiting for input, you are polling for it, which means your program is going to cycle through regardless of what's in the message, so your process running at 100% is perfectly normal. Unless you're writing a turn based non-realtime game, using WaitMessage in a game loop is mostly retarded.
|
# ¿ Apr 16, 2008 09:07 |
|
Wang tiling is your friend: http://en.wikipedia.org/wiki/Wang_tiles EDIT: Actually, it's a slightly higher level than that you want, isn't it? I'd probably look at grammar rules and markov chains. EDIT2: Have a look at this paper: http://graphics.stanford.edu/papers/texture-synthesis-sig00/texture.pdf What you basically want is a reference texture with some natural looking patches of grass, water edges etc... and then use texture synthesis to make larger maps based on those smaller samples. TSDK fucked around with this message at 18:01 on Apr 22, 2008 |
# ¿ Apr 22, 2008 17:49 |
|
DBFT posted:If I'm not mistaken aren't the methods you gave me more to do with how the map will appear (blending one tile into another, etc.) rather than making the layout of water/land/rocks/etc look natural? It might be worth seeing if the file format for Dwarf Fortress is easy to interpret - no point writing your own generation code if you can generate one in DF and then extract the map data to your own format.
|
# ¿ Apr 22, 2008 19:40 |
|
heeen posted:Edit: http://heeen.de/proj/refract.avi http://www.youtube.com/watch?v=hqLobCH8PFo This is a pretty good method for adding caustic effects, if you want to bump the bling up a notch. EDIT: There's also a nice technique which uses the water surface mesh rendered as triangles into a texture and projected onto the underwater geometry, where the brightness of the triangles is adjusted based on the size/gradient of the triangle relative to the rest size. This gives you sharper caustics, but I can't find a paper on it at the minute. They used that technique in the PS3 Big Duck demo. TSDK fucked around with this message at 10:41 on Apr 24, 2008 |
# ¿ Apr 24, 2008 10:28 |
|
forelle posted:Ooooh I invented something similar to this (but not as good) back in 2000ish.
|
# ¿ Apr 25, 2008 09:33 |
|
The single biggest selling point for COLLADA is that there are open source exporters for both Maya and Max. Even if you have to extend the exporters, then having a solid(ish) starting point is an absolute godsend for those starting afresh on a toolchain.
|
# ¿ May 22, 2008 17:24 |
|
OneEightHundred posted:Not really, FBX occupies the same niche and is closed-source.
|
# ¿ May 23, 2008 09:34 |
|
OneEightHundred posted:FBX and COLLADA both contain a shitload of information, I'm really not sure what more you'd want out of them. The whole Maya/Max interchange thing has come up very recently on another project as well, and neither FBX nor COLLADA manage to preserve the materials properly between packages.
|
# ¿ May 27, 2008 10:13 |
|
If you just want a quick and dirty method to stop people messing with the file, then hard-code a salt value into the exe and append the MD5 of the save file contents + salt to the end of the save file. It's not going to stop anyone with enough nouse to go through your exe to find the salt value and write a tiny tool to 'sign' modified save files, but then you were never going to stop someone with the skills to do that anyway.
|
# ¿ Jun 24, 2008 11:10 |
|
Gary the Llama posted:Should the Sprite class handle the rendering or the Player class? code:
|
# ¿ Jul 1, 2008 08:35 |
|
StickGuy posted:I'm not sure how scalable this approach is when you have, for example, many different types of objects that require special rendering techniques. It would get a bit messy to have all of that in one place. In principle, you can just think of the GPU and video memory as a set global variables that the code is setting. No matter how you separate out the code that sets the states and calls the rendering functions, all of the rendering calls have an effect on each other. You can't add in a HeatHaze object into a generic scene graph without considering the effect of the Bloom object that's already in there, or considering at what point your depth pre-pass is going to kick in and set up the depth buffer. By splitting rendering effects up between classes, you're trying to pretend that each entity can be rendered in its own right without consideration to other objects, and so then you'll spend the last third of the project having to remember rules like 'the sky box must be the first object in the scene graph' and 'the water nodes must be after the player nodes'. Both approaches are relatively common in game development, but I tend to prefer the centralised approach in general because it's a bit more 'honest' about what's actually going on, and usually offers better performance and scope for optimisation.
|
# ¿ Jul 1, 2008 14:30 |
|
Namgsemterces posted:Basically, I'm talking about a mask.
|
# ¿ Jul 16, 2008 17:16 |
|
OneEightHundred posted:11's features are basically:
|
# ¿ Aug 13, 2008 11:47 |
|
Morpheus posted:Hello folks I would like to ask a question about code design for a somewhat simple 2D platformer. I'm pretty sure how I'm going to go about doing all the design, but the biggest thing I'm not sure about is the most important: collision detection. This ties into the very core of the code, so it's kind of important to decide before I start, as this is my first 2D platformer.
|
# ¿ Sep 18, 2008 10:19 |
|
Good grief, you're all making it more complex than it needs to be. The original question is essentially how do you move a 2D character along, given sloped and non-sloped tiles. The easiest method to get the same sort of behaviour as old-school platformers is to move the character along horizontally, perform your collision check downwards from a central point: code:
code:
This also works when M is greater than N by less than a predefined amount, and the character will stick to the slope when walking downhill. Note that the predefined amounts by which you're comparing the difference essentially determine how steep the steepest slope can be for your character to walk up. Doing it this way gives you a relatively nice behaviour, without having to special case slopes with state machines etc...
|
# ¿ Oct 21, 2008 19:06 |
|
Avenging Dentist posted:Well, for one thing, I absolutely don't buy into his claim that variable-step integration methods are inherently inferior to fixed-step ones. While fixed-step integration is more predictable, integration methods like RK4 are perfectly suitable for variable-step integration, assuming the step doesn't vary too much. A good secondary benefit to fixing a timestep is that all of your physics code gets faster, because you've eliminated a shed load of multiplies.
|
# ¿ Dec 9, 2008 19:10 |
|
Vinlaen posted:I'm trying to create a "simple" networked/multiplayer 2D game and so I've been trying to a read a lot about networking principles, player synchronization, etc. However, it seems like most articles (eg. gaffer.org) tell you to send keyboard/mouse inputs to the server, have the server process them, and send the results back to the client. For example, in your hypothetical 2D sprite based game, you can probably compress all of the relevant inputs (up/down/left/right/jump/fire) into a byte or two. Depending on the size of the play area, you may need anywhere from four to eight bytes just to send a single player's 2d position.
|
# ¿ Jan 15, 2009 14:54 |
|
Unless you're going to go for a complete fluid dynamics simulation, then anything you write is going to be an approximation. As such, you're better off figuring out what sort of motion or effect you're after, and then working towards an equation that describes that. You could take a very simplistic approach to wind and just say that it's a constant force along X. In which case, it becomes exactly like your equation with gravity. Something like: code:
You can also add in very simple drag (again, constraining it to the horizontal if you so wish) by having the force vary with some function of vx. Pick a drag function to play with, plug in vx to get out f, divide by m, and plug that in as the acceleration. Try something simple like: code:
|
# ¿ Feb 11, 2009 00:29 |
|
not a dinosaur posted:And so far I haven't really found a solution.
|
# ¿ Apr 3, 2009 12:03 |
|
ZorbaTHut posted:Can anyone give me a page talking about standard techniques for making platformers? I've had trouble coming up with an elegant way to handle collisions and slopes and the like - I've got a few ideas, but they all seem more complicated than necessary. Can anyone sum up a standard technique in, like, ten lines?
|
# ¿ May 19, 2009 13:35 |
|
SkankerX posted:I've got an interview for a game programming position coming up. I worked as a game programmer about a year ago, so the math isn't new to me. BUT, I really need to brush up on linear algebra stuff again, just to be able to answer any questions. Are there any solid overview sites available? I'm not really looking for proofs as much as just various cookbook-esqe pointers. Relationship between dot-product and angles / magnitude, etc. http://softsurfer.com/algorithm_archive.htm
|
# ¿ Jul 1, 2009 12:11 |
|
Yes, there is another way without going through the decomposition route. For composite transformations like the ones you've got, rotations (and I'm fairly certain scales as well) can just be concatenated, ignoring the influence of the other transforms. So the rotation for the child in model space is just the product of all of the rotations from the bone down through the hierarchy to the root. Likewise with the scales (if I remember rightly). For translations, you have to form a complete matrix from all of the rotation, scale, translation parts of all of the bones down to the root. You then run the vector [0,0,0] through the matrix, and that's the bone's location in model space (or just pull the appropriate row/column out of the matrix, which amounts to the same thing).
|
# ¿ Aug 4, 2009 20:32 |
|
Double post!more falafel please posted:- multiply ParentScaleMat * ParentRotMat * ParentTransMat to get ParentTM
|
# ¿ Aug 4, 2009 21:23 |
|
|
# ¿ Apr 28, 2024 04:49 |
|
OneEightHundred posted:That doesn't matter. Row and column major matrices are interchangable for processing, as long as you keep them consistent and know how matrix math works so you don't gently caress the order up.
|
# ¿ Aug 5, 2009 13:57 |