Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

215 Neutral

About nathan.morgan

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

813 profile views
  1. nathan.morgan

    General advises on conception of a game engine

    Software development is an iterative process. You need to constantly refactor and evovle. So don't be afraid to do that.   Personally, I spend a great deal of time writing down all that I wish to include in my engine. I then break them up into small modules. I always have a game in mind when I'm writing an engine. I run the game through (in my mind) the modules that I've written down and see if I've missed anything.   Have a clear picture of what kind of games you wish to develop with your engine. Think up a few full fledged demo that you would like to write once your engine is done. Once again, this is an iterative process. When you've run your simulations a few times, you will slowly see new relationships and modules emerge. Add them to your list and do the simulations again. When you reach a point where you're not adding anything new, stop, get out of the loop and start writing.   I would recommend this book: http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 Code examples are mostly in C++, but the general idea carries over to all OO languages.   It's okay to have forgotten or missed something. Write code to be reusable and as decoupled as possible. This will allow you to add new modules easily.   While difficult to learn, I would strongly recommend you look into TDD: http://en.wikipedia.org/wiki/Test-driven_development This will help you catch bugs early on and TDD will force you to write decoupled code.     Edit: Forgot to add. I'm fairly new to game programming. But not new to software development in general.
  2. nathan.morgan

    Rotating point around point in 2D

    What Álvaro said.   You need to convert to radians.   You also need to translate to the origin, rotate and then translate back.   Here is your rotate method, this should probably work: void Rotate(sf::Vector2f & p, double angle, sf::Vector2f r) { double pi = 3.14159; float rad = angle*pi/180.0f; float s = sin(rad); float c = cos(rad); float rx = r.x; float ry = r.y; r.x -= p.x; r.y -= p.y; p.x = rx + r.x * c - r.y * s; p.y = ry + r.x * s + r.y * c; }
  • 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!