Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Help with images + memblocks

Author
Message
Goz3rr
16
Years of Service
User Offline
Joined: 27th Mar 2010
Location:
Posted: 17th Apr 2011 10:47 Edited at: 17th Apr 2011 13:07
I've written this code:


And at first, it just drew the picture to the screen but this limited the image size to the window size. Now im trying to write it to a memblock, and it appears the game just freezes. The please wait doesn't even show up anymore!

Edit: I've updated the code a bit, i now use make memblock instead of create memblock from bitmap, but now the whole texture ends up being black.

Edit2: Oops! I'm such a idiot, i forgot to write the width height and depth to the memblock! For those interested, this is the final code for creating the memblock:



Edit3: New question, i'm creating my terrain out of create cube id,1's, and i need a way to determine if a cube is visible or not, I was thinking dont create the cube if there are blocks on all sides of it (left right front back up down), because when i just draw all cubes my game takes up 200mb of memory with a 64x64x10 map.


...
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Apr 2011 12:57
It sounds like you want something like occlusion I'm guessing? Building a terrain out of cubes sounds like a bad idea anyway.

Once you have your terrain built in memory (in an array), run it through a function to check for hidden cubes before you actually create them. I'm not sure how you plan to lay the cubes out or what the spacing will be (can they overlap? equal distances apart?), but you could just loop through all the cubes and do exactly what you said, check all 6 directions. If any of the 6 directions is empty, exit the check and create the cube. If that makes any sense.

The Internet: Where men are men, women are men, and children are federal agents
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 19th Apr 2011 13:29
This is the 4th post I've seen that is MineCraft related

MineCraft doesn't use cubes, it uses a deformable mesh. In other words, it only draws the sides of the cubes that need to be drawn. Picture a 3x3x3 grid. Only the surfaces you can see will be created, so you will have 6*3*3 faces=54. Now I go on top of it, and remove the block located at 2,1,2 (top block in the center). It may look like I'm removing a cube, but what's really happening is I'm deleting the top surface of the block 2,1,2, and am creating 5 more surfaces to the left, right, front, back and bottom of the block 2,1,2. If I remove block 1,1,1 (a corner piece), I will be deleting the faces top, left, front, and will be creating the faces bottom, right, back.

You will quickly notice that the faces "invert", both when creating or deleting a block. All you have to do is check if a face is already at that position, if so, delete it, else create it.

I hope you can follow, I don't know how else I can explain it. If anyone wants to help out and explain it better, please do

TheComet

Goz3rr
16
Years of Service
User Offline
Joined: 27th Mar 2010
Location:
Posted: 25th Apr 2011 22:55
@TheComet:

Could i achieve this with a matrix? In another post someone told me a tunnel with in a matrix is impossible. I'm not trying to create a minecraft clone here (really), but destructible terrains are easiest with cubes. How would i create a face/plane in Darkbasic Pro?

...
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 26th Apr 2011 01:52
There's a create 'triangle' function in DBPro that could be exploited, maybe creating manual faces using triangle can achieve what the 'minecraft' thing does.

Warning! May contain Nuts!

Login to post a reply

Server time is: 2026-07-11 23:21:43
Your offset time is: 2026-07-11 23:21:43