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.

Dark GDK / MemBlocks , What are they?

Author
Message
haliop
User Banned
Posted: 8th Dec 2009 17:25
can someone explain me what is a MemBlock and how do i use it?
cause i really don't understand
and can you also give me an Example wheter its written or coded...
i just dont get it , and what i can do with it and how it can help me

ty for your time.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 8th Dec 2009 18:07
A memblock is just a piece of memory that is yours to play with. It can contain many different kinds of data, so you could use them as arrays of more than one type if you wish.

With DarkGDK, they are utilized to do special things with them. Basically, you create a memblock, of a specific size, and fill it with data in a particular format. This format can store information about objects, images, w/e. You can then tell DarkGDK to read the information in this bit of memory, and make objects, and images, etc.

You can also do the same backwards - have an object, and turn it into a memblock. You can then apply some changes to the memblock, and turn it back into an object. Of course, this is the slow way to use objects - you'd really use the vertexdata commands

"everyone forgets a semi-colon sometimes." - Phaelax
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 8th Dec 2009 19:04
So what is the advantage of using a memblock verse a regular integer for exaomple.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 8th Dec 2009 20:53
A single integer is only 4 bytes. A memblock is more akin to an array, and can have as many bytes as you like.

If you have a memblock with 12 bytes, for example, you can put an integer, a float and two characters (in whatever order you like).

When you read it back, you just have to make sure you read it in the right order, otherwise the information will all be gibberish. That means that as long as you put information in in the correct format, DarkGDK will be able to read it in the right order and do something useful with it.

The DBPro help files give you examples of the formatting you should use with memblocks for certain in-game entities, like objects and images.

But the point here is, that memblocks can take up as much memory as you want. Infact, doing "dbMakeMemblock(1, 12);" is a bit like doing "char *memblock = new char[12];" (since chars take up one byte each).

"everyone forgets a semi-colon sometimes." - Phaelax

Login to post a reply

Server time is: 2024-11-20 09:22:30
Your offset time is: 2024-11-20 09:22:30