Author Topic: nCraft (3D minecraft-like game for the nspire)  (Read 102074 times)

0 Members and 1 Guest are viewing this topic.

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #195 on: September 27, 2012, 08:39:39 pm »
Thanks for the help !

First off, it is important to note that whenever the camera is within a voxel, the voxels that are rendered are sorted relative to the distance they are to that voxel.  Consequently no matter what voxel the camera is in, the order of the rendered voxels is always the same relative to the center camera voxel.  What this means is that you can presort a large number of voxel positions into an array based on how far they are from a center voxel, and simply use those positions relative to the camera to render.
Seems interesting. Could you give an exemple ? Because of my poor English skills, I'm not sure that I've got it very well...

This works, but it can take up a large amount of memory.  If that is a problem, there is another solution that I discovered when working on my Castle Storm game, which uses a similar rendering method.  The way it would work is by drawing the voxels (still relative to the camera position) in shells, and it is painfully difficult to explain, so if you are interested, I can whip up some sort of gif or example and we can talk from there
Memory isn't a big problem on the TI-Nspire. i can achieve full world renders, which means that I use an array containing more than 30,000 floats...

Now, this would speed up the sorting of cubes, but it would not actually speed up the drawing, which is probably another main bottleneck.  First off, since you are only rendering cubes, you can always discard the faces that are facing away from you.  This is a rendering trick you can use on convex objects, that any faces that are facing away from you cannot actually be seen.  Additionally, you can use a simply dot product to detect whether or not a face is facing away from you, so it is super speedy and results in half of your faces being discarded!
I already do that :)

Another method would be to look at the cubes surrounding a cube to be rendered.  When you go to render a cube, you can look at neighboring cubes to see if they are solid, if not, you do not have to render the connecting face!  This should result in significant speedups hopefully, since using these methods would drastically cut down on the number of polygons you need to render in any given frame. 
This could improve my drawing function indeed, since I draw every cube that "touches" an empty block...




By the way, I added a function to render full world with F.
You now can see your creations properly :)
Full renders take about 5 secs to generate...
But as I said, I use more than 30,000 floats, so I'm afraid that it might crash grayscale Nspires, which don't have so much RAM. (it doesn't crash the grayscale emulator, though)
hm I get a crash when I press F sadly
ti-nspire CX OS 3.1.0
This used to contain a signature.

Offline Nathan Jahreis

  • LV3 Member (Next: 100)
  • ***
  • Posts: 45
  • Rating: +1/-0
  • That strange mix of nerd, redneck, and trains ;)
    • View Profile
    • https://sites.google.com/site/nathanjahreis/
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #196 on: September 27, 2012, 09:29:22 pm »
hm I get a crash when I press F sadly
ti-nspire CX OS 3.1.0

I also got a crash after pressing "f" but only once, after the reboot I could press "f" at will.  However the newly drawn background would disappear after moving.

TOTALLY AWESOME ANYWAY!!!!!!
« Last Edit: September 27, 2012, 09:30:36 pm by Nathan Jahreis »

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #197 on: September 27, 2012, 09:30:30 pm »
Same, I think thats the way its supposed to be due to lag issues
This used to contain a signature.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #198 on: September 27, 2012, 10:15:13 pm »
I didn't have any problems with pressing F until I read these posts and tried it again
only then did it crash
:P
Vy'o'us pleorsdti thl'e gjaemue

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #199 on: September 27, 2012, 10:32:46 pm »
XD
This used to contain a signature.

Offline blfngl

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +3/-4
  • No worry, I'll surpass Calc84 in greatness...never
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #200 on: September 27, 2012, 11:15:08 pm »
Is there a jump key?
« Last Edit: September 27, 2012, 11:16:05 pm by blfngl »
GAMEGAMEGAMEGAMEGAMEGAMEGAMEGAMEGAMEGAME
My blog:

TiLibs
My Projects:
Minecraft Library

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #201 on: September 27, 2012, 11:27:28 pm »
No
This used to contain a signature.

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #202 on: September 28, 2012, 11:46:10 am »
hm I get a crash when I press F sadly
ti-nspire CX OS 3.1.0
Yes, if there is no much free RAM, it crashes.
That's because the algorithm that I used is totally stupid... I render all the blocks in once. I am working to use a chunk-based render, that should divide the used RAM by 25 :) .

Is there a jump key?
No, but that's planned. By the way, which keys should I use ? Because Augs said that the current ones are inconvenient...

This is great.
Also seconded on the saving. Even if it's just a savestate or something, it'd be worth it :D
Saving is indeed the next big step.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #203 on: September 28, 2012, 12:24:23 pm »
Is there a reason you use double instead of float? If you don't really need the extra precision, you can go with float and use half the space (and probably less processing time too)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #204 on: September 28, 2012, 12:29:30 pm »
Is there a reason you use double instead of float? If you don't really need the extra precision, you can go with float and use half the space (and probably less processing time too)
Yes, I changed to floats yesterday, like 30 minutes after posting my code :P

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #205 on: September 28, 2012, 12:49:59 pm »
Quote
Because Augs said that the current ones are inconvenient...

Yes you should use 7 to break blocks and 9 to place blocks. Or have a way of changing the controls. I would also like to thank you for this gift!

Edit: sorry if my previous post did not make sense. I was holding shift when I pressed 7.
« Last Edit: September 28, 2012, 02:07:37 pm by Augs »

Offline blfngl

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +3/-4
  • No worry, I'll surpass Calc84 in greatness...never
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #206 on: September 28, 2012, 05:19:02 pm »
5 could be the jump button, and you could change 2 to the only backwards key.
Also, is an inventory being planned?

Fun fact: Holding down 8 and 5 lets you sneak :ninja:
GAMEGAMEGAMEGAMEGAMEGAMEGAMEGAMEGAMEGAME
My blog:

TiLibs
My Projects:
Minecraft Library

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #207 on: September 28, 2012, 06:24:14 pm »
Quote
Also, is an inventory being planned?

Like this?(I made this in 1 minute)

« Last Edit: September 28, 2012, 06:25:25 pm by Augs »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #208 on: September 28, 2012, 06:40:40 pm »
Darn, those screenshots with landscapes and built stuff (such as in Annoyingcalc's avatar) makes me want to get the game even more. This is definitively the closest thing to Minecraft on calcs so far.

Also that item menu above would be nice, although maybe twice smaller, since the calc screen is kinda small. That way it won't take too much space.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: nCraft (3D minecraft-like game for the nspire)
« Reply #209 on: September 28, 2012, 07:26:06 pm »
The program is great but the problem with it is that controls are awkward and that you can't save.

Edit: I know these will be fixed and hope they will be.
« Last Edit: September 28, 2012, 07:56:57 pm by Augs »