• 0

    posted a message on [1.7.2] Forge | Add new Block, Item, Entity, AI, Creative tab, Language localization, Block textures, Side textures
    Big thanks for this tutorial. This and MrrGingerNinja's Eclipse workspace tutorial really helped for getting started on modding.

    For anyone just starting with this, I tracked my progress through this in git and added a tag at each step. (Well, most steps) I also annotated it with my thoughts as a programmer coming from a non-Java background, and on where I differed from the tutorial and why. (Note that my reasoning as written in there may not be correct...!) As an added bonus, you can even cajole github into showing you the diff between each tag! Although it'll look mostly like what's in the tutorial...

    The biggest differences between my code there and Sea Bass' are:
    • making separate classes for the block with the same texture on all sides vs the block with a different texture on one side
    • making a separate class for the mob that uses the advanced AI
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on TOGoS's Programmable Minecraft Map Generator
    I'm currently messing around with a graph calculator and 1D noise in the MG to get a better feel of the noise outputs. I noticed that multiplying the simplex output by 3 seems to normalize it to a range of [-1 1] pretty well! (most outputs are, naturally, still in the range of [-0.5 0.5], post normalization.)

    And unfortunately, I'm not intrepid enough (nor have I enough decent boxes) to try the server out so much, and just using my current computer seems to work well enough, for now. Sorry!
    Posted in: Minecraft Tools
  • 0

    posted a message on TOGoS's Programmable Minecraft Map Generator
    Quote from Manslaughter

    # Dirty up the placement: Randomize
    
    dirty-diamond = if( simplex > 0, materials.diamond-ore, materials.none );
    #dirty-diamond = materials.diamond-ore;
    
    dirty-coal = if( simplex > 0, materials.coal-ore, materials.none );
    #dirty-coal = materials.coal-ore;
    
    dirty-redstone = if( simplex > 0, materials.redstone-ore, materials.none );

    Edit, if anyone has a better way, plz let me know! Not that i dont like the abundance of diamonds


    That's quite simple, actually! Just increase the number you compare simplex to and the amount of ore will drop! You might want to change the size and position of the noise functions, though, so they don't overlap eachother. EG
    # Less diamonds! :sad.gif:
    dirty-diamond = if( simplex > 0.6, materials.diamond-ore, materials.none );
    # Bigger chunks of diamonds! :ohmy.gif:
    dirty-diamond = if( simplex( x / 10, y / 10, z / 10 ) > 0.6, materials.diamond-ore, materials.none );
    # Moved around to keep ores from always drawing atop each other :U  The +s and -s are as random as mashing buttons will allow.
    dirty-diamond = if( simplex( (x + 12) / 10, (y + 9842) / 10, (z - 4892) / 10 ) > 0.6, materials.diamond-ore, materials.none );
    # You may find it easier to use translate-in and scale-in.  Possible optimization: List these as 0.1 instead of 1 / 10 so it doesn't have to do divisions all the time.
    dirty-diamond = if( translate-in( 12, 9842, 0 - 4892, scale-in( 1 / 10, 1 / 10, 1 / 10, simplex ) ) > 0.6, materials.diamond-ore, materials.none );


    oh! Question for TOGoS! Is there a way to specify negative numbers without using (0 - number) that I skipped over in not reading all the things?

    As to your pointy mountains, you might try squaring or cubing or otherwise reshaping the output values of the noise before adding it to something else.
    Posted in: Minecraft Tools
  • 0

    posted a message on TOGoS's Programmable Minecraft Map Generator
    Quote from TOGoS

    I'm up to 1100 chunks generated so far on my machine...

    islePond( mat ) = if( islePondProbDens > 0, isle( mat ), -1 );


    Do you mean to have islePondProbDens evaluated for every point in 3-space between the layer's floor and ceiling? I realize the function doesn't use Y, so won't change based on height, but TMCMG isn't smart enough to realize that or optimize calculations around it. You could speed up your script by an order of magnitude or so by using constant material functions and varying only the floor and ceiling height in these cases, setting the ceiling height to 0 wherever you don't want the layer present. Maybe define something like:

    atalhllayer( material, probDens, floor, ceil ) = layer( material, floor, if(probDens,ceil,0) );


    Hmm! True, true. I really should do that, since I even explicitly make y some constant. There's some other parts that could no doubt be optimized, though they're probably not as obnoxious as all the 3D noise parts. I'll see if I can run it with those modifications later tonight.

    Thanks!

    Edit 2

    Yep, seems it was a memory issue. Adding more RAM fixed the hangs. Well, that's that mystery solved!

    Edit!

    Moving the limiting functions to the layer height evaluation (IE making them true 2D limiters) does in fact improve performance precipitously, to the point where it does not freeze. Which means it's time to add more things. Thankee for pointing that out!

    here's the updated version.

    # What we'll have:
    # Big islands
    # ponds
    # springs
    # rivers (which lead to water falls :biggrin.gif: :biggrin.gif: :biggrin.gif:)
    # smaller islands (2 layers?)
    # ROCK WORMS on the floor :U
    # maybe caves with lobster lava.
    
    #### Macro definitions
    
    sqr( a ) = if( a < 0, a * (0 - a), a * a );
    cb( a ) = a * a * a;  # Simpler because odd powers keep the sign.
    
    
    
    #### Part definitions
    
    ## Main islands
    isleProbDens = translate-in( 0, 0, -20, 
    	fractal( 4,   150, 1,  0.6, 0.7, 10,  simplex( x, 0, z ) )
    	+ fractal( 2, 300, 1,  0.7, 0.8, 20,  simplex( x + 50, -50, z + 1234 ) )
    	) / 0.6;
    
    isleBotNoise = (
    	fractal( 3,  30, 1,  0.5, 1, -20,  simplex( x - 4349, y / 30, z + 903 ) )
    	) / 0.67;
    
    isIsle = if( isleProbDens > 0, 1, 0 );
    	
    ##
    islandOffset = 96;
    islandTop = islandOffset
    	+ 5 * isleProbDens
    	+ 5 * simplex( (x + 9054) / 25, 93, (z - 89) / 25 );
    islandBottom = islandOffset
    	- 48 * isleProbDens
    	- 32 * isleBotNoise * isleProbDens;
    	
    isle( mat ) = if( isIsle, mat, -1 ); # Slipping this into a height function, -1 will guarantee not drawing anything, because a floor of 0 > a ceiling of -1, ergo don't process that column.
    
    ## tree density (should be normalized to about 1/6, or 6 m^2/tree
    isleTreeProbDens =
    	max( 0, (1 - ridge( 0, 10, isleProbDens - 0.2 ) - 0.8) * 0.16 )
    	+ isleProbDens * 0.03;
    
    ## rivers
    islePondProbDens = 0 -
    	(fractal( 3, 70, 2, 0.5, 0.7, 0, ridge( 0, 1, perlin( x, 9.5, z ) ) )
    	- isleProbDens * 0.5
    	- 0.2) / 0.2 / 2;
    
    isleRiverProbDens = (0 -
    	( ridge( 0, 10, fractal( 3, 150, 3, 0.5, 2, 10, perlin( x, 0, z ) ) ) - 0.2
    	) + 0.13) / 0.25;
    
    islePond( mat ) = if( islePondProbDens > 0, isle( mat ), -1 );
    islePondFountain( mat ) = if( islePondProbDens > 0.9, isle( mat ), -1 );
    
    isleRiver( mat ) = if( isleRiverProbDens > 0, isle( mat ), -1 );
    
    
    
    ## Sea bed.
    seabedTop = (sqrt( isleProbDens + 1 ) - 2) * 30 + 70;
    
    ## Worms!
    	# Volumetric.
    wormsProbDens = fractal( 3, 40, 1, 0.5, 1, 100, perlin ) - 0.3 - ((y - 60 + 16) / 16);
    worms( mat ) = if( wormsProbDens > 0, mat, -1 );
    
    ## Spikes...
    spikeBottomHeight = 32;
    spikeTopHeight = 96;
    
    spikeTop = spikeBottomHeight + isleBotNoise * (spikeTopHeight - spikeBottomHeight);
    
    	# Volumetric.
    spike( mat, mat2 ) = if(
    	perlin( x / 10, y / 10, z / 10 ) > 0.7,
    	mat, mat2 );
    
    
    
    ## lesser islands
    lesserIsleProbDens =
    	(perlin( x / 20, -34901, z / 20 ) - 0.5) * 2;
    
    lesserIsleHeight = 72; # 64 + 8;
    
    lesserIsle( mat ) = if( lesserIsleProbDens > 0, mat, -1 );
    lesserIsleTop = lesserIsleHeight
    	+ lesserIsleProbDens * 2;
    lesserIsleBottom = lesserIsleHeight
    	- sqr( lesserIsleProbDens * 10 );
    lesserIsleDirtBottom = lesserIsleHeight
    	- lesserIsleProbDens * 4;
    	
    ## Lesser islands 2
    lesserIsle2ProbDens =
    	(perlin( x / 20, -348, z / 20 ) - 0.5) * 2;
    
    lesserIsle2Height = 80; # 64 + 16;
    
    lesserIsle2( mat ) = if( lesserIsle2ProbDens > 0, mat, -1 );
    lesserIsle2Top = lesserIsle2Height
    	+ lesserIsle2ProbDens * 2;
    lesserIsle2Bottom = lesserIsle2Height
    	- sqr( lesserIsle2ProbDens * 10 );
    lesserIsle2DirtBottom = lesserIsle2Height
    	- lesserIsle2ProbDens * 4;
    
    
    
    ####
    
    layered-terrain(
    	layer( materials.water, 0, 64 ),
    	
    ## Lesser islands
    	layer( materials.stone,
    		lesserIsleBottom,
    		lesserIsle( lesserIsleTop ) ),
    	layer( materials.dirt,
    		lesserIsleDirtBottom,
    		lesserIsle( lesserIsleTop ) ),
    	layer( materials.grass,
    		lesserIsleTop - 1,
    		lesserIsle( lesserIsleTop ) ),
    		
    	layer( materials.stone,
    		lesserIsle2Bottom,
    		lesserIsle2( lesserIsle2Top ) ),
    	layer( materials.dirt,
    		lesserIsle2DirtBottom,
    		lesserIsle2( lesserIsle2Top ) ),
    	layer( materials.grass,
    		lesserIsle2Top - 1,
    		lesserIsle2( lesserIsle2Top ) ),
    
    ## Main islands
    	layer( materials.stone,
    		islandBottom, isle( islandOffset ) ),
    	layer( materials.grass,
    		islandOffset - isleProbDens * 2,
    		isle( islandTop ) ),
    	layer( materials.dirt,
    		islandOffset - isleProbDens * 5,
    		isle( islandTop - 1 ) ),
    	
    	layer( materials.water,
    		islandTop - islePondProbDens * 5,
    		islePond( islandTop ) ),
    	layer( materials.water,
    		islandTop,
    		islePondFountain( islandTop + 8 ) ),
    	
    	layer( materials.water,
    		islandTop - isleRiverProbDens * 3,
    		isleRiver( islandTop ) ),
    	
    ## Seabed.
    	layer( spike( materials.coal-ore, materials.stone ),
    		spikeBottomHeight,
    		spikeTop ),
    	layer( materials.stone,
    		1, seabedTop ),
    	layer( worms( materials.stone ),
    		1, 64 ),
    	layer( materials.bedrock, 0, 1 ),
    	
    	tree-populator( tree-types.round, isleTreeProbDens ),
    	);
    Posted in: Minecraft Tools
  • 0

    posted a message on TOGoS's Programmable Minecraft Map Generator
    Quote from TOGoS

    Well that's unfortunate. I've never had any crashes, so I would assume that either it's running out of memory or you're running into a JVM bug. Then again, this may be the most complex script I've ever seen (and the heaviest use of volumetric noise I've ever seen), so I should give it a try on my Ubuntu box...tomorrow.

    When you export chunks, do you have the 'use job system' box enabled? I can imagine that that might trigger some platform-specific threading issues, e.g. when writing chunks to the filesystem.

    Also, do you know what JVM you are using?


    I've tried it both with job system checked and unchecked. It lasts longer with it unchecked, but still hangs eventually. I wouldn't actually be surprised if it's a memory thing. I'm getting a memory upgrade later this week, so if it lasts any longer then we can be fairly sure that's what it was. Seeing as how it just hangs...

    on the commandline, java -version outputs
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
    Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)

    So, that's about all I can guess on that! Alas, Java is one of those things I've never really messed with much.
    Posted in: Minecraft Tools
  • 0

    posted a message on TOGoS's Programmable Minecraft Map Generator
    Does this map generator tend to crash more, in general experience, on Macs? Is it a Java on Mac issue or just a My Java/My Computer issue? Running a recent Macbook Pro. (Core i7, 4GB RAM.) It's really prone to freezing on my computer, but seems to work fine on my brother's windows box. Usually I can generate one 32x32 block of chunks with heavier scripts, but I seem to have finally done it in on my computer with this script:

    # What we'll have:
    # Big islands
    # ponds
    # springs
    # rivers (which lead to water falls :biggrin.gif: :biggrin.gif: :biggrin.gif:)
    # smaller islands (2 layers?)
    # ROCK WORMS on the floor :U
    # maybe caves with lobster lava.
    
    #### Macro definitions
    
    sqr( a ) = if( a < 0, a * (0 - a), a * a );
    cb( a ) = a * a * a;  # Simpler because odd powers keep the sign.
    
    
    
    #### Part definitions
    
    ## Main islands
    isleProbDens = translate-in( 0, 0, -20, 
    	fractal( 4,   150, 1,  0.6, 0.7, 10,  simplex( x, 0, z ) )
    	+ fractal( 2, 300, 1,  0.7, 0.8, 20,  simplex( x + 50, -50, z + 1234 ) )
    	) / 0.6;
    
    isleBotNoise = (
    	fractal( 3,  30, 1,  0.5, 1, -20,  simplex( x - 4349, y / 30, z + 903 ) )
    	) / 0.67;
    
    isIsle = if( isleProbDens > 0, 1, 0 );
    	
    ##
    islandOffset = 96;
    islandTop = islandOffset
    	+ 5 * isleProbDens
    	+ 5 * simplex( (x + 9054) / 25, 93, (z - 89) / 25 );
    islandBottom = islandOffset
    	- 48 * isleProbDens
    	- 32 * isleBotNoise * isleProbDens;
    	
    isle( mat ) = if( isIsle, mat, -1 );
    
    ## tree density (should be normalized to about 1/6, or 6 m^2/tree
    isleTreeProbDens =
    	max( 0, (1 - ridge( 0, 10, isleProbDens - 0.2 ) - 0.8) * 0.16 )
    	+ isleProbDens * 0.03;
    
    ## rivers
    islePondProbDens = 0 -
    	(fractal( 3, 70, 2, 0.5, 0.7, 0, ridge( 0, 1, perlin( x, 9.5, z ) ) )
    	- isleProbDens * 0.5
    	- 0.2) / 0.2 / 2;
    
    isleRiverProbDens = (0 -
    	( ridge( 0, 10, fractal( 3, 150, 3, 0.5, 2, 10, perlin( x, 0, z ) ) ) - 0.2
    	) + 0.13) / 0.25;
    
    islePond( mat ) = if( islePondProbDens > 0, isle( mat ), -1 );
    islePondFountain( mat ) = if( islePondProbDens > 0.9, isle( mat ), -1 );
    
    isleRiver( mat ) = if( isleRiverProbDens > 0, isle( mat ), -1 );
    
    
    
    ## Sea bed.
    seabedTop = (sqrt( isleProbDens + 1 ) - 2) * 30 + 70;
    
    ## Worms!
    wormsProbDens = fractal( 3, 40, 1, 0.5, 1, 100, perlin ) - 0.3 - ((y - 60 + 16) / 16);
    worms( mat ) = if( wormsProbDens > 0, mat, -1 );
    
    ## Spikes...
    spikeBottomHeight = 32;
    spikeTopHeight = 96;
    
    spikeTop = spikeBottomHeight + isleBotNoise * (spikeTopHeight - spikeBottomHeight);
    
    spike( mat, mat2 ) = if(
    	perlin( x / 10, y / 10, z / 10 ) > 0.7,
    	mat, mat2 );
    
    
    
    ## lesser islands
    lesserIsleProbDens =
    	(perlin( x / 20, -34901, z / 20 ) - 0.5) * 2;
    
    lesserIsleHeight = 72; # 64 + 8;
    
    lesserIsle( mat ) = if( lesserIsleProbDens > 0, mat, -1 );
    lesserIsleTop = lesserIsleHeight
    	+ lesserIsleProbDens * 2;
    lesserIsleBottom = lesserIsleHeight
    	- sqr( lesserIsleProbDens * 10 );
    lesserIsleDirtBottom = lesserIsleHeight
    	- lesserIsleProbDens * 4;
    	
    ## Lesser islands 2
    lesserIsle2ProbDens =
    	(perlin( x / 20, -348, z / 20 ) - 0.5) * 2;
    
    lesserIsle2Height = 80; # 64 + 16;
    
    lesserIsle2( mat ) = if( lesserIsle2ProbDens > 0, mat, -1 );
    lesserIsle2Top = lesserIsle2Height
    	+ lesserIsle2ProbDens * 2;
    lesserIsle2Bottom = lesserIsle2Height
    	- sqr( lesserIsle2ProbDens * 10 );
    lesserIsle2DirtBottom = lesserIsle2Height
    	- lesserIsle2ProbDens * 4;
    
    
    
    ####
    
    layered-terrain(
    	layer( materials.water, 0, 64 ),
    	
    ## Lesser islands
    	layer( lesserIsle( materials.stone ),
    		lesserIsleBottom,
    		lesserIsleTop ),
    	layer( lesserIsle( materials.dirt ),
    		lesserIsleDirtBottom,
    		lesserIsleTop ),
    	layer( lesserIsle( materials.grass ),
    		lesserIsleTop - 1,
    		lesserIsleTop ),
    		
    	layer( lesserIsle2( materials.stone ),
    		lesserIsle2Bottom,
    		lesserIsle2Top ),
    	layer( lesserIsle2( materials.dirt ),
    		lesserIsle2DirtBottom,
    		lesserIsle2Top ),
    	layer( lesserIsle2( materials.grass ),
    		lesserIsle2Top - 1,
    		lesserIsle2Top ),
    
    ## Main islands
    	layer( isle( materials.stone ),
    		islandBottom, islandOffset ),
    	layer( isle( materials.grass ),
    		islandOffset - isleProbDens * 2,
    		islandTop ),
    	layer( isle( materials.dirt ),
    		islandOffset - isleProbDens * 5,
    		islandTop - 1 ),
    	
    	layer( islePond( materials.water ),
    		islandTop - islePondProbDens * 5,
    		islandTop ),
    	layer( islePondFountain( materials.water ),
    		islandTop,
    		islandTop + 8 ),
    	
    	layer( isleRiver( materials.water ),
    		islandTop - isleRiverProbDens * 3,
    		islandTop ),
    	
    ## Seabed.
    	layer( spike( materials.coal-ore, materials.stone ),
    		spikeBottomHeight,
    		spikeTop ),
    	layer( materials.stone,
    		1, seabedTop ),
    	layer( worms( materials.stone ),
    		1, 64 ),
    	layer( materials.bedrock, 0, 1 ),
    	
    	tree-populator( tree-types.round, isleTreeProbDens ),
    	);


    (Script is free for use/modification by whoever wants it. I didn't get to the lava caves...)

    It's really fun to mess around with, just do wish is wasn't so crashy when I decide to make lots of things. :U Won't stop me from continuing to mess with it.
    Posted in: Minecraft Tools
  • To post a comment, please or register a new account.