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.

Newcomers DBPro Corner / Basic of Memblocks ?

Author
Message
Tifu
20
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Scotland
Posted: 29th May 2005 01:14
I have no idea what they are... but I see people talking about them like they are important. I look in the codebase, and they seem complicated but do neat things D=

Basically, i'd like to know the basics of them, and to know wether they are something I ought to be looking into

Any kind of tutorial would be great, failing that, an explanation of some kind.

thinkdigital
20
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 30th May 2005 06:05
I don't know too much, but basically they are blocks of system memory that you use to store data. They can be used to send blocks of information around, especially in multiplayer games. They can also hold image, sound, and model data, which can be used to create some cool effects.

[b]eGeneric Works : Dark Basic Developer Website
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 30th May 2005 16:24
i'd also like memblocks explained to someone who's never used them

perhaps someone knows of a memblock tutorial they can link to?
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 2nd Jun 2005 12:38
memblocks are just what the name emplys:
A block of memory. Memory all by itself has no meaning.
So, you need to apply a "context" to it.

example:

make memblock from bitmap
make memblock from mesh

and so on.
now, the memblock has meaning ... or data
Next, you as programmer need to understand this data.
If the memblock is from a mesh, you can read the mesh
data (virtex positions) using the
memblock float(memblock,byte)
And even change them using the
write memblock float memblock,byte,float#
And when done,
CHANGE MESH FROM MEMBLOCK Mesh,Memblock


But, these are really great for internet use too.
Just create a blank memblock, place your data into it
however you want and send it using the internet commands.
Works great and its faster than strings.
The only problem with memblocks is keeping track of data
assignments (which memory location does what) and remembering
that each type of data (integers,bytes,floats) have different
memory requirements (2 bytes, 1 byte, 4 bytes).
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 2nd Jun 2005 13:00
waffle,

great explanation! Concise, to-the-point, accurate, and helpful.

~zen

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 2nd Jun 2005 13:22
Yeah great explaination. Just a little to add, hope it doesn't make it too confusing.

Integers have 4 bytes (you have to use write dword to read and write integers to and from a memblock). Basically you have

write and read byte = 1 byte
write and read word = 2 byte
write and read dword = 4 byte
write and read float = 4 byte

And remember that each byte of data is 1 position in the memblock. The positions numbers start at 0 and inc 1 by each byte of data. So if you had a memblock with 1 byte, 1 word, and 1 float (in that order) you would have to write them like this:



Tifu
20
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Scotland
Posted: 3rd Jun 2005 08:22
Ahr, many thanks for the explanations guys.
Sounds like something i'd need to practice at quite a bit, for another day I guess

Login to post a reply

Server time is: 2024-09-23 21:22:19
Your offset time is: 2024-09-23 21:22:19