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.

AppGameKit Classic Chat / drawing to memblock, odd outcome

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th May 2013 06:10 Edited at: 14th May 2013 07:11
When you create a memblock, does each byte not initialize at 0? Unless I set all bytes in the memblock when creating an image, I'll get weird random artifacts in the image which appear different every compile.


Here's an example with another snippet I'm working on. Is it just me or does those random artifacts look like letters?



"You're all wrong. You're all idiots." ~Fluffy Rabbit

Attachments

Login to view attachments
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 14th May 2013 10:20
It could just be old memory but organised - like a typed array for example, leftover from another program that didn't tidy up after itself.

Is that actual RGBA data, or binary? - or is that what you get from the start when you make a memblock?

I never noticed this, but it might just be the way I'm constructing memblocks - tend to render every pixel so I'm probably overwriting the crazyness. It is good to see memblocks in AppGameKit, even if creating the image isn't blindingly fast - we can allow for that and still make Worms and Lemmings style games with it.

I got a fever, and the only prescription, is more memes.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th May 2013 12:08
The red/orange gradient and the white characters are part of the same image I made in a memblock. Only I only specified the colored part, the rest should've been empty.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 14th May 2013 12:20
Kinda reminds me of my hacking on the Atari ST - I'd load up a game that I wanted to nab sprites from, soft reset the ST then view the memory as an image, or basically just move the screen pointer. If I found something, I'd adjust it byte by byte to hopefully get the correct palette and alignment and nab the image. It was pretty fun to go delving like that, especially when you hit the jackpot and found a nicely laid out tile set or sprite sheet with the correct palette. I always liked the graphics in Bitmap Bros games, often I'd go delving just so I could see the pixel work up close. Even did this with soundtracker files and wave files - anything I could identify and extract was fair game .

I would be tempted to display some of it as text, out of curiosity more than anything - it might be a slight concern if that's live data - I'm guessing it's just messy but free ram. To be sure, maybe fill an array with random bytes repeatedly, then you should see it change if it's live ram. Although, if I could make a type for RGBA, and have an array act as a memblock at the same time, well that might be pretty handy.

I got a fever, and the only prescription, is more memes.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th May 2013 14:34
It's the Matrix!!!


this.mess = abs(sin(times#))
tornado
18
Years of Service
User Offline
Joined: 21st Jul 2005
Location:
Posted: 14th May 2013 15:10 Edited at: 14th May 2013 15:14
True, memblock is an allocated part of memory, and memory bytes in allocated area are not always 0;
Also this info may be of help http://forum.thegamecreators.com/?m=forum_view&t=192789&b=1
and http://www.binarymodular.com/main/articles.php?article_id=77
Cheers,
K

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 14th May 2013 16:05
some allocating mem functions have a ZEROINIT flag.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th May 2013 17:02
Thanks tornado, but I already know how memblocks work. I was one of the earliest people to use them in DBP, creating everything from images to sound to terrain objects (as Van also did) With DB, I'm pretty certain each byte was 0 unless otherwise manually written which is why I thought AppGameKit would do the same. In C or Java, I would never expect any value in a new variable that I didn't explicitly set.

It almost looks like a font sheet, perhaps agk's default font?

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th May 2013 02:56
AGK does not set any of the memory allocated to a memblock. Assuming you write to the locations you want to use this gives a slight performance increase over zeroing the memblock before you write to it. But it does mean that the memblock contains whatever happened to be at that location in RAM at some point in the past.

Login to post a reply

Server time is: 2024-05-06 13:41:28
Your offset time is: 2024-05-06 13:41:28