Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: C++ help for a hobby project  (Read 2418 times)

Keiseth

  • Bay Watcher
    • View Profile
Re: C++ help for a hobby project
« Reply #15 on: June 15, 2009, 04:00:44 pm »

Store the galaxy mathematically like you said. When the viewpoint enters a galaxy, generate it mathematically quickly and store the result in memory. If they leave, trash it and load the next galaxy-- it'll still be the same when they come back if you used a seed. You can do this on a larger scale, of course.

If you can affect a planet or galaxy in anyway, save that planet as a file (Sol 3 for instance), and trash everything. When they come back, generate everything mathematically, then overwrite Sol 3 with the edited one on file.

So save only what you can't remember with math. Elite II was so huge it was scary, and it ran on *very* limited computers! If you use the proper techniques, you can have a world of proportions you'll never manage to truly use for anything.
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: C++ help for a hobby project
« Reply #16 on: June 15, 2009, 04:58:31 pm »

Great idea Keiseth. As long as your generator makes the sector FOO the same every time, that should work, and cut down on how much you have to store. 'course it'll make saving and loading a bit trickier...

If you're having trouble separating your sectors (or whatever) in your storage file, you could try using a directory (folder) full of files. I did that with an adventure game I made a while back. I'm sure I could have done it more elegantly, but it worked fine.
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

MrGimp

  • Bay Watcher
    • View Profile
    • WMP Web Design
Re: C++ help for a hobby project
« Reply #17 on: June 29, 2009, 02:38:06 pm »

Hey thanks everyone for the ideas!  I havent had much time to touch this project the past couple weeks, but I do intend to keep working on it over the years (just for my own amusement and education in C++). 

My sectors are generated by seed, but the stars are placed randomly.  But I perhaps could change the way things are placed in order that the same seed always displays the same.  I dont know if I want to do that though....I like to have as much randomness as I am able to incorporate.

And I store the sectors all in one file out of necessity.  Having a different file for each sector, or even group of sectors, would be a HUGE undertaking.  On the largest scale, if I stored each galactic coordinate in a seperate file, I would have to have 1,000,000,000 files.   :o
« Last Edit: June 29, 2009, 02:42:29 pm by MrGimp »
Logged
Thus ends the official written history of the fortress known as Boatmurdered. May their tortured souls rest in peace.

Keiseth

  • Bay Watcher
    • View Profile
Re: C++ help for a hobby project
« Reply #18 on: June 29, 2009, 03:04:18 pm »

That wouldn't matter, anyway; if each of those theoretical files were 1 KB and packed into one file, you'd be looking at a file of 976,562 MB, or about 954 GB of space (before compression.)

That's why it's crucial, when working in huge-scope space games, to store anything you can mathematically. You could compress that, but I'd imagine it'd still take up an insane amount of RAM during.

Ye might want to start small and limit the number of galaxies until you find your perfect way of storing them all! I wonder of a game like Noctis or Frontier II has made its source code available. It'd be enlightening.
Logged
Pages: 1 [2]