Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I have started making a 2d minecraft for the CE. The name isn't that unique, so if you want to suggest something different go ahead... It may or may not become an actual game, so for now it's just a world generator. In order to make it editable by the user, I will have to change the saving to a matrix instead of a list as I currently have. I basically just use the list to keep track of the height of each grass block on the x axis, and how far down the stone is (which is stored in the fraction part of the same number). Keeping track of the water/lava is saved differently.

Anyways, here's a download if you want to try it out:
CECRAFT.8xp

And here's some screenies! Very Happy


Controls/Info:
[2nd] - Select/Enter
Arrow Keys - Change parameters or move cursor in-game
[clear] - Quit
-Enter a 0 for the seed in order to enter specific parameters.

Currently, the cursor tells you what block you are hovering over. The program also comes with a rough Day/Night cycle. The code is not super optimized, so if you want to do that, that would be awesome Smile As of now I'm hoping to mainly add deleting/creating blocks in the world, and some really basic Water/Lava physics, where if you delete a block, the water/lava will flow into it if it is adjacent to the block you deleted.

This game CURRENTLY works with the CSE!
Seems cool. The graphics look really nice.
What features do you plan on adding? Possibly some mobs with an AI?
That sure would be difficult, but it would be neat.
Also, maybe when Doors CE and xLIBCE comes out you can use that to make the game better.
Looks really good! I may be able to offer some optimizations, let me take a look.
Edit: Here's my suggestions:
*Every ending parentheses or quote on the end of lines can be omitted. For example:

Code:

:Output(1,1,"A")
can be
:Output(1,1,"A
and
:Line(1,1,2,2,BLACK)
can be
:Line(1,1,2,2,BLACK

It only saves one byte, but every byte counts. If you add up a whole bunch of those, and I see at least 10 or 20 in your code, that's 10-20 bytes saved.

*Similar lines can be combined with bitwise expressions
So in your code, I see:

Code:

Line(10B,10A+9,10B+9,10A+9,BLACK,1
Line(10B,10A+9,10B,10A,BLACK,1
Line(10B,10A,10B+9,10A,BLACK,1
Line(10B+9,10A,10B+9,10A+9,BLACK,1

which can be (with X as a garbage variable)

Code:

For(X,0,3
Line(10B+9(X=3),10A+9(X<2),10B+9not(X=1),10A+9(not(X) or X=3),BLACK,1
End

Although you'd have to test it to see if it's doing the same thing, some times I write it wrong or just don't think about it.
This saves a huge amount of space. If you want to learn more about bitwise expressions, you can experiment.
Edit: Final edit, I promise. It looks really good though, and I don't see anything wrong other than that!
I'll go ahead and give this bad boy a shot. I'll edit my post to tell ya'll the results.

EDIT:
Here are just a few things I suggest to make the program better.
-Do a ClrDraw when exiting the program.
-Attempt to do a default reset when exiting. I had different color graphing lines when exiting.

It's cool as a world generator for now!
o355 wrote:
Here are just a few things I suggest to make the program better.
-Do a ClrDraw when exiting the program.
-Attempt to do a default reset when exiting. I had different color graphing lines when exiting.

I have a StoreGDB at the beginning and a RecallGDB at the end of the program. Those should restore all your previous graph settings, so I don't know why you were having problems... Also, my screen did get cleared already, but I'll add a ClrDraw anyways I guess.
StoreGDB and RecallGDB should do the trick to prevent your graphed lines from getting recolored. I didn't download the program yet, but are you using Shade() to draw the sky as the time changes? The program looks very nice so far, and I'm curious to watch where it will go.
KermMartian wrote:
StoreGDB and RecallGDB should do the trick to prevent your graphed lines from getting recolored. I didn't download the program yet, but are you using Shade() to draw the sky as the time changes? The program looks very nice so far, and I'm curious to watch where it will go.

I use Background color for the sky, as Shade() would be fairly slow.
Ah, okay. With Shade(), you wouldn't have to redraw the foreground, but I guess you're StorePic'ing, changing the background, and then RecallPic'ing?
No, actually. Changing the background doesn't cover up anything that is drawn on the graph, so all I'm doing is just changing the background. No pics involved.
Looks very sweet! I plan on getting cracking with xLIBCE conversion in the coming weeks which might hopefully be able to help out.
Michael2_3B wrote:
o355 wrote:
Here are just a few things I suggest to make the program better.
-Do a ClrDraw when exiting the program.
-Attempt to do a default reset when exiting. I had different color graphing lines when exiting.

I have a StoreGDB at the beginning and a RecallGDB at the end of the program. Those should restore all your previous graph settings, so I don't know why you were having problems... Also, my screen did get cleared already, but I'll add a ClrDraw anyways I guess.


It could be that I was using Cesium to launch it, and not a direct prgm launch.
I would suggest MinCEraft Razz

But yeah, this looks like you made nice progress so far. I can't wait to see what this turns into!
Michael asked me for implementing Matrix-stuff, which is much easier for an editor or whatever.
So I did it, and I saved around 100 bytes.
Here's the link: http://pastebin.com/AreNKiu4
What I've changed is this:

    - Storage in matrix
    - Faster rendering code
    - One loop for displaying stuff, instead of 2
    - Faster checking for underground
I've decided to tackle on a little piece of your code to optimize it a little and came up with some pretty nice code that abuses bitwise expressions Razz I have not tested this because I don't have my CSE with me, so I can't say it will work for sure, but I am fairly confident, the only part I am ambivalent about is the last 3 arguments of the line statement, I made this as though if a line is erased, it's linestyle and color don't matter, but I'm not too sure this is ok... Also, I used PT_'s version so I don't know if this part was even in your original code to begin with Razz
Anyways, here is the modification I'm suggesting.

Code:
   If Z=1:{Brown,Brown,Green,Brown
   If Z=2:{Brown,Brown,Brown,Brown
   If Z=3:{Gray,Gray,Gray,Gray
   If Z=4:{Orange,Orange,13(A=W-1)+Orange(A<W-1),Orange
   If Z=5:{Blue,Blue,13(A=W-1)+Blue(A<W-1),Blue
   If Z:Then
      Line(10B,10A,10B,10A+9,Ans(1),1
      Line(10B+9,10A,10B+9,10A+9,1,Ans(2),1
      Line(10B,10A+9,10B+9,10A+9,Ans(3)!=13,Ans(3
      Line(10B,10A,10B+9,10A,1,Ans(4),1
      Else
      Line(10B,10A,10B,10A+9,0,10,1
      Line(10B+9,10A,10B+9,10A+9,0,10,1
      Line(10B,10A+9,10B+9,10A+9,0,10,1
      Line(10B,10A,10B+9,10A,0,10,1
   End

could be:

Code:
10+5(Z<5)+(Z<3)+8(Z=3
{Ans,Ans,Ans-2(Z=1)+(13(A=W-1)+Ans(A<W-1))(Z>3),Ans
For(C,1,4
   Line(10B+9(C=2),10A+9(C=3),10B+9(C>1),10A+9(C<4),Ans(C)(not(not(Z
End
Notice I changed the colors to their number equivalents, it might have been possible to keep the colors as is, but the way I did it plays with the numbers themselves so it would need some changes. Also, I replaced the If Z:Else part with a not(not(Z as a bitwise expression, this will return a 1 if Z, and a 0 if not(Z, so I can then use it to determine whether I am drawing or erasing a line, and allows me to save a big chunk of code!
Props to PT_ for optimizing the first line Very Happy
One small thing I've fixed; it should be this:

Code:
{Ans,Ans,Ans-2(Z=1)+(A=W-1)(3(Z=4)+8(Z=5)+U),Ans


For the curious one: here's an image:



Someone need to change this code for erasing and displaying the 'cursor' because it is not proper aligned.
PT_ wrote:

Thanks for fixing the cursor alignment, but how is that gif related to your post? Also, what's with the orange line at the bottom that keeps appearing and disappearing? Can that be fixed?

Thanks for the new code btw.

Edit: why is the rendering between each column so chunky? can it be fixed to have less of a pause between each column?
Michael2_3B wrote:
PT_ wrote:

Thanks for fixing the cursor alignment, but how is that gif related to your post? Also, what's with the orange line at the bottom that keeps appearing and disappearing? Can that be fixed?

Thanks for the new code btw.

Edit: why is the rendering between each column so chunky? can it be fixed to have less of a pause between each column?

Not sure what that orange line is, but it seems to be at the level of the lava, as for the speed, I think PT_ is trying this on the CSE, which is quite a bit slower when it comes to drawing stuff to the screen so it should be considerably faster on the CE, so this should not be much of an issue Smile
Also, Jstified sometimes shows things that aren't there or shows them a little differently, so I wouldn't be surprised if the orange line wasn't even there on the calculator Smile
I did it indeed at the CSE using jsTIfied. That orange is lava, because the program first displays the lava or water and after that the dirt and stone. So it is not a bug of jsTIfied, just the program. You can change itif you want.
Another modification, I'm pretty sure this would be faster, and it is definitely smaller. Plus, you won't use the variable Q anymore

Code:
[A](11-A,B+1->Q
   If not(Q:Then
      Text(1,0,"AIR       
      0
   End
   If Q=4:Then
      Text(1,0,"GRASS
      1
   End
   If Q=1
   Then
      Text(1,0,"DIRT     
      2
   End
   If Q=2
   Then
      Text(1,0,"STONE
      3
   End
   If Q=3
   Then
      Text(1,0,sub("LAVA    WATER   ",8L+1,8
      4+L
   End
Ans->Z

could be

Code:
{0,2,3,4+L,1
Ans([A](11-A,B+1)+1->Z
Text(1,0,sub("AIR  GRASSDIRT STONELAVA WATER",5Z+1

Also, I would make it so that the user can press enter in the menu rather than just 2nd. Maybe also use the Ans token to save some more space Razz

Code:
 Repeat K=21
        getKey->K
        Output(3,2,sub("LAVA WATER",5L+1,5
        If K=26 or K=24:not(L->L
    End
    5->W
    Disp sub("LAVA WATER",5L+1,5)+" DEPTH: <

could therefore be...

Code:
Repeat K=21 or K=105
   getKey->K
   sub("LAVA WATER",5L+1,5
   Output(3,2,Ans
   If K=26 or K=24:not(L->L
End
Disp Ans+"DEPTH: <
5->W
I know this is a very old topic, but I just uploaded the program to the archives if anyone is interested.

You may find it here:
https://www.cemetech.net/programs/index.php?mode=file&id=1754

I may or may not do some more things with it.
  
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.

» Go to Registration page
Page 1 of 2
» All times are GMT - 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

 

Advertisement