Introducing my next project: Tile World!

Tile World is going to be an improved version of my Fractal Terrain Generation program, rebuilt to use lists instead of matrices (to allow for a larger world), an improved terrain generator, a better view angle, and (hopefully) cool terrain features like trees and rivers! I am still figuring out how to draw it correctly, but the generation code is below. A download file is on the Github. I look forward to any feedback/optimizations any of you have!

Code:
```ClrHome Input "SEED ([i] FOR RANDOM): ",S Input "DETAIL (1-10): ",D startTmr->T ClrHome int(max(1,min(10,D->D If imag(S:int(.01randT->S Output(1,1,"SEED: "+eval(S Output(9,1,"INITIALIZING... " 775->dim(|LX:775->dim(|LZ 5(1-rand(775)2->|LY 0->|N For(X,1,25    For([recursiven],1,31       |N+1->|N       X->|LX(|N:[recursiven]->|LZ(|N       Output(9,17,eval(int(100|N/775))+"% End:End Output(9,1,"GENERATING HEIGHT... " 3->|N For([recursiven],1,D    |LY+|N(1-rand(775)2->|LY    |N/1.3->|N    If [recursiven]>=.6D:max(0,|LY->|LY    Output(9,22,eval(int(60[recursiven]/D))+"% End Output(10,1,"SMOOTHING..." |LY->|LYA 0->|N For(X,1,24    For([recursiven],1,31       0       If X>1:|LYA(25(X-1)+[recursiven]       If [recursiven]>1:Ans+|LYA(31X+[recursiven]-1       If X<24:Ans+|LYA(31(X+1)+[recursiven]       If [recursiven]<31:Ans+|LYA(31X+[recursiven]+1       .5(|LY(31X+[recursiven])+(Ans/((V>1)+([recursiven]>1)+(V<24)+([recursiven]<31)->|LY(31X+[recursiven]       |N+1->|N       Output(9,14,eval(int(60+40|N/744))+"% End:End checkTmr(T->T Disp Ans```
Lists can only be 999 elements long, so even though you could make a larger world than with a matrix you can only get up to a 32x31 (992 elements) world. Unless you're planning to use multiple decimal places or fractional parts for different values.
Big. Update.
We now have relatively fast drawing...
And painstakingly slow calculating.
The Github has been updated

The current time for a Seed of 42, a Height Scale of 2, and a Smoothness of 5 is around 514 seconds.

Known bug: The percentage sometimes shows up weird

prgmTILEWRLD

Code:
```ClrHome Input "Seed ([i] For Random): ",S Disp "Height Scale Input "(1=Flat,4=Tall): ",H Input "Smoothness (1-5): ",F startTmr->T ClrHome If imag(S:int(.01randT->S 5-int(max(1,min(4,H->H int(max(1,min(5,F->F Output(1,1,"Seed: "+eval(S Output(9,1,"Initializing... " 775->dim(|LX:775->dim(|LZ 2(1-rand(775)2->|LY 0->|N For(X,1,31    For([recursiven],1,25       |N+1->|N       X->|LX(|N:[recursiven]->|LZ(|N       Output(9,17,eval(int(100|N/775))+"% End:End Output(9,1,"Generating Height... " 1.5->|N For([recursiven],1,4    |LY+|N(1-rand(775)2->|LY    |N/1.2->|N    Output(9,22,eval(int(12.5[recursiven]))+"% End max(0,min(7,|LY->|LY |LY/H->|LY Output(10,1,"Smoothing..." 0->|N For(A,1,F    |LY->|LYA    For(X,1,30       For([recursiven],1,25          0          If X>1:|LYA(25(X-1)+[recursiven]          If [recursiven]>1:Ans+|LYA(25X+[recursiven]-1          If X<30:Ans+|LYA(25(X+1)+[recursiven]          If [recursiven]<25:Ans+|LYA(25X+[recursiven]+1          .5(1.5|LY(25X+[recursiven])+(Ans/((V>1)+([recursiven]>1)+(V<31)+([recursiven]<25)->|LY(25X+[recursiven]          |N+1->|N          Output(9,22,eval(int(50+|N/(A15)))+"% End:End:End DelVar |LYA ClrDraw {14,16,15,21->|LC {.2,4,5,7->|LE ~9->Xmin:21->Xmax 2->Ymin:21->Ymax (|LX-|LZ)cos(30->|LXP |LY+(|LX+|LZ)sin(20->|LYP For(V,30,1,~1)    For([recursiven],25,1,~1)       If V<30:Then          LtBlue->theta          max(|LY(25V+[recursiven]),|LY(25(V+1)+[recursiven]->C          For(H,1,dim(|LC))             If C>|LE(H:|LC(H->theta          End          Line(|LXP(25V+[recursiven]),|LYP(25V+[recursiven]),|LXP(25(V+1)+[recursiven]),|LYP(25(V+1)+[recursiven]),theta       End       If [recursiven]<25:Then          LtBlue->theta          max(|LY(25V+[recursiven]),|LY(25V+[recursiven]+1->C          For(H,1,dim(|LC))             If C>|LE(H:|LC(H->theta          End          Line(|LXP(25V+[recursiven]),|LYP(25V+[recursiven]),|LXP(25V+[recursiven]+1),|LYP(25V+[recursiven]+1),theta       End End:End checkTmr(T->T Disp Ans```

