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 / MineCraft with memblocks - Help optimize this?

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 13th Aug 2011 20:36 Edited at: 14th Aug 2011 00:14
Hey all,


I was sick and decided to waste my time by writing a MineCraft engine thingy. Everyone that I've seen making something like this has avoided memblocks, or was told to avoid memblocks, so I decided to ignore that valuable bit of advice and make mine with memblocks Anyway enough with the rambling. It works, the Project folder is attached. The only problem now is that it's REALLY SLOW. It takes 5 seconds to make 256 blocks, and that SUCKS.

I've tracked the slowness down to this bit of code here:



specifically looking at this bit, this bit is REALLY slow:



It deletes all data from pos to pos+shift by shifting the data coming after that section down to fill the gap. Any way to optimize this?


Thanks,

TheComet

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 13th Aug 2011 22:02
IanM's "Make Object New" as well as using "Lock Vertex Data" and "Unlock Vertex Data" are so much easier making objects than using memblocks. Also instancing objects speeds things up.

Your using a hefty 3 dimensional array. Could you not use a simple array that can be sorted into groups for areas.

And, instead of storing let's say 10 blocks in an array, could you not store that info in one array item, ie, height of blocks, top block piece, middle blocks piece and bottom blocks piece.

Warning! May contain Nuts!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Aug 2011 00:55
Hi there.

Thanks TheComet. My problem was my explorer now with Mozillas goes ok. Do I have to have any plug in ? it gives me an error " Darkbasic stop runing " I have rem the line set display mode 1600,1200,32 because my laptop is panoramic 1366*768 and still get this error. Do I have to execute in a different screen resolution ?


Cheers.

I'm not a grumpy grandpa
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 14th Aug 2011 02:18
Awesome

I use the plugins:

-sparky's
-multijoy

If you don't have multijoy, the only command I use is range(). Can be replaced with this:



TheComet

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 14th Aug 2011 02:30
Using the vertexdata commands, my 'engine' can create 20,736 blocks in 5.8 seconds.

So yeah, Don't use memblocks :3

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Aug 2011 02:46 Edited at: 14th Aug 2011 02:47
Quote: "If you don't have multijoy, the only command I use is range(). Can be replaced with this:
function range(value,low,hi)

if value<low then value=low
if value>hi then value=hi

endfunction value



"



Works thanks !! I'll will study your code

Cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-10 17:19:30
Your offset time is: 2026-07-10 17:19:30