Jump to content
  • Advertisement

DontPanic

Member
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

122 Neutral

About DontPanic

  • Rank
    Member
  1. Thanks for your reply I had feared that was the case. I built it with opengls translate function in mind but I guess I'll have to do some jiggerypokery to get it going as you described
  2. Simple as the title. When moving around in my game the player moves at 2.0f and even with interpolation on the tile map this is no problem. However at diagonals he moves roughly 1.414f (otherwise diagonals travel faster over distance before you suggest I remove that). On certain machines, mostly newer ones with higher fps, the tile map rips down the seams of the tiles revealing the black background that is the clear colour for rendering (so the tiles are rendering with a pixel wide gap). Only having moved diagonals it will possibly introduce this visible error and seems to me this happens only when moving. Removing interpolation seems to clear up the error. Intuition is telling me this is because the interpolation uses floats to take the maps position, maps velocity and interpolation at the point of drawing to come out with a smoother scrolling whatever your frame rate. It works this out and then simply translates using glTranslatef to exactly where it should be. My only current solution is to remove map interpolation and have it jitter. Does anyone have anything I could try?
  3. Cheers. After chasing solutions it feels good to get some validation on this. Let the adventure continue...
  4. For part of my game I need to load data in at real time. Like the ID assuming this is from a database I want to search "wealthyWerewolf", conditions "if(playerName == "bob" && wealth == 100)" and also load assignments such a "hairy = true; increaseHeight += 2". I'm making the example stuff up but it should make sense. If I was to be saving this in a txt file they could just go on separate lines for the sake of simplicity: wealthyWerewolf if(playerName == "bob" && wealth == 100) hairy = true; increaseHeight += 2 (use of ; as delimiter doesn't matter too much, if stored in XML I could presumably separate things by line and it'll still be in tags) The idea is that a file could be searched for wealthyWerewolf, load and parse the if statement, anything that the player doesn't have as a variable or hasn't been dynamically created earlier will return false. So if the player didn't have a name, no problems, it's clearly false. If true however then it would parse the next line that holds assignments (if it isn't there, then it can't be changed). Quite a lot of that can be changed as long as it has the same functionality but that is how I envisioned it. I've been around the block with this problem from trying to implement strings into a maths expression parser, create my own scripting language, researching for days. It felt like I was reinventing the wheel at every step. Heaven if I was a masochist but I bailed each time because this surely isn't needing that much work. Someone would have done it before me. Right now I'm looking at Lua knowing that it can handle my requirements but I'm brand new at this game and could do with a poke in the right direction. Keep feeling like I should be storing these as strings like the example, loading them in Lua and parsing there... same problem if I'm not mistaken. Coding hangover from so much looking into compiler coding etc. Ok enough mind dumping, thanks for reading. I'm taking all suggestions, links to libraries, perhaps poking me in the right direction with a scripting language as I'd be new to it, anything really.
  5. DontPanic

    SDL input player movement problem

    The problem is that it doesn't account for the different velocity when moving diagonally. For instance: if(m_dirUp == true && m_dirRight == true) { m_VelY += diagonal; m_VelX -= diagonal; } So to then cancel that out doesn't work. where velocity is normally 2 it would happen that moving up/right diagonally and then releasing right would make x velocity: x velocity = 1.42 - 2 So I have accounted for that with more if's and bool variables. Every time I do that I find that something doesn't work and I add more. So the solution is to have a very long list of if statements working out exactly what is pressed at any given time and what was released and performing the correct changes to the velocities. However that is already ugly, hence why I'm wondering if anyone else has a solution. I'm hoping I'm not the only person who has this setup and wants too have 8 way movement that is fairly accurate compared too diagonals moving faster.
  6. I have a set up much like the second example in this tutorial: http://gpwiki.org/index.php/SDL:Tutorials:Practical_Keyboard_Input However I wish so that when moving in a diagonal it doesn't simple move the player say left and up by the same velocity units as that would mean moving at a diagonal moves you faster. So I have this little bit of code: float diagonal = m_MovementSpeed -(0.70710678118654752440084436210485 * m_MovementSpeed); It in effect is performing what trig would since the player only moves 8 directions. However on trying to implement this diagonal movement velocity change my code has become an almighty mess. It's a horrific mess of bools and if statements across the key down and key up events. It works to a point but it fails when I have 3 movement keys pressed. Can anybody come up with a cleaner and bug free method of implementing it? That means movement is always what it is meant to happen. For example say left, down and right are pressed then the player should move down m_MovementSpeed and then if right is released you go diagonal at the reduced velocity of x and y. Oh and to complicate matters in the game you can control either of 2 characters. If you hold a key (currently m for no reason) you move one of them and if you release it you move the other. They are separate objects (OO) and because of their relationship one is a data member of the other. That is currently controlled by a bool in both objects, and on input both bools are changed to represent whether they are being controlled or not. I've got myself in a muddle over this. Guess it's simple and I just need to come back to it later but it's bothering me. I'm sure you know the feeling.
  7. DontPanic

    frame independent animation/motion

    I see what you are saying about capping the frame rate. Luckily I have begun using interpolation as can be seen from my code in my last post. To me that seems to be the perfect game loop but maybe I've made a silly mistake I haven't seen yet. The idea is that on a fast computer I get high frame rate and therefore a smoother game to the eye but the logic remains a constant rate. On a slower computer the frame rate will dip but hopefully the games logic wont take that long therefore it should still be playable. My thinking is even if the frame rate is about 20 fps the games logic should still run fine (as it is less demanding) taking player input and the rest of it 25 times a second. Have I got it all wrong and my loop will do nothing like that? I like to think I've learnt something from this thread, thank you
  8. DontPanic

    SDL_Framerate.h

    HERE A post I made in this very board, a couple down from your post. I've found it very helpful... not to say I think I've cracked it yet. There are some articles on this site too and the web is full of them from what I've found. Seems it isn't as simple than it is at first look.
  9. I spent a long time on this. If you installed the redist exe on the target machine that doesn't have vc++ 08, it should run. If not it isn't the compilers dependencies being the problem. Make sure you are including all the dll's from your libraries and that you are using Multithreaded DLL because SDL needs that (unless you want to recompile SDL). The thing I would check first from what you have said is that you are using a release build and not a debug. The debug build uses different dll's. [edit] Also you will want to package the redist dll's to your programs folder if you wish to not force other people to download the redist exe. They are in somewhere like "C:\Program Files\Microsoft Visual Studio 9.0\VC\redist" and just copy the folder from in there too where your exe is. NOTE: This may not be the best idea and does increase the size of the app when redistributing but I've found it to work
  10. DontPanic

    frame independent animation/motion

    I was going down the route of using delta time. So taking your recommendation against it I'm looking at the fixed step approach. Having slept on it I can see why it is simpler, and how if the game is running slow the game will still seem to update correctly but the frame rate would be ugly. But what disadvantages does it have against delta time? Why the different approaches if they all get around to doing the same thing? ibebrett seems to be talking about delta time independent movement if I am understanding correctly. [edit] Kylotan, I'm under the impression that the fixed step approach that was outlined would keep everything going at a constant rate collision wise etc. It looks to me like saying: Every time we loop to update the screen we see how far the game should have got too and then perform that many logic loops to get it to that point. Now we can update. So it keeps the game speed independent from the display speed and processing speed. Now if all I do is keep the game speed the same as my display speed and all animation looks good wouldn't it be avoiding interpolation and extrapolation? I'm quite uninformed as you can tell but I thought they basically fill in the gaps between the game/logic loops. For example if a bullet travels fast between the update calls but I let the display function operate as fast as possible, we are loosing smoothness that could be there in-between while we display many frames? That could be done by interpolating and so predicting where the bullet would be between logic updates. So it doesn't have to be a problem if I keep the game logic <= fps? [edit2] I've gone away and had a shot at implementing a game loop: const int m_FPS = 25; const int m_SKIP = 1000/m_FPS; const int m_MAXSKIP = 5; CTimer update; Uint32 nextGameTick = update.GetTicks(); unsigned int frame = 0; float interpolation = 0; while(game.Running()) { frame = 0; while(update.GetTicks() > nextGameTick && frame < m_MAXSKIP) { game.HandleEvents(); game.Update(); nextGameTick += m_SKIP; ++frame; } interpolation = float(update.GetTicks() + m_SKIP - nextGameTick ) / float(m_SKIP); game.Draw(interpolation); } [Edited by - DontPanic on July 22, 2008 5:36:11 PM]
  11. DontPanic

    frame independent animation/motion

    I think I'm still a bit muddled but you have helped. My current loop is basic: while game's running { start timer game.HandleEvents(); game.Update(); game.Draw(); //Cap the frame rate if (time < 1000/30) { delay((1000/30) - time); } } I'm looking at option 1 from your examples but I am struggling how too integrate it
  12. I wasn't too sure what to name this as the subject but here is the "problem" Basically I cap my frame rate at the moment and have come to the point I ask myself the question. Frame independent motion or not. For reference my game is a 2d sdl/opengl shoot em up. I just made an animation class with a manager class without thinking much and each individual animation I make runs on a timer. Looking at it now that decision leads me towards frame independent motion as if the player moves across the screen slower on a lower fps the animations will all still go full speed. Basically I've become a bit lost how to structure this all. I'm new too this stuff as before I made everything linked to the fps so half fps is half speed everything. I don't think that suits this game as getting a slowdown is an advantage making the game easier and so easier to get hi-scores. That lead me too look at frame independent movement. Is it worth doing or is it simpler to just not bother and it'll be fine So if I make it that as the game loops it works out if it is going half speed and therefore makes a float. I could pass that too anything that has motion and they will use that in the motion calculations to make themselves compensate for this slowdown in the frame rate (half fps means making the movement double so it seems like they always move the same). I think I've grasped this and got it right but should that float be passed to each animation to regulate them or is their individual timers perfectly fine?
  13. My guess would be put the files in the same folder as the project file as it sounds like you have them exclusively in a debug folder. There are not that many places the files could be put so try each folder and see if your theory is correct. Trial and error shouldn't take long. If that doesn't work, relax for a bit and then launch yourself into your monitor like an enraged beast. It may not be the monitors fault but I say shoot the messenger.
  14. DontPanic

    C++

    C++ is used to make programs on your computer. C++ can add on openGL to help you make graphical programs for your computer. Perhaps an analogy is needed. What if I compared it too cooking. You can have some basic ingredients and that is C++. What you do with them determines what you get at the end, wether it be an omlette or scrambled eggs. So if C++ is the iingredients, the result food could be a game or a word processor. OpenGL comes into this by being preprocessed ingredients. Someone has already done some of the work for you. For example a pizza base could be bought from the store and you dont have to make it yourself. Then you can put your toppings on and it's done. Now if the pizza base is opengl you can then program with C++ and opengl to make your final product, the game/pizza. If you read you are using a library, in this case opengl, you are basically using someone elses code for your own use. That's good because it speeds it up for you to make things. Why invent the wheel when programming when you can use someones library. One last thing to keep in mind is that, jumping back to the cooking analogy, what if the pizza base isnt how you want it? Well dont use it and find a different pizza base or make your own. So if opengl doesnt do what you want, use another library that does or make your own. Now hopefully you know the difference. Like cooking, if you want the job done right learn the basics first. Learn a language and then think about libraries. Plus unlike cooking where using the pizza base you dont need to get how they made it, using libraries you need knowledge of C++. The analogy is no where near perfect as the subject is complicated and I'm thinking on my feet but figured I'd have a go helping
  15. DontPanic

    Does Action + Puzzle have to = Disaster?

    Super metroid and zelda games are worth looking at as they are enjoyed by so many including me but the mix of action and puzzle is a fine line to walk. For instance I played Overlord on a mates 360 and felt I was always bringing my imps back to help kill things rather than do the boring puzzle with them. That grew into me not liking the game. Personally if the action is very trigger finger fast stuff I don't really want to think about solving something at the same time. The two games I referenced tend to have predictable enemies and enjoyable puzzles meaning you can puzzle and kill things comfortably. The only times a puzzle is presented and you have to act fast action wise are boss fights and they are designed to be hard. It would be frustrating to have puzzles and action where you have to solve the puzzle fast enough or you lose. It would be equally frustrating to have a tough puzzle to solve but you have to spend all your time fighting of a never ending supply of enemies that are not predictable and require 100% of your attention for example, therefore leading to you never getting to look at the puzzle enough. So personally I conclude if you want both at once, either the puzzle or the action needs to be predictable and easy. Predictable puzzles are boring in my opinion but hack and slash games use them to vary the game levels without taking away from the pure action. Easy action elements like easy enemies to kill, would be the way to go for me. Now we're back to zelda and super metroid. Like I said before though, boss fights tend to break that rule because you want to push the player till they understand what to do and then it reverts too the balance But as always what I just said is by no means the law, only part of the equation. If you think the player can handle both action and puzzle at once under timed pressure like the example mentioned before me in prince of persia then go for it. Only testing will you be sure if it's right or wrong. It also comes down to the situation, the player could be relaxed and then suddenly they have to do all this stuff and feel annoyed by the game as they lose. Anticipation of the puzzle and action together can be more than enough to let the player find it easy enough and it not be a disaster. Only real way of finding out if it's a disaster or not is by testing and then perhaps tweaking the design. For your own game you could try to balance it and you could alienate players. Think about if you want it to be action or puzzle. If you lean towards one more then maybe think about an all action game with optional puzzle elements that if the player wants to do then they shall be rewarded or vice versa. Personally there is no reason to do whatever you want but keep in mind "is this fun" and get other people to test it and see their reactions. [Edited by - DontPanic on June 11, 2008 6:23:10 PM]
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!