Mythruna
April 27, 2024, 03:14:41 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: need some advice from paul  (Read 3483 times)
voxelgamer
Newbie
*
Posts: 15


View Profile
« on: January 19, 2015, 11:38:29 AM »

Hi paul ,I'm wondering if I could pick your brain for a moment ,I'm busy working on a game purely as a hobby to see what I can do,so I got this little voxel engine open source for unity and I made some scripts for adding grass and trees and other stuff,problem is im stumped trying to think of a way to save the trees location and what type of tree it is,I'm guessing this is how you do it,I'm also guessing you also use a kind of object pooling to spawn trees and stuff,so after that long winded story I'm wondering if you could share some tips on how you do that,basically I'm asking how exactly you handle trees and grass thanks for any tips you probably have a blog somewhere with that info in it that'd be great to.
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #1 on: January 19, 2015, 07:01:53 PM »

The version of Mythruna that you all play only generates tree positions when it builds the chunk and then it forgets them.  It's random but predictably random based on the seed and location... so everyone with the same seed gets the same trees.  So when you see a tree it isn't a "tree" anymore... it's just a bunch of blocks.

In the new Mythruna, I keep track of the trees and actually generate them before I ever build a chunk.  A tree will still be just a bunch of blocks when generated... but I remember where they are so that when I have proper tree physics then I can extract them to a physical object when chopped down.  Otherwise, they will just be blocks.

I store them in a binary format... I think I actually used Java serialization but I don't remember.  File formats are not really a big deal when they are only used internally.
Logged
voxelgamer
Newbie
*
Posts: 15


View Profile
« Reply #2 on: January 20, 2015, 09:21:28 AM »

Ah I see serializers are something I haven't dived into yet I must do,running into memory problems ATM.atm I'm creating a bunch of trees then moving them around the world as I need them to save on memory.so yea I'll look into that thanks very much for the tip.I never actually knew you build your trees from scratch that's pretty cool.must of been interesting getting that working but probably worked out cheaper in the long run.I must read your blog on jmonkey probably got some interesting stuff there I could learn.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!