• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

noodlyappendage

Members
  • Content count

    17
  • Joined

  • Last visited

Community Reputation

130 Neutral

About noodlyappendage

  • Rank
    Member

Personal Information

  • Location
    South Carolina
  1. I am having a little trouble getting the jumping physics right in a 2D platformer I'm working on. What I'm trying to do is set an impulse value, and then let the gravity force slow it down, and eventually reverse it, but it isn't quite working. The result I'm seeing is the player instantly appears at the peak of the jump, and then begins to fall. I'm sure I'm doing something wrong but I'm not seeing it. My update step looks like this: update(double time) { ddx_ = (forceX_ / mass_) * time; ddy_ = (forceY_ / mass_) * time; impulseX_ *= time; impulseY_ *= time; dx_ += (ddx_ + impulseX_); dy_ += (ddy_ + impulseY_); dx_ += (dx_ * linearDampX_); dy_ += (dy_ * linearDampY_); dx_ *= time; dy_ *= time; x_ += dx_; y_ += dy_; // Impulse should only be set in one update step. impulseX_ = 0.0; impulseY_ = 0.0; }
  2.   I had never heard of these before, and decided to google it to learn more. I stumbled upon this link, http://blogs.msdn.com/b/oldnewthing/archive/2007/11/06/5924058.aspx, which is saying that when using VirtualLock, it is still possible for memory to be paged out by the operating system. It is a few years old though, so is this information still accurate?    Edit: Actually, I just noticed at the bottom, the author includes a follow up which says his interpretation was incorrect, and VirtualLock is sufficient to secure memory. However I still found it to be an interesting read anyway.
  3. I was just wondering what, if any, negative effect the following scenario would have. I create an object instance using the new operator. This object then exists for the life of the entire process. Then, when exiting the application, I do not call a corresponding delete to deallocate. I understand the problem with memory leaks in terms of memory usage of the process at run time, but if the application is exiting, wouldn't the operating system free up any memory it had used anyway?
  4.   I was deleting the buffer right after loading the audio. I changed it to store the buffer in my AudioPlayer class instead and it's working now! Thanks!   Still not sure why every other sound worked just fine as those buffers were deleted too, not to mention that this sound would play correctly the first time, but it's working now so I guess I won't dwell on it.
  5.   Thank you! This works exactly how I need it to!
  6. I want to be able to search a private vector, without exposing the vector to the caller, using a custom comparator function that is passed in as a parameter. This seems like it should be possible, since I'm basically just creating a wrapper around a function that already exists, but I'm having trouble. Could this work or is my approach flawed?   What I'm trying to do is something like this: class Container { public: int findObject(Comparator compare); private: std::vector<Object*> objectList_; }; int Container::findObject(Comparator compare) { std::vector<int>::iterator itr; itr = std::find_if(objectList_.begin(); objectList_.end(); compare) { // ... } } I think what I'm not getting is what the Comparator parameter type should be. If I type it as a class, then I don't think I can pass in any arbitrary comparitor I want. It would have to be the same one all the time right?
  7. When trying to play a sound via FMOD, I am getting the following error:   FMOD_ERR_FILE_COULDNOTSEEK "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format."     A few strange things about this:   This only happens when I load the sound from memory. When I load it from the file directly, it works fine. I verified that the memory buffer contains the same data as the file, by writing the byte array to a file and comparing the two with a show difference tool. It is an ogg file, just like all the rest of the sounds I am using. This is the only one that has this problem though. It works fine the first time the sound is played. Any subsequent attempt to play the sound generates this error.     I'm pretty new to FMOD, and I'm not finding much about this with google, so I'm pretty lost here... Any assistance would be greatly appreciated.     Here is the code I am using to load the sound from memory: int CFMODAudioPlayer::loadAudioFile(std::string audioname, char* buffer, int bufferSize) { FMOD::Sound* audioStream; FMOD_CREATESOUNDEXINFO audioInfo; memset(&audioInfo, 0, sizeof(FMOD_CREATESOUNDEXINFO)); audioInfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); audioInfo.length = static_cast<unsigned int>(bufferSize); system_->setStreamBufferSize(65536, FMOD_TIMEUNIT_RAWBYTES); FMODErrorCheck(system_->createStream(static_cast<const char*>(buffer), FMOD_OPENMEMORY, &audioInfo, &audioStream)); int id = sounds_.size(); audioNameIDMap_[audioname] = id; sounds_.push_back(audioStream); channels_.push_back(NULL); return id; }   And here is the code I am using to play the sound: void CFMODAudioPlayer::playAudio(std::string audioname) { int index = audioNameIDMap_[audioname]; FMOD::Channel* channel; FMODErrorCheck(system_->playSound(FMOD_CHANNEL_FREE, sounds_[index], false, &channel)); channels_[index] = channel; }
  8. [quote name='alvaro' timestamp='1334126097' post='4930146'] Yes, the balance thing. The terminal velocity of a human body is about 56m/s according to Wikipedia. If you want realism, you can set your drag to match that. However, drag is primarily quadratic in the speed of the object, not linear. Or you could ignore physical reality and do whatever feels right in your game, perhaps including a hard speed limit for falling characters. You need to experiment until you get the feeling you want. [/quote] Thank you so much for the help! I came up with a solution I'm happy with. I took some time to play the games that are an influence on what I'm trying to make and I realized the player characters actually don't even really use acceleration when they move, just a constant velocity. I think if I were to write a platformer where you can't change direction in an instant it would be frustrating so what I did was add a movement vector that sets a constant velocity and in my update function I added them like so: [CODE] x_ += (time * (dx_ + movementX_)); y_ += (time * (dy_ + movementY_)); [/CODE] So I can still apply external forces like gravity, or a gust of wind, or standing on a conveyor belt or someting, but also have the option to move with a constant velocity as well. In case anyone's interested here's a compiled version with my changes: [url="http://www.mediafire.com/?14lk6gaplgu69zi"]http://www.mediafire...14lk6gaplgu69zi[/url]. There's still a few bugs to work out but I think the biggest hump has been passed. Thanks again!
  9. [quote name='alvaro' timestamp='1334110945' post='4930085'] Well, what you had there was some for of air resistance, but perhaps it was too much, so it felt like jumping in molasses. If your character is sliding on the floor, you need to implement friction. [/quote] Ah, I see. But then doesn't the problem exist that given enough time in the air, with such a low linearDamp value, the player would be able to get to very high velocities? Or maybe I should just keep playing around with it to see if I can find a good balance.
  10. [quote name='alvaro' timestamp='1334109296' post='4930076'] [quote][code] dx_ += ddx_; dy_ += ddy_; [/code][/quote] Do you mean this? [code] dx_ += time*ddx_; dy_ += time*ddy_;[/code] It looks like your linear damp might be too large. If you set it to zero, your jump should be completely symmetric. [/quote] You're right, I set it to 0.0001 and it felt much better jumping, and I also scaled the acceleration by time. But When I set it too low things move too fast and get slippery. Or maybe this is just because I need to implment friction/air resistance?
  11. In the 2D platformer I'm working on, the jumping feels bad and I'm not sure if my variables are set poorly, or if the design I'm using is a bad choice. When I jump, the player jumps up very quickly, and then falls at a slower rate. Ideally I'd want the jump and fall to feel like they're the same speed. Currently, to jump I'm applying an impulse, and then letting gravity take over. To slow the jump speed down I tried increasing the gravity but then the falling speed doesn't feel good. When I try to lower the magnitude of the impulse, I can't get the desired jump height. It seems like every time I try tweaking one variable to fix a problem it produces some other undesirable result. I guess what I want is to maintain the current jump height, but also have the jumping speed be slowed so that it's equal to the falling speed (gravity). Am I taking entirely the wrong approach here? If you want to see what I'm talking about you can download the "game" here: [url="http://www.mediafire.com/?jfn3jdxvc5nvspq"]http://www.mediafire...jfn3jdxvc5nvspq[/url], enter is start, arrows move, x is jump Here is the code to calculate position: [CODE] void CPhysicsController::update(double time) { ddx_ = forceX_ / mass_; ddy_ = forceY_ / mass_; dx_ += ddx_; dy_ += ddy_; float linearDamp = -0.15f; dx_ += (dx_ * linearDamp); dy_ += (dy_ * linearDamp); x_ += (time * dx_); y_ += (time * dy_); } void CPhysicsController::applyForce(float forceX, float forceY) { forceX_ += forceX; forceY_ += forceY; } void CPhysicsController::applyImpulse(float impulseX, float impulseY) { dx_ += impulseX; dy_ += impulseY; } [/CODE] For gravity I do this: [CODE] if (physicsControllers_[i]->isOnGround() == false) { physicsControllers_[i]->applyForce(0.0f, 70.0f); } [/CODE] And for jumping, I do this: [CODE] if (physicsController_->isOnGround() == true) { physicsController_->applyImpulse(0.0f, -2000.0f); } [/CODE]
  12. [quote name='fastcall22' timestamp='1331615475' post='4921578'] [quote name='noodlyappendage' timestamp='1331615266' post='4921576'] Whoops, you're right I am in release mode. I switched to debug and I get an access violation in one of the boost header files when it tries to connect the signal though. [/quote] Check the call stack and inspect the variables in your program -- make sure you're hooking everything up correctly. [/quote] Hmm. It even happens in the basic Hello World example from the boost tutorial. I wonder if maybe it's some setting in the IDE? I'll keep investigating... Edit: Looks like it is this [url="http://stackoverflow.com/questions/137089/boostsignal-memory-access-error"]http://stackoverflow.com/questions/137089/boostsignal-memory-access-error[/url]
  13. [quote name='Washu' timestamp='1331614528' post='4921575'] You are likely trying to debug in release mode. Which will often inline functions where possible. [/quote] Whoops, you're right I am in release mode. I switched to debug and I get an access violation in one of the boost header files when it tries to connect the signal though.
  14. [quote name='alvaro' timestamp='1331606878' post='4921551'] "A list of callbacks" is also called "a signal", and there are several signal libraries for C++ around. I've used Boost.Signals before and it's nice and easy, although I've heard criticisms about its performance (which didn't matter much in the situations where I've used them). [/quote] Thanks, I downloaded boost and got some wonky code working with signals. I'm sure I did it wrong because it won't let me put break points in the method it calls, but apparently it is running the code! So good enough for now at least.
  15. I have a game object manager class that manages a list of all the game objects. I also have a physics manager class that stores the collision geometry for each object. When the physics manager does collision detection, I'd like for it to raise an event to the main application class with the ID's of the two objects colliding, so I can get them from the game object manager and call their CollisionResponse functions. In C# I know how I would do this, but I'm using C++ and having some trouble. Is this even possible, or am I taking the wrong approach?