Jump to content
  • Advertisement

TheCanadianVendingMachine

Member
  • Content Count

    13
  • Joined

  • Last visited

Everything posted by TheCanadianVendingMachine

  1. TheCanadianVendingMachine

    Checking collisions of all entities in a 2D RPG

    std::vector<sf::Sprite> objects; for (auto &obj : objects) { for (auto &collisionObject : objects) { if (obj.getGlobalBounds().intersects(collisionObject.getGlobalBounds())) { // collision! } } } That would be the most basic way of implementing a collision-like system. Only problems that the code above has is that you can collide with the same object you are testing with, and that with huge amount of objects (greater than 100), it will slow down.   Note: This will not resolve collisions. Only detect them
  2. TheCanadianVendingMachine

    Checking collisions of all entities in a 2D RPG

    Do you know if brute-forcing it will lag the game? If it does, take a look into quadtrees. If not, brute force it! An obvious way to brute force it is to collide all entities with all other entities, and manage from there. Maybe even perform a check to see if they are within range. Sure, this isn't the fastest you can be; but if it works, and works well, don't worry about implementing a quad-tree like structure.
  3. TheCanadianVendingMachine

    Classes and header files mess

    Imagine a game with elevators in it. It would usually have 2 classes   Person Elevator   The Person class has a reference to the current elevator he is in. This is defined as: class person { private: elevator m_elevator; }; However, this is saying that the person owns the elevator. Why should he own an elevator all to himself? That's why we do class person { private: elevator *m_elevator; }; Now, you may be thinking, "why can't the elevator just have an array of all persons inside?" There are a few good reasons. First off, creating objects is expensive. It is better to create them once, store them somewhere, and then reference them with pointers. Secondly, it makes the "person" class bigger because of unnecessary functions that only the "elevator" class will need; it is better to have the elevator class return needed variables (in some circumstances). Thirdly, does it make sense that the elevator owns a person?   And including unnecessary headers will also cause the file the header is included in to be recompiled each time you edit the included file. Example: #include "player.hpp" /* This file has to be recompiled each time player.hpp is edited. This can cause a long build time if this file is big enough */ class elevator { };
  4. I can't type much, because the text box for it is messed up as well, but the whole site is *really* messed up; except for the home page
  5. TheCanadianVendingMachine

    Is there any reason my version of the website is messed up?

    I was, now the problem's gone. Thanks for that
  6. TheCanadianVendingMachine

    I have no experience AT ALL

    How many people could those servers handle at once? 5000? 10, 000? 100, 000? If it's not near the upper bounds of that, it isn't really and MMO. It's just an ORPG. Online RPG. You can't just sit down and expect the knowledge to flow to you, it will take years to learn C++ to even begin making this. Not to mention years of skills to get while developing it.
  • 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!