Jump to content
  • Advertisement

GCoder

Member
  • Content Count

    96
  • Joined

  • Last visited

Community Reputation

164 Neutral

About GCoder

  • Rank
    Member
  1. Hi, Just as a note, its really the other way around...its not that the CPU usage is high because your FPS is low (although it amounts to the same thing) its that your code is taking more time with the frame limit in, which means more cpu usage which results in a lower FPS and vice versa. For all my game coding I scale everything by a frametime. If I'm moving an object at say 10 units per second...I multiply that 10 units by the current frame rate time eg: 1.0f/60f (assuming the game was running at 60 fps) and then the object would be moved the correct amount in that frame. No matter what the framerate drops to or rises too, the speed of the object would then be correct relative to the speed the game is running at. This way you don't even need to limit the fps, the game can just run as fast as it can and with all the move ment time based in this manner it is always correct. You can time base everything this way....rotations....movement. You can calculate simple timers this way simple by having a float for example and adding or subtracting the frametime to count up or down in seconds. Really handy. We use it all the time at work...our whole game code timing system uses this method. This frame rate by the way is calculated every frame at the end of a game cycle. So its continually being updated. Granted it's always a frame out because its based on the speed the last frame was processed but this is totally acceptable. Hope that helps a little...its maybe not the actual answer you're looking for but hopefully it helps your thought process ;o) GCoder
  2. GCoder

    array of structures

    Well to be honest your explanation seems to over complicate the whole thing to me. I am only speaking for myself though I wasn't implying anyone else would find it clearer, just that its another way to define the structure. Im coming from a C point of view I should point out. I use C at work for all gamecode. From my point of view, the code itself is clearer if I say: typedef struct Dog_s { Limb l[4]; void (*bark)(void); } Dog; This reads to me (and most of the programmers I work with I would imagine) as: "Dog" is a structure. A "Dog" has 4 limbs and a function to start a "bark". Im not arguing whats better. I just happen to prefer it this way. Also in your last example you'de declared a structure only when I was referring to the type definition of a structure without needing to forward declare it, being my point about the readability. Hey ho...we all have our ways :) GCoder
  3. GCoder

    array of structures

    Just for interests sake, I find it much more readable to define a structure this way : typedef struct mystruct_s { int blah; float blahblah; } MyStruct; then to allocate an array of this structure : MyStruct myarray[10]; It just seems clearer to me :) Of course it amounts to the same thing just that the MyStruct type can be defined inside the type definition itself all in one go. GCoder
  4. GCoder

    gluLookAt() Z Axis

    Allo! Its been a while since I looked through my OpenGl Redbook (which I highly recommend you read if you havn't already taken a look) but I seem to remember it explaining situations like this to a degree. There are 2 ways you can look at it, 1) your scene origin is the world origin, and the camera and other objects are placed/moved relative to that, or 2) your camera is the world origin and everything else including the scene is moved relative to that. I would say the more natural way to view things is case 1) but the way opengl actually works it kind of helps to picture case 2)....so that to move the camera backwards 1 unit, you have to move EVERYTHING else forward 1 unit, and vice versa. So when you use "gluLookAt(0.0f, 0.0f, 1.0f..." what you're really doing is translating the entire scene, not really moving the camera, does that make sense? Basically it comes down to translating the scene by -camX, -camY, -camZ to get the actual movement you want. ...in a round about way anyway ;o) Hope thats of use =O) GCoder
  5. Just to throw my 2 cents in...or whatever it is ;o)... If you developed this system in your own time, outside of the university (I don't mean physically) then its yours. So at least you can sit back and smile about that :) I work for a game developer and ive signed a contract of sorts that anything I do in work is considered the property of the company, which is fine. I can still go home and write an entire game (given the time =op) if I want and its all mine. So long as I don't use code from work etc. I'de be wary of handing it to anyone else to look over though. Don't get me wrong I think Sneftel has a great idea there but even a respectable uni prof is capable of persueing things like this for their own benefit. Cynical I know...but I've seen and heard it before. I would just be careful, I guess thats all Im suggesting as it would be a shame for you to miss the benefit of all that work yourself. Im just thinking further actually. Im not sure about the laws related to patents in your country or indeed the UK. Im not even sure its possible to patent your system. Not at the algorithm level anyway. Please anyone correct me on that if need be as Im interested to know. Its like the use of MP3 encoding, so far as I understand it one has to license the official MP3 enocoder but theres nothing to stop one writting their own compatible version. Ogg Vorbis? The name escapes me. Anyway Im going off track...long day...aching from exercise...blah ;o)
  6. GCoder

    viewable area

    ....some topics to search google for that may help you: - Clipping - Back face removal/Back face culling/frustum culling - Quadtrees/Octtrees - BSP trees Culling and clipping are ways of deciding what should be drawn or animated within an area or space. This can be as simple as "is a poly in front of the camera?" or "is a poly in front of the camera facing away or towards the viewer?"....to "is this object contained within the viewing frustum in camera space?" This is a wide topic and there are many ways to achieve what you want. Having a good read over those topics I listed should be of help at least. GCoder
  7. Power of 2 numbers are generally more optimal in a binary microprocessor ;o) Nah seriously, its going to be faster to process and handle textures of ^2 dimentions. They'll fit in memory better, easier to align, faster to process etc etc etc On the mipmapping note...that is a seperate issue really. That relates to a "many texels to one pixel" problem when texture mapping. As mipmaps are prefiltered versions of a single high resolution( relatively speaking) texture map, they reduce the problem of picking the appropriate texel for rendering in screen space, when the object in question is far from the viewer. This is also related to antialiasing. A google search would clear that up and explain it properly! =op GCoder
  8. I might be stating the obvious here but if you havn't already tried it, try reversing your matrix multply as the order DOES matter. ie: D3DXMatrixMultiply( &object_transform, &rotation_matrix, &translation_matrix ); to D3DXMatrixMultiply( &object_transform, &translation_matrix, &rotation_matrix ); ...one way you're rotating...then translating, which should give you rotation about the local axis...the other way, you're translating then rotating which should give you the rotation about the world axis. If in doubt, draw it in 2D say looking down the y axis, with a single point at something simple like (1.0, 1.0) and do the rotation maths by hand...or even just look at it visually translating first then second and take a look at the results. Hope Im not teaching you to suck eggs here ;o) GCoder - Just re-read...I guess this isn't helping if 2 of your axis are fine....hmmMmmm strange
  9. GCoder

    Relative Camera Like Mario64

    Hallo, If I understand you correctly, what you're talking about is directional control, where as good ole' Lara "Truck" Croft used rotational control ;O) If you've already got your camera stuff set up, then its more or less just a case of creating a direction vector from the pad input (or keyboard...whatever) and then rotating this by your camera's world Y rotation. So effectively making the input control relative to the camera orientation. So which ever way the camera is facing, if you press right say, you're creating a heading vector along the X axis ideally...and then rotating this by whatever the cameras world Y is will take that vector in the X axis and turn it into a vector in the camera's X axis, or "Camera space X". Does that make sense...I tend to babble my way through explanation :op Of course you'll have to handle orientating the character too so if they're facing "left" and you hit "right" they'll either have to snap round some way or more likely rotate about their Y axis until they're facing the new heading vector's direction. you can just interpolate their rotation over 1/4 of a second...or something, whatever looks right. Perhaps doing the rotation before you start their actual movement along the new heading. Experimentaion and tweaking is the key when you get the basics working. Mario turns very quickly which give him the fast snappy Mario feeling, which I like very much. Sorry I've no links and I've no code in front of me at the moment that I can post, but hopefully thats given you at least an idea how you could do it GCoder
  10. I've used www.pcbooks.co.uk before.....not the cheapest generally but sometimes they have reasonable offers. I'm just looking in the bargains section now =op By the way its changed to www.holbornbooks.co.uk now by the looks of things. www.blackwell.co.uk is another I have a look on now and again. I have to agree with theZapper though....Amazon market place or ebay (if you're lucky enough to find what you want) are both great. GCoder
  11. Yea! thats great...looking good. looks like the alpha on the outer edge isn't completely transparent? You can just see the edge where the halo renders over the moon. Looking forwrad to more screen shots :) GCoder
  12. Just re-read your post...and Peregrins response... If you used the technique I proposed you might actually want 2 strips so you can have a proper halo effect, as in a proper ring with alpha on the inside and outside vertices and solid vertices in the middle...I hadn't thought that bit through at the time ;) it's still damn cheap though...without needing a texture too :) Good luck GCoder
  13. Why not build a triangle strip in a ring with the inner vertex colours blue, and solid and the outer vertices blue but alpha'd? You could then pass a parameter in to the build or render function with the radius, perhaps even the vertex colours too for the inner and outer. Then you can use it on any sized sphere with no trouble at all. You might want to specify the outer radius too perhaps. This will also be cheap, but give you more control and flexibility. You just need too build a billboard matrix to make it face the camera but that shouldn't be a problem. Also be aware of these type of effects cutting through the floor/other objects etc... Hope thats another angle on the idea for you. GCoder
  14. GCoder

    Rising Gas prices

    I have to agree with Thermodynamics. The funny thing about our fuel prices in the UK for me, is that I only begrudge paying the high prices while the government take so much tax out of it. Apart from that fact, I see society heading towards a situation where there is no choice but to use an alternative renewable fuel source. If paying extra now helps reduce the amount we use (in some strange logic of mine hehe) then so be it. Also, I have no facts for this but I imagine the US to be one of the largest fuel consumers on the planet, and also one of the highest polluters (please correct me if Im wrong, Im not trying to argue...). Yet I can't imagine the US government raising fule prices anywhere near what we pay in the UK at least, even if it did help cut the amount consumed. I saw an article on the news the other day which was interesting about BMW's hydrogen powered cars....that sounds great... :)...also i've been told that you can actually run some diesel engines on vegatable oil. Hmm great idea, but even with our fish and chip shops pumping out used oil could we produce enough to meet demand =op....before the government came along and put 60p a litre tax on it ...;o)
  15. GCoder

    Rising Gas prices

    Well if us Europeans will insist on driving round in those big gas guzzling 4 or 5 litre cars...chugging along getting about 10 miles a gallon...oh hang on I've got that wrong havn't I.... hehe ;o)
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!