Thread: Working with a large array

  1. #16

  2. #17
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > Thats cool, but do you think reading terrain data from the HD is practical in a realtime app?
    Well if you know the platform on which you're running this application (or can specify it), and you can afford the memory then go for the big arrays. But be aware that if you have a desktop OS (which OS is it?), much of the array could be in the swap file anyway.

    As for HD access, you have to factor in a couple more variables
    - how quickly can you traverse a single terrain cell?
    - how slow is the worst-case disk access

    You would be looking to create a buffer zone of cells around the perimeter which you could wander into whilst the disk caught up with you.

    Basically, you need to buffer as many cells as necessary to allow for the fastest taversal of the terrain, to allow for the slowest disk access.

  3. #18
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    You would be looking to create a buffer zone of cells around the perimeter which you could wander into whilst the disk caught up with you.
    Wow, that's a really great point I wouldn't have even thought of! (Just something I take for granted, suppose...) Just how much you buffer should take into account that a simple change in direction might cause a large buffer to be discarded, keep in mind.

    As far as fractals are concerned, yes, they "morph" quite well. The beauty is, a complex fractal can be quite simple an equation, in fact no more complex than your typical terrain generators, and you only need to generate/use as much of it as necessary at the moment, optimizing the cpu even further.

    Anyway, good luck on the game...oh, what API are you using, by the way?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #19
    Registered User
    Join Date
    Aug 2001
    Posts
    411
    for rendering im using OpenGL.

    And Windows is the target OS.


    I didnt consider the page file deal, so useing arrays may be optimal still.
    Last edited by Eber Kain; 09-28-2002 at 06:08 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 10:33 AM
  2. how to get and use large size array.
    By lehe in forum C++ Programming
    Replies: 7
    Last Post: 03-13-2009, 09:13 AM
  3. Replies: 9
    Last Post: 11-18-2008, 02:59 AM
  4. Storing large numbers as an array
    By Rush152 in forum C Programming
    Replies: 9
    Last Post: 05-19-2006, 11:51 PM
  5. What's the best way to initialize a large const array?
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-11-2005, 07:56 AM