Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

693 Good

About TheCanadianVendingMachine

  • Rank
  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. TheCanadianVendingMachine

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

    I was, now the problem's gone. Thanks for that
  5. 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
  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.
  7. TheCanadianVendingMachine

    GUN ownership, Killings - a US epidemic

    Alright, so, it's has been 274 days since January 1st 2015 ( today is October 2nd 2015). And there has been 296 mass shooting this year in the U.S.A. (Mass Shooting. > 4 people total killed/injured).   Averages out to 1.08 mass shootings in the US per day (296 / 274 = 1.08) In my source, it claims the longest gap was 8 days between mass shootings   Guns are totally not the problem   Source: http://shootingtracker.com/wiki/Mass_Shootings_in_2015
  8. TheCanadianVendingMachine

    Beginner - Looking for something specific

    There's no "tutorial" for game mechanics. You have to figure it out yourself. That's why people start simple, to learn the basics and move up   That's like saying "I'm going to make a car! But I'm not going to do anything to help me learn how to build a car!"
  9. TheCanadianVendingMachine

    So excited yet so uneducated..

    You can make that game with any language/engine. That's the glory of programming.   However, to start your endeavor into game development. Make simple stuff. Start off with number guessing games. Then work your way up to stuff like Pong, or Breakout (Arkanoid). And build your way up. It may take a while, but that's just what you have to do. There isn't much you can do to get around this, unless if you are somehow gifted.
  10. TheCanadianVendingMachine

    Rotating a sprite toward mouse [SFML]

    Thanks Hae!
  11. TheCanadianVendingMachine

    Rotating a sprite toward mouse [SFML]

    In my game, I want the sprite to be able to rotate towards the mouse. However, the conventional method of atan2(dY, dX) gives bad results. I want to find out what I am doing wrong   CODE: Calling the update cycle: gameObj.player->update(deltaTime, sf::Mouse::getPosition(*app)); Player update code: void player::update(float time, sf::Vector2i mousePos) { shipSprite.move(playerVelocity * time); const float PI = 3.14159265; float dX = mousePos.x - shipSprite.getPosition().x; float dY = mousePos.y - shipSprite.getPosition().y; float rotation = atan2(dY, dX); rotation *= 180 / PI; shipSprite.setRotation(rotation); } What happens: http://gyazo.com/5d8bf3240d030987bb0b7814029d863b
  12. TheCanadianVendingMachine

    Has anyone got a feeling of this when you were starting as game developer?

      I don't think you know what that means. I believe it means - code your games, once you realize that you have many features that you are using/reusing a lot. Make an engine around them.
  13. TheCanadianVendingMachine

    How to stay motivated in learning?

    Hello! I am on this forum because I want to know where I should go now. But first - Some story.   I wanted to learn how to program since I was 11, and I attempted to do so at 13 by diving into c++. I dipped my toe in and I realized that it is too tough of a language for a beginner. So I decided to learn Python. I started learning python at the beginning of 2013, and now I feel comfortable in the language. Now I want to move onto a different language.   So here I am, at 14 wanting to learn C++. I have an Ebook that I read every now and again on C++, but I seem to get demotivated from it. I understand that I have to read it to learn, but I want to get to parts I am interested in. Such as multifile programs, without learning pointers.   So in conclusion, the question I am asking is how to stay on task, and keep learning it. How I learnt Python is read a beginner tutorial, then try to do something, then Google it. I understand that I cannot do this with C++ because of more advanced systems. Anyone have any tips?
  • 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!