Edit: I added ClrDraw because I forgot to check my code before uploading it like a fricken idiot XD
Really cool - have you thought about including some screenshots for people to see?
I played around with your code, here is what I've got. Its about 2x faster and I think its still mathematically equivalent.
The random numbers generated will be different but still evenly distributed along the same range. I started from the file on your github and noticed you assume the calculator is already in Degrees... Mine was not.
I made a few small changes for aesthetic reasons such as making the line width 1px and adjusting the bounds.

Code:
```ClrHome Degree Input "Seed ([i] For Random): ",S Disp "Height Scale Input "(1=Flat,4=Tall): ",H Input "Smoothness (1-5): ",F startTmr->T ClrHome If imag(S:int(.01randT->S 5-int(max(1,min(4,H->H int(max(1,min(5,F->F Output(1,1,"Seed: "+eval(S Output(8,1,"Initializing... 0->|N cumSum(binomcdf(24,0 For(X,1,5    augment(Ans,Ans End Ans->|LZ binomcdf(24,0 For(X,2,31    augment(Ans,Xbinomcdf(24,0    Output(8,17,int(100X/31 End Ans->|LX 775->dim(|LZ Output(9,1,"Generating Height... 6.66(1-rand(775)2->|LY max(0,min(7,|LY->|LY |LY/H->|LY Output(10,1,"Smoothing..." For(A,1,F    Output(10,15,toString(A)+"/"+toString(F    |LY->L1    For(X,1,30       For([recursiven],1,25          25X+[recursiven]->I%          0          If X>1:L1(I%-25          If [recursiven]>1:Ans+L1(I%-1          If X<30:Ans+L1(I%+25          If [recursiven]<25:Ans+L1(I%+1                    .5(1.5|LY(I%)+(Ans/((V>1)+([recursiven]>1)+(V<31)+([recursiven]<25->|LY(I%       End              Output(10,21,toString(int(100(X/30)))+"  End:End ClrDraw {18,14,16,15,21->|LC {0,0.2,4,5,7->|LE ~20->Xmin:24->Xmax 2.5->Ymin:19.5->Ymax (|LX-|LZ)cos(30->L1 |LY+(|LX+|LZ)sin(20->L2 For(V,30,1,~1)    For([recursiven],25,1,~1)       25V+[recursiven]       If V<30:Then          Line(L1(Ans),L2(Ans),L1(Ans+25),L2(Ans+25),|LC(sum(|LE<max(|LY(Ans),|LY(Ans+1)))),1       End       If [recursiven]<25:Then          Line(L1(Ans),L2(Ans),L1(Ans+1),L2(Ans+1),|LC(sum(|LE<max(|LY(Ans),|LY(Ans+1)))),1       End End:End checkTmr(T->T Disp Ans```

There are still small things that could be done like replacing 100 with E2 and replacing eval( with toString( which is a bit faster, but those things won't make much of a difference. It seems pretty clear that the smoothing is by far the slowest part but I haven't really thought of a better way to do it. (except maybe slightly unrolling it to treat the edge cases separately from the middle points but I haven't done that) Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum