Simulating The Sun In The Sky

This is a discussion on Simulating The Sun In The Sky within the Game Programming forums, part of the General Programming Boards category; Hello, I'm thinking of perhaps using the system time as a base for implementing real-time daylight in a game, i.e. ...

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

    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?
    Attached Files Attached Files

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,437
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 09: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, 08:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21