• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

222 Neutral

About Imgelling

  • Rank
  1. C# Compiler Error

    I created a new Windows console project; commented out the generated code; and copy and pasted your code. Built without debugger (Ctrl+f5 for me). Worked fine. Just a few ideas... 1. Try creating a new project and copy/paste your code into it. Maybe a setting got messed up. 2. Rebuild the whole solution. Weird things happen to me and this fixes it sometimes (from menu, Build ->Rebuild Solution and the shortcut is set to Ctrl+Alt+F7 on mine)
  2. Calculating Angle Of Deflection

    In my pong game I made many moons ago, I just negated one of the vectors depending on which side I hit. // Collide with something on the left or right x = -x; // Collide with something on above or below y = -y; This gave a "perfect" bounce for walls at 90 degree increments. I say "perfect" because it doesn't take friction, spinning of the ball, energy loss to deformation or heat, etc. For walls of 45 degrees, I think just swapping the vectors should work. // Collide with a 45 degree wall z = x; // temp for swap x = y; y = z; Now for walls at any given angle. [s]Since angle of hit is = angle of rebound, you will need to find a 2D vector perpendicular to the 2D vector you have.[/s] I don't know. Edit: I would ponder it for a bit, but it is time for me to get ready to shove tons of food down my throat. Happy Thanksgiving!
  3. [quote name='PiCroft' timestamp='1319792412' post='4877821'] Thanks, that's useful! I need to make the object rotate correctly too, I'm using a second object hovering slightly in front of the main object thats invisible, so the object always rotates to face it. It doesn't look right atm, but Its a good stop-gap until I can make a movement algorithm that correctly applies physics to it. [/quote] Not sure if you are doing this already but it will be a smoother curve if instead of using constants for acceleration, the += -= 5's and 10's, is to make it time based. Like so... float VERTICAL_ACCELERATION_PER_SECOND 10 if (button.ispresssed()) { vertical.velocity += (int)( VERTICAL_ACCELERATION_PER_SECOND * Timer.MillisecondsElapsed / 1000.0f); } where Timer.MillisecondsElapsed is the amount of time taken since the last frame. This is the method I use in my 2D tile engine testing to give my character the ability to jump in a smooth curve which can be seen [url="http://www.youtube.com/user/chxfryer1#p/a/u/2/CbmYFMQxKc0"]here[/url]. He is a bit "floaty" but that is because I haven't gotten the gravity number down just right. Basically, there is a constant gravity pulling down on him adding to his velocity, 32 pixels per second per frame. When he stands on a block, the block is pushing him back up and resetting his vertical velocity to 0 pixels per second. To jump I add a force to him by setting his vertical acceleration to -1000 pixels per second and let the gravity that is applied every frame do the work for me. Horizontal movement is just adding/subtraction a horizontal acceleration and when left/right is not pressed, the acceleration rapidly returns to 0. I know it is not exactly what you are trying to achieve, but maybe it will give ya some ideas.
  4. [quote name='PiCroft' timestamp='1319728613' post='4877578'] Hello, I'm trying to create a simple 2D game where an object is flying at a particular height at constant velocity. When I press a button, the object starts to dive, the dive getting steeper the longer you hold the button. When you release the button, the object levels out, then starts to climb back up to its original height. Could someone give me some math pointers for making this mechanic? [/quote] Have your object have 2 velocities, horizontal and vertical, that do not interact with each other (as in real life). Have the horizontal velocity stay the same. When you press the button accelerate the vertical velocity so that it starts going down. That will need to be incremented each frame the button is held down. When the button is released, just have the vertical velocity decelerate to 0. if (button.ispresssed()) { vertical.velocity += 10; // this could be -= all depends on how to set it up } else { vertical.velocity -= 10; // this is opposite of the first one if (vertical.velocity < 0) vertical.velocity = 0; } Edit: Not sure if you wanted to decrease horizontal velocity during "diving". Doing so would make the dive even steeper. if so, it would change to something like... if (button.ispresssed()) { vertical.velocity += 10; // this could be -= all depends on how to set it up horizontal.velocity -= 5; //this could be += all depends on set up if (horizontal.velocity < 0) horizontal.velocity = 0; } else { vertical.velocity -= 10; // this is opposite of the first one if (vertical.velocity < 0) vertical.velocity = 0; horizontal.velocity += 5; if (horizontal.velocity > MAX_HORIZONTAL_VELOCITY) horizontal.velocity = MAX_HORIZONTAL_VELOCITY; }
  5. Check this guy's journal out! [url="http://www.gamedev.net/blog/950/entry-2249317-a-guide-to-getting-started-with-boostasio/"]http://www.gamedev.n...with-boostasio/[/url] Helped me out. Edit: Realized you solved your problem. But still, that entry is a good read for ASIO.
  6. Forgot to talk on your post. I have written an OpenGL version of SpriteBatch (from XNA). Not a perfect copy but performs well. spritebatch.cpp [url="http://pastebin.com/BpU8HfAV"]http://pastebin.com/BpU8HfAV[/url] spritebatch.h [url="http://pastebin.com/5kn4vC2P"]http://pastebin.com/5kn4vC2P[/url] Uses GLSL to render and pre-made VBO. Automatically renders when the VBO is full / texture swaps / spritebatch.end() is called. And simple usage.. [source] spriteBatch.Begin(); { spriteBatch.DrawString(font,str.str(),5,5,color); spriteBatch.DrawString(font,mouseinfo.str(),5,15,color); spriteBatch.Draw(temp,dest,src,Point(500>>1,300>>1),rot,color); } spriteBatch.End(); [/source]
  7. [quote name='Vortez' timestamp='1316261855' post='4862769'] phantom: why do you say to not mesure performance with fps but with ms per frame?? Especially with vsync disabled. I don't get why this would matter since this is pretty much the same thing, just expressed in another manner. With ms per sec, the value may vary, but by using fps you get the average of this number per frame, which should be better no? If i have 38 fps for example, i know that the frames took in average 1000ms / 38 frames = 26ms to render, i think it better than have value that fluctuate constantly. Also, if it's bad, why all game benchmark are in fps? [/quote] Going from 38fps to 60 fps is a better increase than 5000fps to 6000fps. 38 fps = 26.3 ms per frame 60 fps = 16.6 ms per frame -------------------------- 22 fps increase = 9.7ms per frame boost (which is great) 5000 fps = 0.2 ms per frame 6000 fps = 0.16 ms per frame ------------------------------- 1000 fps increase is only a 0.04 ms per frame boost (not so great) Basically, fps is not a linear way to measure performance. Ms per frame is a much better way to measure it. edit: Realized I took it to extremes, let us use your numbers Immediate Mode : 78 fps = 12.8 ms per frame VBO "Mode" : 121fps = 8.3 ms per frame --------------------------------------------------------------- Results : +43 fps = -4.5 ms per frame (pretty good, abs(8.3 / 12.8 - 1) = .35 or 35% performance boost
  8. [quote name='ClaudeFleming' timestamp='1309977225' post='4831895'] I have bought the classic book, Introduction to Algorithms, but I don't understand much of the math in the appendices even though I've taken a few calculus courses and pre-calculus also. I have bought two introductory discrete mathematics books-- one by Knuth and others, and another one that's a hefty 900-page book with plenty of worked examples, and also a book of 2000 discrete mathematics problems that have been solved. Do you think I could eventually understand the material, even if I'm not being taught by a college professor? I have forgotten almost all my math problem-solving techniques. Do those books explain them to you again, or are you expected to be a math whiz? [/quote] I just finished CS275 (discrete math) with the book Discrete Math 5th edition by Kenneth Ross and Charles R. B. Wright. Didn't really need much math. It is called the counting class at my school. Learned most of the symbols and last two weeks were on Euler's Path and Kruskal's and a few other algorithms. Also simple statics such as (real homework question), "A sack contains 50 marbles for 4 different colors. Explain why there are at least 13 marbles of the same color." and permutations. I got a B in the class, and it looked confusing as crap when I first got the book. Not sure how far you are wanting to go with it, only did the first 6 chapters in the book. The book itself was okay, but didn't get rave reviews. Might need some higher math later, but I didnt get to that part. Maybe someone else can chime in. Edit: I was taking Calc 1 at the same time (pre-req). Didn't really see the need for it. Only thing I saw the same between the two was Sigma math and that is taught much earlier in math. Didn't even touch the upper case Pi in Calc, but did in CS275
  9. Laptop for Game Programming

    Easiest thing to look for is a dedicated gpu. No integrated. I would also look for a duel core about 2 GHZ+. Quad is over kill. Also, if you plan on using linux, then get one with NVIDIA, not ATI/AMD (GPU) I have a Sony Vaio with Core 2 duo running at 2 GHZ, 6GB of RAM, ATI HD 4650 (like I said, get an NVIDIA) with native resolution at 1600x900. Don't know the screen size, but bigger than 2 wii motes with motion plus diagonal. Program on it all the time. Runs WoW in Ultra (besides shadows) perfectly. Paid $1k for it ~2 years ago, something better for cheaper is available now a day. Supposedly, if my computer is running something non gpu intensive, it will fall back to integrated. So you can look for a laptop with that. Will save power. Not sure if mine actually does that or I just read something wrong, but they are out there. Just look for specs like that and it will be perfect. If you pay more than a grand for a laptop, that is a bad choice. Blah was going to comment on the person who suggested a Mac but I will leave that for another day.
  10. constant alpha in opengl

    [quote name='thecoast47' timestamp='1308619578' post='4825756'] I'm making a game with opengl+SDL and i want to render polygons with a constant alpha value so when two polygons overlap the alpha value isn't added onto the polygons. I googled around and i read somewhere that glBlendFuncSeparate could be the answer to my problem. The only problem is that i dont have access to the function at all,like the function isn't even in the header of GL.h or GLU.h. So my question is:is there is a way to achieve a constant alpha value without this function? And if not, how do i get access to this function? -ALSO- Do you have to do this much work to get ACCESS to a function in direct3d as well or is opengl just weird like that? The site i googled stated that glBlendFuncSeparate was an opengl 1.4 function. I'm not really sure how to determine what version of opengl im using. I have an ATI radeon 5850, the box says it supports openGL 3.0. So does that mean i can only use functions <=3.0? I'm getting really frustrated with how this stuff works. I really can believe i have to do all this just for a function. [/quote] You will probably need to use an Extension Loader such as GLEW or GLEE. Just google those and you should be set
  11. [quote name='JoshyB' timestamp='1300370197' post='4786995'] [quote name='TiagoCosta' timestamp='1300054343' post='4785367'] To do the explosions you have to create functions that calculate the position of each particle over the time and add glow and increase transparency over the time... The score fading effect is really simple: You set how much time you want the score text to be visible... and then in your shader: [code] color.a = 1 - (timeElapsed / totalTime); [/code] where timeElapsed is how many milliseconds have passed since you drawn the score for the first time and totalTime is the ammount of time you want the text to be visible. To do the shrinking effect do the same thing but affecting the size in vertex shader... If you have any questions just ask [/quote] But where would i get the particle system from in the first place? [/quote] [url="http://create.msdn.com/en-US/education/catalog/sample/particle"]This[/url] is a good start. It is not exactly what you want, but once a particle system is going, changing it to do what you want is easy. Looking around a bit more on that site, I also see [url="http://create.msdn.com/en-US/education/catalog/sample/particles_pipeline"]this[/url]. It looks like it might help you more by looking at the screen shots. EDIT: Whoops, thought I was still in the XNA Workshop forum. Anyways, if you are using XNA, those links will be more beneficial.
  12. How do I make a cube pulsate? ;o

    The quick and dirty way would be to count frames and only increment after so many. This will slow it down but it will only be precise on your machine (if that) The better way to base it on elapsed time. Figure out how fast you want to scale it per second. Then used elapsed time to "scale" the factor of scale (from above) to that amount of time elapsed. Say 16ms has elapsed since the last frame and you want to scale the box by 5 every second. scaletousetoscale = 5.0f * (16/1000.0f); (1000 ms per second) scaleobjectby(scaletousetoscale);
  13. Dungeon Legend - RPG

    Looking good. The voice over reminds me of JigSaw from the "Saw" series. That is not a bad thing though.
  14. I have not read it all but it looks to be a great help. I was just starting to look into boost:asio for networking, in my current project, and this will give me a good start. Thanks!
  15. Fire Particle System

    Starts hot at the ignition point and cools off as it gets further away (relatively). So choose the color you want for hot (blue/red/etc) and as the particles move away, change the color to a cooler color (yellow or whatever). You could always just look a a lit lighter (where I got blue from) or go outside and [b]safely [/b]play with a small fire and observe what is happening. Legal notice: I can not be held responsible for any damage to you, others around you, or property. Use at own risk! =)
  • Advertisement