• Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About DanielH

  • Rank
  1. [quote name='Makers_F' timestamp='1302217631' post='4795726'] Hi everyone, in my game i already wrote the part that loads the terrain in many tiles, and now i have to wrote the part that puts the vegetation on it. I need a procedural way to set the coordinates. I thought of using [code]x = sin(T(x,y))* size_of_the_tile's_side/2[/code] and [code]y = cos(K(x,y))*size_of_the_tile's_side/2[/code] to calculate the position relative to the tile center(in this way i'm sure the coords can't fell out of the tile). The problems i have are: 1) i can't use any random function (the vegetation must not change, every time you are on a tile the vegetation must be the same) 2) i need to have the T(x,y) and K(x,y) functions a bit vary, since i don't want the vegetation to be much repetitive(since sin & cos are periodic functions) 3) i need an "algorithm" to calculate how much vegetation add (i can't add always 50 trees, i need it to vary, and it should be dependent from the sector(so that the density is quite costant in macro-zones)) Long story short, i need to set how many vegetation to add and where.. Is there any docs, resources, papers to get informations from? Thank you very much in advance Ps: i said cos and sin since they are the simplest functions that always return [-1;+1], but i'm open to more complex functions PPs: x and y are the integer index of the tile. Watching from above, the lower-left tile is (0,0) , the upper-right is the ,eg, (300,300) PPPs: the game is 3D, but the z coord is not a problem, since i'll throw a ray from above and find the intersection with the terrain, and than i'll have the z coord of the hit point and the normal of that face(and then if the terrain is too steep i'll add a different type of vegetation, and i'll load different meshes in base of the height of the terrain) [/quote] Hi im really an amateur compared what to most people here, but I have a suggestion to you problem. Like a previous person replying said perlin noise is a good way to make deterministic procedural generation, that is a way of generating something that doesn't change when you look it up again. Im not sure I understand, but are you using a lattice(2d array) and populating it using a sin/cos function, or are you placing the vegetation on different places inside the tile? Personal experiences from using noise: I've not implemented perlin noise as Ken Perlin done it, I took a Xor based pseudo random number generator (prng) and made it seedable with x, y coordinates and a single seed number. Thus I had deterministic noise that i could access one tile at a time. The noise is just a random number but can be used to with conditions to make statistical distribution of trees or terrain or whatever really. Its quite magic comparing to storing and manipulating a lattice. To make something more like Perlin Noise I made another function(method since I use Java) that used linear interpolation of different noise wavelength. This is really just adding an interpolation technique that is used when you access tiles in between high wavelength noise, and also adding different "octaves" that is of different wavelength and amplitude. So the number of octaves defines the number of executions of the noise function. The relation between the octaves was called persistance in a tuturial I read, but I've read conflicting uses of the word. My persistance in making a heigthmap is for example= Each octave -> amplitude / 2 and wavelength / 2. The result is high mountatins with smaller hills, and down to noised ground. A response to your problem: I've been thinking of using this to make vegetation also, And in this case I have thought about using a reversed persistance, that is higher amplitude on lower wavelengths. The result should be that trees are spaced apart like white noise on a tv when densely packed and over a bigger area small fluctuations of concentrations will be seen. And then it's up to you to decide how dense the forest or other flora should be. I have no good solution on how to populate your area with trees. Im just thinking perverse thoughts about using cellular automata and some nifty rules. Like that a tile can only have so many neighbours before its tree dies, and that it needs some neighbors to come alive. PS: Im using my heightmap to declare biome zones and then aplying varying vegetation depending on these. A climate zone is mostly a combination of height and latitude, since that would affect temperature and precipitation. //FetDaniel
  2. [quote name='Vectorian' timestamp='1302093680' post='4795012'] When textures are stored on the graphics card, they are upscaled to the closest power-of-two size, so 257x257 becomes a 512x12 sized texture in memory. Also in ye olde times graphics card did not support non-power-of-two texture sizes at all. There is no penalty whlie drawing the texture for non-standard sizes. [/quote] [quote name='Helicobster' timestamp='1302166822' post='4795427'] [quote name='Vectorian' timestamp='1302093680' post='4795012'] When textures are stored on the graphics card, they are upscaled to the closest power-of-two size, so 257x257 becomes a 512x12 sized texture in memory. Also in ye olde times graphics card did not support non-power-of-two texture sizes at all. [/quote] Nope - most GPUs these days support non-power-of-two texture sizes. If it supports OpenGL 2.0, it'll support any reasonable resolution you can throw at it. There is still a slight advantage to power-of-two texture sizes, though. When creating MIP-maps for trilinear-filtered texturing, each level of the MIP-map is half the size of the one before it. If the texture's size is a power of two, then each pixel of each MIP-map level can be made by simply averaging four pixels from the level before it. This 'binning' reduction is easier to optimise, and it gives cleaner & more predictable results than resampling the image. It's usually handled by the GPU, but you can still reasonably expect power-of-two textures to load a little faster, and/or look a little better at a distance. There's no [i]dis[/i]advantage to using power-of-two texture sizes, either, so while it's not [i]necessary[/i] at all, it's kinda habitual. Much like if you're selling random stuff in a garage sale, you're more likely to offer things for $5, $20 or $100, than for more arbitrary prices like $7, $23.45 or $102. Round numbers are nice. [/quote] Thank you both for very good and informative answers!
  3. I tried searching but found nothing relevant so here goes. I've studied some tile sets and many are 16x16, and some are 32x32. I've found some 30x30 also. But my limited findings suggest that there are more tiles that have a size that is base 2. Like 16x16. This could be from tradition, performance or some other practical use. The thing is I don't know why people choose a base 2 size. I'd like to know your thoughts. I'd like to know because I'm making a game in Java that is tilebased but not isometric (as of now). PS: I'm also looking for good pixelartists for a amateur game. Please message me if you are interested.