Thread: Simulating The Sun In The Sky

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Simulating The Sun In The Sky

    Hello,

    I'm thinking of perhaps using the system time as a base for implementing real-time daylight in a game, i.e. if you're playing the game at 10pm it will be dark in game, early afternoon the sun will be out, etc.

    To this end, I've knocked up a ridiculously simple Windows-based model, attached. At the moment all it does it get the system time, translate it using the current time zone and use the hour to determine where the sun should be (for now I'm assuming that the sun rises at 6am and sets at 6pm).

    Here comes the science bit:- is there a way that I can determine when the sun rises and sets given a time zone? Can I account for those weird places like northern Sweden where they have perpetual darkness/daylight? Would I be able to calculate this or should I instead refer to some sort of Internet database to retrieve the values?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    You mean like this?
    http://www.daylightmap.com/

    I think all you need is the time and Axial tilt to work out what part of the earth is illuminated at any point.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sun Studio 10 issue
    By clancyPC in forum C Programming
    Replies: 5
    Last Post: 07-22-2005, 07:19 AM
  2. Survival Football, ongoing! (GENERIC EXCITED TITLE)
    By PJYelton in forum A Brief History of Cprogramming.com
    Replies: 179
    Last Post: 12-14-2004, 10:19 AM
  3. Sun bursts and glows.
    By VirtualAce in forum Game Programming
    Replies: 11
    Last Post: 04-16-2004, 05:38 PM
  4. Sun Eruption....could this be armageddon??
    By Golden Bunny in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 07-08-2002, 07:21 AM
  5. HaHa Sun takes Microsoft to court
    By Megatron in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 03-09-2002, 09:21 PM