Page 1 of 2 12 LastLast
Results 1 to 10 of 32

Thread: Planet texture generation code

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Good news I found a bug in my code wich was making it runs so damn slow. So now my implementation of perlin noise like algorithm works with decent speed.
    But since I now use Delphi random function it only generates me real numbers between 0 and 1 while original Perlin Noise algorithm uses real numbers from -1 to 1.
    So I was wondering if anybody of you have code for random number generator wich is capable of generating random numbers between -1 and 1.

  2. #2
    Junior Member
    Join Date
    Mar 2012
    Location
    London, UK
    Posts
    27
    Quote Originally Posted by SilverWarior View Post
    capable of generating random numbers between -1 and 1.
    r := random(2) - 1

  3. #3

  4. #4
    Thanks guys but I already solved the problem.
    r := (Random -0.5) *2;

    My Perlin noise like procedure is now done to the part that I can get mostly same results as from one of example programs I found on the web. No source code unfortunatly so I cant do any real speed comparison.
    I might do partial rewrite of it so it will give me more options for postprocessing. This way I belive to get much better results.
    But since I already spent more time on this than I expected I must postpone this for a while and start working on the rest of the game. Having best planet generation algorithm does me no good if I don't have a game in wich to use this algorithm.

  5. #5
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    How did it turn out?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  6. #6
    Sorry Will no pictures yet.
    There is still lot of work needed to be done in planet generation algorithm. Currently I would need to rewrite my Perline noise like procedure so that instead of generating 2D array of height points wich are then used for calculation rest of the heightpoints on the map it will fill some custom list, with custom objects each representing height point. But besides height this objects would also contain information for points relative position (probably just 3D point). This would alow me sorting them so that I would be able to easily divide my map into various height regions:
    1. LowestHeight to 0 = undersea area (mostly flat with smoth height variations)
    2. 0 to 15 = beach areas (nise eazy sloped beaches)
    3. 15 to 50 = plains (mostly flat with smoth height variations)
    4. 50 to 100 = lowlands (various smal hils)
    5. 100 to 150 = highlands (various larger hils and hil plathous)
    6. 150 to 200 = mountains (various mountains and mountain ranges)
    7. 200 to Max height = mountain peaks
    Besides making verry nice heightmas this will also provide me with good information to determine wich texture will be used where.
    If all would work as I imagined I should get verry realistic maps out of it. But as I sad before completing it would probably take another week time of work if not even more. So I'm afraid that you will have to wait some time after the competition to see my planet generation algorith finally in action.

  7. #7
    Junior Member
    Join Date
    Oct 2012
    Location
    Columbus, Ohio
    Posts
    4
    Blog Entries
    3

    Clarification for SilverWarior

    Hello,
    I do beg every body's forgiveness as I struggle to understand the dynamics of programming and how best to express my vision and goals.
    To start, a game that I enjoy playing is a 2D game of course played on a square surface. If you start at point a and move in a straight line to the right when you come to the edge you can go no further. Now in my mind you should be repositioned to the the left side and be able to continue on your path.
    It is my impression that the only why to accomplish this goal is to have a spherical game space...of course I could be wrong.
    As a beginning base for my project I would prefer this MyWorld.jpgas a game space. With the ability to zoom into street level yet not have the streets or buildings one would find in say google maps. Natural Earth does have the appropriate dataset although there would need to be some work done as when their maps are zoomed in they get blurry. But, I am sure there is a height map, shapefile that can resolve that issue.
    Then there is the issue of the actual ...algorithm... to create the proper paths such as something like these.MyWorldBasicTravelLines.jpg

    Now, not being a programmer much less a game programmer, I can image that there is some process to achieve this goal. But, I am not yet knowledgeable enough to understand it.

    I, in my project am attempting to fly from space, land, drive in a vehicle until I come to the ocean, then board a ship etc. etc.
    Once I figure out the 3D terrain then I hope I can then combine it with other open source code snippets to finish the project...easier said then done.

    So, I guess the real question is. Does a terrain engine or a game engine allow for this type of path following? Will I need a PhD in mathematics to program the behavior or has some wizard already figured it out? If there is an engine that will allow embedding satellite imaging to create a natural earth terrain could some one suggest it to me?

    As always all advice an d admonishments are appreciated.
    Bill

  8. #8
    I just read your comment on my profile page, so I guess it's better to answer here than via private messaging :

    What you're planning to do is a huge undertaking, and even a skilled programmer may need several years to implement what you want to do. So prepare to learn a lot, especially when it comes to 3D realtime graphics, physics, path finding and optimizations.

    Zooming in from space to the "street level" of a planet is a very complex thing to implement. You need a smart (and performing) way of storing your data (even with a high-end GPU and much RAM you won't be able to keep all necessary data in memory all the time), some continuous level-of-detail algorithm with advanced visibility checks to actually only draw what's visible (again same as storing all data isn't possible, rendering everything, if not visible or too far away, would be too much for your hardware). And these are just the basic. Adding good physics is another thing and many physics engines won't be well-suited for such a continuous scaling from space to ground.

    A very good place to learn about the techniques necessary for what you're about to do is http://vterrain.org

    When it comes to rendering planets and all the stuff they contain this page is a treasure chest of knowledge. So maybe take a look at their articles, though most of them will be very hard to understand unless you're pretty good at programming and have done something in terms of terrain renderning.

    So as an advice you should just start at ground level, render a limited terrain (using maybe octrees for visibility checks, to learn about this important feature) with basic physics that allow the player to walk on the terrain. Then start adding objects like trees and roads, include a phyisics engine for the vehicles and then zoom out stept by step, always adding to your base.

  9. #9
    @whtemple1959
    Are you just trying to transform OpenTTD to work on globe or are you trying to make the game to work with real 3D graphics?
    If it is the first option than it can be done but you will have to lower the detail to only have roads and railroads between large cities. Reason for this is the fact that you will never manage to sucsesfully simulate everything if there would be too much detail.
    I'm not sure for OpenTTD but original Transport Tycoon Delpuxe had the limitation of how mny of each structures, roadrs, rails can be on any map. And it was quite low so when playing on largest maps you quicly got to that limit which prevented you to build further.
    This was all implemented so that game simulation kept running smothy even on bit weaker computers. I asume that OpenTTD has theese limits a lot higher since todays computers are much more powerfull. But still I don't think that they are enough powerfull of sucsessfully running simulation of the whole world with such detail as present in OpenTTD.
    But if you plan on making your game in full 3D graphics than you will have to scale down your simulation part even further becouse processing 3D graphics is quite demanding.

  10. #10
    Some things can be learned from minecraft. It's not world size that makes a difference, but how much you show it at the time. If you need a real Earth model, you need to stream it from existing data sources. I'm not sure if Google-maps contain height information. If it does, you can use splines to smoothen out the details in between. Then again i'm not sure if that also counts as "blurred". There simply isn't height data in 10 meter accuracy propably anywhere, and such database would be measured in terabytes.

    Could add that with Earth data we are working in 2D pretty much. So possible optimizations go propably for quadtree, not octtree. Any data can be indexed or arranged in such a way that you can look them up quickly. Especially for project like this, you can expect that "player" doesn't make any changes to the terrain, so it's possible all the data can be in static sized blocks. That simplifies things.

    Oh, also the Earth topic might go on another thread entirely? Not so related to texture generation at all now.
    Last edited by User137; 07-11-2012 at 10:28 AM.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •