Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: ben_g on March 23, 2012, 07:02:59 pm

Title: [axe] 2D minecraft game
Post by: ben_g on March 23, 2012, 07:02:59 pm
IMPORTANT: This project hasn't been worked on for a while, and I'm sorry to say it, but it's very lickely that this game, in it's current form, will never be worked on again.
If you want to see the source code, check this post (http://ourl.ca/15643/355084).


original post:

During a few days of being bored while no computer was available, I started to make a game similar to minecraft in axe. Right now, you can only play in creative mode and save only one 24*25 world (can be easily changed in the scource code). It has got 9 blocks so far (the engine supports 15(air not included)), and sand will fall when there is no block underneath it (but only when it's visible). The world isn't generated yet, so you just start with an empty square of 22*23 blocks (edges are made of bedrock, which can't be broken to avoid corrupting memory).

Here's a screenshot showing it in action:
Spoiler For screenshot in spoiler because it causes a bit of lag:
(http://dl.dropbox.com/u/11215358/MC_SCR1.gif)

If you want to play minecraft during class: here's a (DCS) executable:
http://dl.dropbox.com/u/11215358/MCWORLD2.8Xp

If you need an other shel or you want to see or modify the source:
http://dl.dropbox.com/u/11215358/MINESRC2.8Xp

Controls:
arrow keys: move
5: build mode (indicated by a black block at the right bottom of the screen)
2: break mode (indicated by the grey block at the right bottom of the screen)
+: next block (the current block is shown in the bottom right part of the screen)
-: previous block
1, ., 3, 4, 6, 8: place or break a block. 5 and 2 represent the character. The keys around it represent the places around the character. Press one of those keys to place or break a block in that place (depends of if you are in build mode or in break mode)
CLEAR: quit game. This will automatically save the world, but you will always start in the upper left corner of the world.

Bugs? Feature suggestions? comments? complaints? If you have them, please post them.
Title: Re: [axe] 2D minecraft game
Post by: nxtboy III on March 23, 2012, 07:27:56 pm
Woa! That's gonna be good! I like it!
Title: Re: [axe] 2D minecraft game
Post by: boot2490 on March 23, 2012, 07:47:51 pm
And I thought my classmates were impressed when I showed them minecraft on my DS...
Title: Re: [axe] 2D minecraft game
Post by: ben_g on March 23, 2012, 07:49:44 pm
is there a minecraft for DS?
Title: Re: [axe] 2D minecraft game
Post by: boot2490 on March 23, 2012, 07:51:25 pm
Yep.
Title: Re: [axe] 2D minecraft game
Post by: ben_g on March 23, 2012, 07:52:00 pm
where can I find it?
Title: Re: [axe] 2D minecraft game
Post by: boot2490 on March 23, 2012, 07:53:04 pm
http://smealum.net/dscraft/
Title: Re: [axe] 2D minecraft game
Post by: parserp on March 23, 2012, 08:58:04 pm
I like it! :D
Although, without smooth scrolling, it looks glitchy >.>
Title: Re: [axe] 2D minecraft game
Post by: LincolnB on March 23, 2012, 10:26:26 pm
The scrolling is a little chunky, methinks. But nice idea, this could be quite fun.
Title: Re: [axe] 2D minecraft game
Post by: ben_g on March 24, 2012, 04:37:51 pm
I have made a new version: worlds are now 128 by 128 and are saved in appvars. Water and lava blocks are now animated and there are some other blocks added too.

Controls are still the same, but this time the executable is for mirage (so it should be supported ob more calcs).

MINECR3.8xp is the executable, MineSRC and GENWRLD are the source files (compile with axe 1.1.2).
Title: Re: [axe] 2D minecraft game
Post by: kindermoumoute on March 24, 2012, 07:12:55 pm
On this line :
Code: [Select]
!If GetCalc(Str0)->F
 GetCalc(Str0,8192)->F

Add a return if it don't work :
Code: [Select]
!If GetCalc(Str0)->F
 Return!If GetCalc(Str0,8192)->F

getKey(98) ???
getKey(99) ???

A=0 or (A=10) or (A=11) or (A=12) or (A=15)
Is same than :
inData(A+1,Data(1,11,12,13,15))
But this last is more optimized.

Good luck on this. :)
Title: Re: [axe] 2D minecraft game
Post by: ben_g on March 25, 2012, 02:32:43 pm
getkey(98) and getkey(99) are the 1 and 4 keys.

Also, thanks for the optimization and the return. I forgot that if it would fail to create the apvar, it would corrupt memory. the inData works for solid blocks and some not solid blocks. Some, like ladders and lava give problems, but that's probably a mistake on my side.
Title: Re: [axe] 2D minecraft game
Post by: DJ Omnimaga on March 25, 2012, 06:32:32 pm
THis looks quite good actually. I hope it gets finished unlike the many clones or derivatives that got cancelled weeks after their start (such as Tinycraft).
Title: Re: [axe] 2D minecraft game
Post by: boot2490 on March 25, 2012, 06:34:01 pm
Is it top down or side view?
Title: Re: [axe] 2D minecraft game
Post by: Yeong on March 25, 2012, 08:51:37 pm
according to screenshot, it's side view. :D
Title: Re: [axe] 2D minecraft game
Post by: DJ Omnimaga on March 25, 2012, 09:03:59 pm
By the way what is the max world size you plan to have in future versions?
Title: Re: [axe] 2D minecraft game
Post by: annoyingcalc on March 26, 2012, 07:47:31 am
/me dies of happieness
Title: Re: [axe] 2D minecraft game
Post by: awalden0808 on March 26, 2012, 09:01:22 am
I'm building one, too, but in Grammer! I'm not doing grayscale (at least not yet...), and currently working on using appvars for levels as well. I've got a ways to go with that, but here's what I have so far (just using a separate buffer to store the blocks on, recalling the buffer like you would a tilemap, then drawing the player over that):
http://www.ticalc.org/archives/files/fileinfo/446/44632.html

After I've got appvars implemented and variable level size (user can input desired level size, within RAM limitations), I'll look at speed and also prioritize actions (block placing is a bit slow, probably because it's farther down in the code). Maybe even do a complete reconstruction of the game, because that always helps for some reason.

Did you use a sprite for your player? Seems a bit stalky...
Title: Re: [axe] 2D minecraft game
Post by: nxtboy III on March 26, 2012, 09:13:56 am
O.O

That title screen looks AWESOME!!!!!!!!!!!!!
Title: Re: [axe] 2D minecraft game
Post by: awalden0808 on March 26, 2012, 10:06:19 am
O.O

That title screen looks AWESOME!!!!!!!!!!!!!
I know... I'm really surprised with how it turned out. I took an actual screenshot of the title from Minecraft, cut it and shrunk it down to 96x64 in Paint, then spent like 3 hours drawing it out in code. It was fun, and really easy since the pixel coordinates in Paint work like the pixel coordinates required to draw lines in Grammer.

Sometimes I just run the program so I can stare at my title screen and play with the menu. It's probably the most aesthetically pleasing thing I've done on my calculator.

Wish I would have centered the title better. It's a bit off since my cut wasn't exactly symmetrical. I hate asymmetry... >:(
Title: Re: [axe] 2D minecraft game
Post by: Jonius7 on March 27, 2012, 08:59:46 am
2D minecraft with side view does make the perspective more like Terraria, not Minecraft but this looks fun anyway! I shall try this soon.
Title: Re: [axe] 2D minecraft game
Post by: stevon8ter on March 27, 2012, 09:21:00 am
Both impressive games.
I'll try them as soon as I get back from vacation
Title: Re: [axe] 2D minecraft game
Post by: aeTIos on March 27, 2012, 09:28:44 am
Hmmmm, you oughta don't post your projects in someone other's topic.
Looks terrific, otherwise O.O
Title: Re: [axe] 2D minecraft game
Post by: stevon8ter on March 27, 2012, 10:12:56 am
I have made a new version: worlds are now 128 by 128 and are saved in appvars. Water and lava blocks are now animated and there are some other blocks added too.

Controls are still the same, but this time the executable is for mirage (so it should be supported ob more calcs).

MINECR3.8xp is the executable, MineSRC and GENWRLD are the source files (compile with axe 1.1.2).

Ok, does he means its also for mirage OS? Cause it isn't in the list, and it isn't working with the asm( command

(sorry to be N00B) :P
Title: Re: [axe] 2D minecraft game
Post by: turiqwalrus on March 27, 2012, 10:28:07 am
The MINECR3 program should theoretically be showing. If it isn't, try sending said program over to your calculator again.
It should be appearing in the MirageOS menu...

If that fails, get axe 1.1.2 and compile the source file yourself(make sure to set everything correctly on the options page in Axe, though)
Title: Re: [axe] 2D minecraft game
Post by: stevon8ter on March 27, 2012, 10:45:28 am
Ok, I'll try, and uhm, if i wanted to learn axe, do you mind me watching your code?
Title: Re: [axe] 2D minecraft game
Post by: turiqwalrus on March 27, 2012, 11:32:17 am
Ok, I'll try, and uhm, if i wanted to learn axe, do you mind me watching your code?
Well, it's not my code... You'll have to ask ben_g.
But included in the Axe download are several easy-to-understand examples that might help.
Title: Re: [axe] 2D minecraft game
Post by: stevon8ter on March 27, 2012, 11:42:12 am
Ow yeah, didn't read the names so good :P
Title: Re: [axe] 2D minecraft game
Post by: ben_g on March 27, 2012, 12:45:05 pm
Ok, I'll try, and uhm, if i wanted to learn axe, do you mind me watching your code?
I don't mind at all, but if you have no experience with axe, it might be hard to understand.
By the way what is the max world size you plan to have in future versions?

Also, stevon8ter, If it still doesn't work, tell it, then I'll post a version that will work with asm( .
the current world size is 128*128, and that might stay like that because generating a new world now already takes 8 seconds. If that doesn't turn out big enough, then I'll have to make code something in to only generate parts ('chunks') of the world. If that happens, The max world size might be whatever fits into the memory.

I'm building one, too, but in Grammer!
Did you use a sprite for your player? Seems a bit stalky...
Xeda already told me you were working on one. Apparently the controls are almost identical.
And yes, I'm using a sprite for the player. It looks so bad because I'm not good at drawing sprites.

EDIT:
A part of the world generation now works (Thank you Runer for your seeded pseudo random number generator routine).
The world is now made of dirt (on top), stone (usually below ground) and trees a maximum of 20 trees (which spawn on the first dirt block of a collum). There are also still the bedrock borders.

The main source isn't changed, so you can just recompile with the previous minesrc3 program, and download the new genwrld program here. minecr_exe is the new executable. When you run it, don't worry, your calc isn't frozen. World generation takes 8 secounds

I also included an example world which can be loaded by the previous version (the one that supports appvars) (MCworld)
Title: Re: [axe] 2D minecraft game
Post by: kindermoumoute on March 27, 2012, 05:06:52 pm
Screen ?
Title: Re: [axe] 2D minecraft game
Post by: nxtboy III on March 27, 2012, 06:41:16 pm
Ya, screenie?
Title: Re: [axe] 2D minecraft game
Post by: Jonius7 on March 27, 2012, 08:02:17 pm
What's with all these short posts?
I still haven't tried it yet but I've downloaded the files at least.
Title: Re: [axe] 2D minecraft game
Post by: ben_g on March 28, 2012, 02:08:19 pm
Screen ?
Sorry, I didn't have enough time yesterday to make a screenshot.

Here is one, showing the world generation (which is now also a lot faster).
Title: Re: [axe] 2D minecraft game
Post by: Spyro543 on March 28, 2012, 03:24:20 pm
What are all the kinds of blocks you have in this game?
Title: Re: [axe] 2D minecraft game
Post by: DJ Omnimaga on March 28, 2012, 03:29:33 pm
What about a 256x64 world instead of 128x128? I don't remember if Minecraft needs this much depth and it would leave more space to build stuff. Or maybe 192x96?
Title: Re: [axe] 2D minecraft game
Post by: ben_g on March 28, 2012, 05:01:19 pm
What are all the kinds of blocks you have in this game?

solid
naturally generated
can't be used to build
unbreakable
currently unused

from id 0 to id 15:
air, wood, bedrock, leaves, planks, dirt, stone, cobblestone, iron ore, sand(can fall), ladder, water, lava, TNT(doesn't work yet), solid object, fluid object

What about a 256x64 world instead of 128x128? I don't remember if Minecraft needs this much depth and it would leave more space to build stuff. Or maybe 192x96?
128 is what the old minecraft used (now it's 256), so that should deffinately give you enough height. And the program itself doesn't use much RAM so right now a world of the size 128*300 blocks can fit in RAM, together with the program. So what fits in RAM isn't the problem right now. And too see if 128 is a good limit, then you must be able to fully play it, and for that it is in a too early state. What I mean with that is: I'm going to make this game fully functional first, so I'll imediately know if the world size is good or not.
Title: Re: [axe] 2D minecraft game
Post by: LincolnB on March 28, 2012, 05:17:06 pm
Not to be rude, but is there a particular reason the scrolling is kind of chunky?
Title: Re: [axe] 2D minecraft game
Post by: ben_g on March 28, 2012, 05:31:24 pm
That's because when you reach the edges of the screen, the blocks in the edit buffer (the blocks that you see) are copied to the world and the blocks which are on an other location are loaded. this makes the part of the world that you can see shift by 8 pixels, and to make sure the player won't be stuck in blocks, the player moves 8 blocks as well. This causes the bad scrolling. I will probably once implement smooth scrolling, but I don't really know how to do that yet. I'm already glad the tilemap fully works and has collision checking and scrolling.

Since you all wanted it:
(http://img.removedfromgame.com/imgs/MC_SCR3.gif)

I hope you like it. It was hard to get it to work.
Title: Re: [axe] 2D minecraft game
Post by: annoyingcalc on March 28, 2012, 09:34:56 pm
Epic screenie ill download it when im not thinking of html codes to mess with my school ( they use chrome and I love editing the scripts to mess with my teachers (and secretly play minecraft))
Title: Re: [axe] 2D minecraft game
Post by: ben_g on April 14, 2012, 12:49:40 am
progress went slowly because the OS ate my source files a few times, but here's a small update: the world generation now generates a hilly landscape instaed of the flat landscape with a few block at higher and lower coordinates, the bug that made trees sometimes spawn next to eachother and overlap has been solved, and large narrow veins of iron ore are generated. The long narrow shape isn't intended, the blocks are placed randomly, but somehow they often group together in veins. That's it. I hope you enjoy.

Title: Re: [axe] 2D minecraft game
Post by: annoyingcalc on April 14, 2012, 12:53:09 am
error pic missing
edit nvm cool! I like it
Title: Re: [axe] 2D minecraft game
Post by: ben_g on April 14, 2012, 01:06:54 am
everyone why reads this thread seems to be addicted to screenshots...

Here's one:
the diagonal line of dirt is a bug, and I haven't been able to find the cause of it. 1+ for who does find it

Spoiler For Spoiler:
(http://img.removedfromgame.com/imgs/If%20you%20read%20this%20filename,%20you%20have%20lost%20the%20game.gif)
Title: Re: [axe] 2D minecraft game
Post by: nxtboy III on April 14, 2012, 02:29:19 am
Wow ben_g, the better scrolling makes the game a lot better. :D
Nice job. :thumbsup:
Title: Re: [axe] 2D minecraft game
Post by: Chockosta on April 16, 2012, 10:24:19 am
This looks awesome!
(especially the scrolling)
I think that you might want to add a line between the world and the inventory...

Great job!
Title: Re: [axe] 2D minecraft game
Post by: hellninjas on May 04, 2012, 12:19:23 pm
Bump!
Status update ben_g?
Title: Re: [axe] 2D minecraft game
Post by: ben_g on May 04, 2012, 01:29:20 pm
I'm sorry, but I haven't really done anything else to it. I have made almost all of this when I had nothing to do in school, and there haven't been many of those moments lately. And the progress that I did make was eaten by one of the glitches in the operating system.
Title: Re: [axe] 2D minecraft game
Post by: hellninjas on May 04, 2012, 03:03:30 pm
Darn D:
I hope you'll find some time soon! ^.^
Title: Re: [axe] 2D minecraft game
Post by: TheBassetHound on May 12, 2013, 09:41:22 pm
     Looks as if you haven't been doing anything with it lately... Could I by any chance have the source code? I'd like to see what axe is like, and i might be able to help improve the game. Cuz this is, like, a dream come true for me. I LOOOOVE Minecraft (I will get it onto my 3ds) and this is the PERFECT opportunity to sneak it into class.
Title: Re: [axe] 2D minecraft game
Post by: ben_g on May 13, 2013, 04:50:59 pm
Sure you can have the source code. It's an open-source project.
On the previous page, there's a download. The two upper files are the source code.
I once had a working inventory, but I lost the source of it some time ago, so what you can find in this thread should be the most recent one.

If you don't understand something in the code, or want to know why I handled it like that, you can always ask me.
Title: Re: [axe] 2D minecraft game
Post by: TheBassetHound on May 13, 2013, 09:16:57 pm
      Oh... oops. I didn't see it. Derp.
      Actally, I don't know any  axe. I was thinking i could learn a bit about  it by looking at the code. :P
     But thanks! :thumbsup:
Title: Re: [axe] 2D minecraft game
Post by: DJ Omnimaga on June 30, 2013, 05:40:22 pm
Shame that this died, since it looked quite cool. I haven't got time to try the latest version, though, so I'm gonna download it now for later. :)
Title: Re: [axe] 2D minecraft game
Post by: ben_g on June 30, 2013, 06:54:49 pm
Shame that this died, since it looked quite cool. I haven't got time to try the latest version, though, so I'm gonna download it now for later. :)
I have already considered to revive it, but the 2D part of this game makes it really limited. It's hard to build a nice looking home, and if I'd implement jumping, you'd need a ton of ladders to get around.
I already thought about recoding it with an isometric engine that can handle 3D worlds (and that can rotate the view at 90° intervals, or maybe 45° of which 4 of the views would be birdview instaed of isometric), and I did a small proof of concept of this (no textures, no player, only graphics), and it worked, but it was a bit unreliable and unstable, and it didn't look that good anyway).
Something else I have considered is a VERY limited voxel-based engine. I already have an algorithm to severely limit the amount of polygons needed to draw (for a 5*5*5 world: best case: 15 quads, most cases: 20 quads, worst case: 25 quads(could in some cases be decreased with aslightely more clever algorithm)), but for this to work correctely, I need a way to draw quads with a persfective-corrected and masked texture. And this might be so slow that even a 5*5*5 world is too much to handle. And if it's possible, I doubt that anyone wants to play minecraft with a view distance of 5 blocks.

Maybe when I have some time I should try to make 2 'prototype' engines following the methods mentionned above.
Title: Re: [axe] 2D minecraft game
Post by: DJ Omnimaga on July 04, 2013, 01:18:09 am
Isometric would be nice, but I wonder how slow it would be with that many layers of tiles to render or checking which one to render and which one not to? O.O
Title: Re: [axe] 2D minecraft game
Post by: Piguy-3.14 on July 23, 2013, 01:40:27 pm
This is pretty cool, love the random world generator, and the fact that you could complete collision:) also I have a game similar to yours(Picraft 2) and of course it's nothing like yours, as I'm relatively new to axe so I'm not that good with coding yet, but I was wondering if I could by chance see the source code for the game, as I'm currently trying to add tilemapping into my game and I have not seen any tilemap tutorials that apply specifically to a Terria like game and I think viewing the code may help me understand it better and hopefully be able to design one for my game. I'm also struggling with collision which I see you've mastered and once again their is no specific tutorial on a building based collision engine so viewing how you managed it would most likely help me implement it into my game. So only if its ok with you am I allowed to view the source just so I can try to add some of those features into my game. Of course I would create my own code, but I think seeing how someone else did it may help me add it, btw great game, hopefully I can eventually make mine as good as yours, thanks.
Title: Re: [axe] 2D minecraft game
Post by: ben_g on July 23, 2013, 02:54:14 pm
Of course you can see the source of this open-source project. The latest not-lost source can be found as an attachement on this post (http://ourl.ca/15643/296886). Feel free to use the source in any way you like. You are allowed to copy-paste parts of the code in your problem, and if you do that, it would be nice if you add me to the credits, but you don't have to.
Anyway, I hope you can learn from the source.

Edit: To make it more clear for you and anyone else who wants the source code of the latest version (shown in the screenshot):
(http://img.removedfromgame.com/imgs/If%20you%20read%20this%20filename,%20you%20have%20lost%20the%20game.gif)
Click here to download the main source file (http://www.omnimaga.org/index.php?action=dlattach;topic=13046.0;attach=12480)
Click here to download the source code of the world generator (http://www.omnimaga.org/index.php?action=dlattach;topic=13046.0;attach=12480)

To compile proprely, you must have both files.
Title: Re: [axe] 2D minecraft game
Post by: DJ Omnimaga on July 24, 2013, 03:47:56 am
I like the graphics, but if you are only gonna use 1 shade of gray for the entire tileset, wouldn't it be better to make it black or add more details with different shades of gray?
Title: Re: [axe] 2D minecraft game
Post by: Sorunome on July 24, 2013, 05:06:40 am
Will you change later that you won't be able to fly? :P

But yeah, it is looking pretty cool, great job!
Title: Re: [axe] 2D minecraft game
Post by: ben_g on July 24, 2013, 07:17:01 am
I like the graphics, but if you are only gonna use 1 shade of gray for the entire tileset, wouldn't it be better to make it black or add more details with different shades of gray?
Will you change later that you won't be able to fly? :P

But yeah, it is looking pretty cool, great job!
I think you misunderstood. I haven't worked on this project for a while, but I've gotten a few requests from poeple wanting to see the source code of this project. And because the download link is 'hidden' somewere in this thread, I decided to make it a bit easier to find.

I'm sorry, but this project won't be updated soon. I'm now focussing on my java game. Maybe after that, I'll see what I can do to revive this project.
Title: Re: [axe] 2D minecraft game
Post by: DJ Omnimaga on July 24, 2013, 10:40:03 pm
Yeah I know it's dead, but I was pointing out for anybody who might want to restart the project from where you left off.
Title: Re: [axe] 2D minecraft game
Post by: ben_g on July 25, 2013, 11:17:25 am
Maybe I should point out why I used the grayscale:
The whole tileset is made up of monochrome sprites. They were never meant to have muliple shades of grey. They have the dark-grey color because the player is black (and the planned mobs would have been black as well). The slightely lighter shade of the surroundings makes it easier to see the mobs. Further, the planned tile entities (like chests, signs, a fuse to replace redstone for safely setting off tnt, fire...), were meant to use the lighter shade.
This is mainly done because the screen is blurry when it's scrolling, then the different 'colours' make it easier to tell them apart.

The action bar also used greyscale to indicate which item was selected, but unfurtunately, the source code of this has been lost, together with the fully working inventory, because of an OS glitch :(

But when I look after it afterwards, the grayscale (together with the crappyness of the tilemapper code) made the engine very slow. But since so much of the game is based on the tilemapper, it takes a lot of work to change that. This, together with the loss of source code (AND on-calc backup), is the main cause why I lost motivation and why I didn't pick this project back up when I had time to work on it.

The flying is easy to change to jumping, but I let it in because it's easier while debugging, and because I was to lazy to make ladders work, it was the best way to get out of a pit.
Title: Re: [axe] 2D minecraft game
Post by: Aspiring on April 04, 2014, 04:03:04 pm
I would like to have the source to this but when i click on one of the links I get a message saying an error has occurred.  :/
Title: Re: [axe] 2D minecraft game
Post by: ben_g on April 04, 2014, 04:25:11 pm
I think the links got broken because of the forum update.


I've reuploaded the files and attached them to this post.


MINECR999.8xp is the executable (MirrageOS iirc), MINESRC0.8xp is the main source file, and GENWRLD2.8xp is the world generator source.
To compile, make sure that you have both the main source and the source for the world generator on your calc, and compile MINESRC0. I think I used axe 1.0.3 for this game, but I doubt that I used anything version specific, so it'll probably work in most recent axe versions.
Title: Re: [axe] 2D minecraft game
Post by: Aspiring on April 04, 2014, 05:56:18 pm
Thanks!  :thumbsup: