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 / future request dim array[x,x] as bytes

Author
Message
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 17th Mar 2012 16:58 Edited at: 17th Mar 2012 17:00
it would be nice to allocate less memory if not needed. for example if i have a tile based game engine i only need to fill in byte data ranged 0-255

this will help me save on memory instead of allocating integer memory....

any thoughts?

if we cant get this then the use of memory blocks will work as well for what i need to do.


edit:
simple usage example would be a game like teraria...it would make no sence allocating more memory then needed

Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 18th Mar 2012 01:00
Also word and dword.

This was one of the requests in my feedback form.

It would be nice to have true boolean values but since DBPro didn't have these, it's unlikely.

And yes I appreciate there may be a performance hit, but I'm getting that now splitting integers into bytes for each operation. Especially since the binary functions seem slow in AGK.

I don't mind sacrificing a little speed to get more efficient storage.
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 18th Mar 2012 02:23
why would there be a performance hit from allocating less memory in a dim?

if anything i would have thought it would be faster...hummm.

even if they can make the memblock commands we should be good to use as many bytes as we need.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 18th Mar 2012 11:18
Have you thought of doing it as a string? I assume, since AppGameKit is not Unicode, that the size of char is one byte.

-- Jim
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 18th Mar 2012 11:32


Why not this?

Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 18th Mar 2012 11:47 Edited at: 18th Mar 2012 12:09
@SMD_3D Interactive

Back in the days of 8 bit processors, it would have been faster to use bytes as this was the base unit. Data was pulled from memory a byte at a time so if you wanted more than a byte it took more operations.

32 Bit systems throw data around in 32 bit lumps - its their base unit. If you only want a byte, it retrieves 4 of them and strips off the 3 you don't want.

Similarly, if you want to do maths on bytes, it converts them to 32 bits, does the work and then converts the result back*.

This is why integer maths in DBPro is so much faster than byte or word maths, it's working in it's natural base.

Sounds crazy I know, but then so did Moores Law, 30 years ago.

* some or all facts used here have been greatly simplified and may not reflect actually processor operation.

@JimHawkins

Strings are a good workaround, but AppGameKit currently only uses 127 bits for characters. I don't know what would happen if you tried to use the rest.

@kamac

In your example the variable "my_boolean_val" is still 32 bit.

With true boolean data types, you would could get 32 times as much in the same space. Of course you do have to use them in batches of 32 to get the full benefit.

Currently the work around is to mask unchecked bits.

Something like this might be used to handle directions;

This stores all the permutations of 4 directions in just 4 bits (one bit per direction).

But even this way only 1/8th of the variable is being used.

EDIT: replies and clarity
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 18th Mar 2012 20:00
Thanks.....this actualy makes good sence.

So if i allocate an array(2048,256,3)

is this too much memory to be using holding tile map information?

Im trying to make a somewhat of a clone to teraria and this map size is a small fraction of what the real game uses.

Again it would be nicer if it was byte data so it didnt use as much memory but if our devices can handle it then i will do it.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 19th Mar 2012 01:15
Quote: "Strings are a good workaround, but AppGameKit currently only uses 127 bits for characters. I don't know what would happen if you tried to use the rest.
"


Chars are 8 bits. Currently it's the printing functions that won't go above 127.

-- Jim
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 1st Apr 2012 20:18
If you reach consensus on what would be a good add for AppGameKit, post your feature request here for prosperity: http://code.google.com/p/agk/issues/list

I drink tea, and in my spare time I write software.
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 6th Apr 2012 18:54 Edited at: 6th Apr 2012 18:54
sure! I think it would be good to have this ability or some sort of sending it 4 bytes to make into an integer and being able to call for those original 4 bytes with another command. Maby that would keep some speed intact.

but again mabey that string idea will work aswell

Login to post a reply

Server time is: 2024-11-23 07:14:46
Your offset time is: 2024-11-23 07:14:46