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 / AGK Encrypted Asset Support

Author
Message
Alien Menace
AGK Developer
16
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 21st Dec 2020 05:50
It just struck me as funny that people have been asking for Asset encryption to be added to AppGameKit for (many) years and TGC has just never added it. It just struck me as ironic when I read the EULA for the TGC store assets...

"The Customer will take all reasonable steps to protect the Asset in distributed media, where possible encrypting the asset to prevent unauthorised access."

Wow, just wow. I couldn't help but think... How about you guys take just one reasonable step to help us secure your assets? I just thought it was a little ironic.
I love my Altair 8800 Replica.

http://altairclone.com/
fubarpk
Retired Moderator
16
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 21st Dec 2020 10:02
true but the number of threads that include full source already for enrypting assets with agk is mind boggling

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
adambiser
AGK Developer
5
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 21st Dec 2020 15:35
Loktofeit
User Banned
Posted: 21st Dec 2020 15:52 Edited at: 21st Dec 2020 15:54
@Alien, when it's their assets (ex: Particle Editor, GameGuru) they seem to be able to find ways to obfuscate or encrypt it. For us, not so much.


"the number of threads that include full source already for encrypting assets with agk is mind boggling"

@fubarpk I'm interested in the ones you feel are feasible for the sake of protecting or limiting access to assets.
Alien Menace
AGK Developer
16
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 21st Dec 2020 21:14
I was thinking that maybe... just maybe with all these COVID lockdowns that perhaps there would finally be time to focus a little on adding some professional features like this to AGK. Of course, it didn't happen. Instead, just a few bug fixes over the last several months. What in the heck do these folks do all day? Good grief.
I love my Altair 8800 Replica.

http://altairclone.com/
Polaraul
AGK Developer
6
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 22nd Dec 2020 03:46
The ability to encrypt assets has been requested as far back as 2011, and has been asked for many times. In a 2017 thread on the Steam forums Rick stated that, regarding asset protection, "it is something that we have on a future list of features."

My personal feeling is that, like so many other needed and requested features, this will never be added.
EdzUp
18
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Citadel Cyberspace
Posted: 22nd Dec 2020 04:19
I would like multi file zips feature to be added natively so we can zip up and password protect assets this way.
-EdzUp
Patreon: https://www.patreon.com/EdzUp
jd_zoo
2
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 24th Dec 2020 19:47
I'm using password protected ZIP files for some basic protection, sorting assets into zips like you might into proper folders (its cleaned up my media directory lol...) I recently came up against limitation that OGG files need to be available or can crash if you clear out the extract folder after loading the music.
Conjured Entertainment
AGK Developer
15
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 25th Dec 2020 01:54 Edited at: 25th Dec 2020 02:39
Quote: "all reasonable steps"

any definition of "reasonable" is subjective

If they are not worried about adding it, then it should be "reasonable" for me not to worry about it, right?

And then, there is the "all " part of that phrase... how many different reasonable steps to encrypting data are there? and we have to take all of them???
wow!!!
if that's their idea of reasonable, then we may be in trouble., because wouldn't you still need to add you own even if AppGameKit had something, since you have to take ALL reasonable steps?
So, what's the big deal about this being added anyway, because wouldn't it be just one more thing to add on the countless ways out there already to protect media?
I mean, if we already have to take ALL of those steps, then do we really want another one or more to take?



The media is something separate from AppGameKit, because they are outside, and sometimes 3rd party, items.

That stuff can be many formats handled various ways by differing platforms, which adds to the complexities of building something in to handle it all.

I agree with the idea that updates and upgrades to AppGameKit should be for AppGameKit and the commands for coding, and that spending time on protecting third party assets should be on a back burner.

I make most of my own stuff, but I will be using some 2d media for GQ, and I plan to just encrypt that myself by separating the PNG data into separate files for reconstructing via memblocks.

Other data could be done the same way if converted to numerical representation, and if kept in <255 values then converted to images and back , etc.

In other words.. scramble the data in an image constructed from it, which will look like noise as an image, but can have the value read for data reassembly, if that makes sense.

It is more secure for everyone if each person uses a different method, so ... I have no problem with asset encryption being the responsibility of the game developer(s) who are choosing said assets, rather than being the responsibility of the AppGameKit team.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Loktofeit
User Banned
Posted: 25th Dec 2020 04:11 Edited at: 26th Dec 2020 15:56
"The media is something separate from AppGameKit, because they are outside, and sometimes 3rd party, items.

That stuff can be many formats handled various ways by differing platforms, which adds to the complexities of building something in to handle it all."


If DarkBasic didn't already have this feature for me 20 years ago, I might agree with you. However, standalone EXEs, resource files, and "pak" files have been pretty standard fare for decades. TGC did it for DBPro. It's a standard part of APKs. I don't get the reason for TGC to not add the functionality to AGK2/S other than it being not important to them.
smerf
16
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 26th Dec 2020 21:40
I do believe there are several encryption tools already built for agk I think one comes with shaders from Janbo. TGC may never add encryption because they tend to stay away from things that leave the partially liable for anything.

Kevin Picone
18
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 27th Dec 2020 13:04

Loktofeit,

Quote: "If DarkBasic didn't already have this feature for me 20 years ago"


In DBclassic the support is more file bundling, rather than protection. Since files attached into the EXE are extracted to the temp folder naked upon execution.

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
Loktofeit
User Banned
Posted: 27th Dec 2020 16:53
"In DBclassic the support is more file bundling..."

...which is still some level of protection, as the majority of users won't be hunting down and fishing through temp files.

It would come in handy especially for data since in-line data is, at best, awkward to do since AppGameKit doesn't support READ/DATA like Dark, GW, Pure, True , Visual, Play, Liberty, and all the other BASICs do.

Polaraul
AGK Developer
6
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 27th Dec 2020 23:31
The ability to read a file from a password protected zip, direct into memory, would go someway to help. At this stage though in the lifecycle of AGK2, I think wishing for new features such as this is all academic.
nz0
AGK Developer
13
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 30th Dec 2020 21:26
I was recently thinking about adding some kind of encryption to my WadPacker system, but seeing as I hadn't released anything since I originally made it, it was never much of a pressing issue
I could make something using commercial grade encryption on the PC platform using the plugin system, but then no good for other platforms.

It's already a very good way to bundle multiple assets into a single file. If I put a scramble key option into the tool, then each user could set their own keys and would probably be enough to deter casual theft of assets.

adambiser
AGK Developer
5
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 31st Dec 2020 02:21
@nz0: WadPacker does about as much as possible with AGK's current capabilities. Having to extract everything to a temp file every time the app starts isn't great, but AppGameKit doesn't have much "load from memblock" capabilities except for images and sounds, and those have to be in AGK's own format and not raw file data.
Conjured Entertainment
AGK Developer
15
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 31st Dec 2020 02:32 Edited at: 31st Dec 2020 03:00
Quote: " but AppGameKit doesn't have much "load from memblock" capabilities except for images and sounds, "

https://www.appgamekit.com/documentation/Reference/Memblock.htm

You can create sounds, images, meshes, and files with Memblocks.

( ... procedurally generate the memblocks and infinity is yours.. )

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
adambiser
AGK Developer
5
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 31st Dec 2020 04:18 Edited at: 31st Dec 2020 04:19
@Conjured Entertainment: Right, I forgot about basic meshes and raw byte data files. Still not a lot and they have to be in AGK's memblock format.

What about...?
- Subimage information (ie: subimages.txt)
- 3d objects with animation
- Spine skeletons
- Spriter skeletons
- Fonts
- Music
- Video
nz0
AGK Developer
13
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 31st Dec 2020 13:27
The main issues are streaming formats which have to be left on the media - video, music etc.
My current project has about 130mb of assets and adds about 1 sec to start-up time as a WAD.

With some encryption, would deter all but the most determined thieves?

Scraggle
Moderator
17
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 31st Dec 2020 14:01
This thread sparked my interest.
So, I created an encryption method for image files which also uses compression and interestingly, in many cases, I can compress an image further than running it through tinypng.
However, it is only useful for single images. The way AppGameKit uses atlas textures and bitmap fonts means it simply won't work with them. The subimages.txt file needs to be linked to an image file on disc with the same name. It doesn't work with an encrypted data format.

I haven't looked at 3D formats or audio yet but there will be issues. OggVorbis for example; the way AppGameKit loads an OGG file means that the file has to be in its original unencrypted format in order for it to load. Ruling out the possibility of encrypting OGG files before I even start.
Santman
9
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 31st Dec 2020 14:57 Edited at: 31st Dec 2020 14:58
For memblocks you can store anything you want, if you do it right. You can sure variables, strings, pretty much anything really. Encrypting them is a different matter however.

If you want to be REALLY clever, store multiple small images inside a single memblock.
nz0
AGK Developer
13
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 31st Dec 2020 15:58
Quote: "I haven't looked at 3D formats or audio yet but there will be issues. OggVorbis for example; the way AppGameKit loads an OGG file means that the file has to be in its original unencrypted format in order for it to load. Ruling out the possibility of encrypting OGG files before I even start.
"


The work I did on the XM player and sound stitching in general means that it would technically be possible to chunk up an OGG file, encrypt the chunks and spoon feed them out through the decryptor to reload/buffer back in.
I reckon I'd need to use 2 separate control players with precision timers, but it seems almost too much trouble
adambiser
AGK Developer
5
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 31st Dec 2020 17:13
@nz0: Looking at AGK's Spriter example, with WadPacker, is there a way to extract the 70 images used by the scon file and keep them available until the skeleton is loaded, deleting them afterward?
Santman
9
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 31st Dec 2020 20:21
I'll refer to a good quote from an indie dev during a discussion about piracy; I wish I created a project popular enough for people to.bother trying to steal my assets! Lol.
Scraggle
Moderator
17
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 31st Dec 2020 20:56
Quote: "I wish I created a project popular enough for people to.bother trying to steal my assets"

I wish I was artistic enough not to have to use licensed assets
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 31st Dec 2020 21:22
Quote: "The subimages.txt file needs to be linked to an image file on disc with the same name. It doesn't work with an encrypted data format."

Doesn't LoadSubImage() use an image ID?
Scraggle
Moderator
17
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 31st Dec 2020 23:36
Quote: "Doesn't LoadSubImage() use an image ID?"

If all it needed was an image ID then how would it know which subimages.txt file to load?
The subimages.txtfile is loaded when an image with the same filename is loaded. If you create an image from memblock data there is no way to associate a subimages.txtfile with it
nz0
AGK Developer
13
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 1st Jan 2021 01:48 Edited at: 1st Jan 2021 02:14
@adambiser: "Looking at AGK's Spriter example, with WadPacker, is there a way to extract the 70 images used by the scon file and keep them available until the skeleton is loaded, deleting them afterward?"

I did add some support for Wad_LoadSkeleton() at 0.3



[edit] Oh yea, this was a Spine loader, not a spriter loader.
I could add a function for spriter loading if someone wanted it, but no-one asked for it

The way Wadpacker works is creating a "packet" of additional files (like subimages.txt) which may be required at load time for each asset sub-collection.
After looking at how the spine loader works, it relies on the XML to get the images, rather than an atlas image which the spriter loader uses.

I guess there could be 2 pack options in the packer tool:

1. package the spriter image files discretely with the .scon file (exclusive use for the spriter instance)
2. have the images added to the WAD as discrete images if they are needed to be used elsewhere - although this would add a small amount to the load time
fubarpk
Retired Moderator
16
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 1st Jan 2021 01:51
water marking an image down bottom of page
https://forum.thegamecreators.com/thread/222027
a object encrypter
https://forum.thegamecreators.com/thread/222027?page=2

theres other threads that discuss encryption and even the code base is full of examples

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Jan 2021 03:06
Quote: "If all it needed was an image ID then how would it know which subimages.txt file to load?"

Can't you save this information when you pack it?
Scraggle
Moderator
17
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 1st Jan 2021 10:17 Edited at: 1st Jan 2021 10:21
Quote: "Can't you save this information when you pack it?"

In some circumstances, maybe but it's far from ideal.

I'll explain the problems I've encountered below but if you (or anyone else) knows a workaround I would very much welcome it. I would love to be proved wrong on this!

subimages.txt files are used in two ways:
1) Atlas Textures
2) Bitmap font files

For atlas textures the subimages.txt file defines the individual images within the texture. As you point out, I could store that information on packing and then extract the individual images when loading. That would work fine but negates the main reason for using an atlas texture, which is to utilise a single draw call for all images within it. You can't keep the atlas texture as a single image and divide it up using LoadSubImage() because then you suffer the same problem as the bitmap font (described below).

Bitmap font files are an entirely different problem. When you call SetTextFontImage() AppGameKit will look for and load a subimages.txt with the same name as the image that represents the font. If that file is a data loaded into a memblock then no such image exists and the subimages.txt file can't be loaded and the font fails.

Please prove me wrong. The ability to encrypt files that rely on subimages.txt files and retain the inherent usefulness of the subimages.txt file would be very helpful!
MadBit
Valued Member
Gold Codemaster
11
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 1st Jan 2021 14:40
Hello,

I have been following this thread very closely for some time.
For about a week now, I have been working on an idea that I had about a year ago. But somehow I didn't have the time or the desire to do it.

But now it is almost finished.

I'll try to explain what I have in mind.

I have added a new command ...
AssignZip(zipfile[, password])

After this or more command(s) have been executed. This zip file(s) will be added to the search path of Agk.
This means that if an image or other file is to be loaded and it is not found in the conventional paths, the file is searched for in these ZIP file(s).
If the file exists, it is loaded directly from the ZIP file. This is done without first unpacking the file on the hard disk.

This works excellently at the moment. At least in the tests I have carried out so far.

The only thing that doesn't work at the moment is streaming music from an encrypted file. It works fine as long as it's a zipped file.
But as soon as it is password protected, it no longer works.

I know that sounds too fantastic. That's why I have uploaded my test app in the attachment.

The code looks like this.


Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
nz0
AGK Developer
13
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 1st Jan 2021 17:43
@scraggle:
Please prove me wrong. The ability to encrypt files that rely on subimages.txt files and retain the inherent usefulness of the subimages.txt file would be very helpful!

I have developed a workable system using WAD loaded images, including subimages.
During the initial loading of the image, the subimages.txt (if it exists) is loaded and remains resident, so you can refer to the sub image name, even after deleting the image and the subimages.txt file.

I actually load all my images (image ID and name) into a typed, indexed array and have functions to look them up.

For instance, when I call this, the FindImageID function returns the loaded image ID, even though the original files don't exist anymore.


An additional benefit here is not having to set properties on various images (wrapping, MIP settings etc.) I have wrapped images in one folder and non-wrapped in another. NoMIP images just have the string "NoMIP" in the name and the loader deals with it.

nz0
AGK Developer
13
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 1st Jan 2021 17:52
@madbit:

Quote: "After this or more command(s) have been executed. This zip file(s) will be added to the search path of Agk.
This means that if an image or other file is to be loaded and it is not found in the conventional paths, the file is searched for in these ZIP file(s).
"


This would still be a problem for subimages.txt and atlas, as these are loaded by AppGameKit and are required to be present with the image file at load time.

Quote: "If the file exists, it is loaded directly from the ZIP file. This is done without first unpacking the file on the hard disk.
"


How are you extracting/loading a specific file from a zip archive without it going to disk first?

MadBit
Valued Member
Gold Codemaster
11
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 1st Jan 2021 19:24
Quote: "This would still be a problem for subimages.txt and atlas, as these are loaded by AppGameKit and are required to be present with the image file at load time."

As the demo shows, a bitmap font is loaded that also loads the subimages. So this is not a problem. Since the file handling is handled internally in the same way.

Quote: "How are you extracting/loading a specific file from a zip archive without it going to disk first?"

The changes I have made go deep into the core of the reading function in the AppGameKit engine. So that all read operators are routed through the same interface.
Therefore, they can also be accessed directly in Archiev via OpenForRead. Most of the functions used to load assets use exactly this interface.
Only the loading of JPG's was problematic there I had to write an additional internal function that creates an image from the memory.
Such a function was available for PNGs, but not for JPGs.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Bengismo
3
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 1st Jan 2021 21:07 Edited at: 1st Jan 2021 21:12
I did the same thing madbit where loading from a password protected zip was seamless and all the standard load commands worked fine and could be redirected to a zip file really easily. Resources would load from the zip file and were never extracted to disk - just direct to memory. This worked for almost all the resources (videos and music are a bigger problem though)

There is a function for loading JPG's from memory - you simply have to replace the jpg loader function.

I then recompiled teir 1 so it worked in that too rather then forcing the use of teir 2. I put a demo of it in the showcase section ages ago. Basically it allowed any resource to be loaded directly from a password protected zip.

I'm amazed TGC havent added this functionality as it wasnt that hard to add but i only bothered testing it on 2 platforms.
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 1st Jan 2021 21:22 Edited at: 1st Jan 2021 21:36
Quote: "I put a demo of it in the showcase section"

https://forum.thegamecreators.com/thread/226551

i know that TGC was aware of the thread/solution but, as mentioned above, they are reluctant to pursue the topic for some reason.

ie, we're on our own. so, anything that anyone can offer us tier 1 users is much appreciated.

add: with that, would it be fair to say that the simplest method that would allow us to comply with general media protection for smaller projects would be save/load memblocks? or, would passworded zip files be more effective? ie, can we agree on a "go to" for basic media protection?
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
MadBit
Valued Member
Gold Codemaster
11
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 1st Jan 2021 22:04
@Bengismo:
I must have missed that. It's exactly the same as what I did.

Maybe you should actually upload your version to github.
Then TGC could decide whether to integrate it or not.

Obviously, the request to have such functionality arises at regular intervals.

With my version, I don't know what else I would have to change to make it available to Tier 1.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Conjured Entertainment
AGK Developer
15
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 3rd Jan 2021 00:47 Edited at: 3rd Jan 2021 01:21
Quote: "add: with that, would it be fair to say that the simplest method that would allow us to comply with general media protection for smaller projects would be save/load memblocks? or, would passworded zip files be more effective? ie, can we agree on a "go to" for basic media protection?"


The password protected ZIP would be the easiest way to go for sure.

So, if that method is acceptable by the TGC store...


Quote: " If you create an image from memblock data there is no way to associate a subimages.txtfile with it"


Couldn't you just number them sequentially since you are in charge of the order?

keep the renumbered xxx subimages.txt created on encryption

match back to right images on decryption sequentially



Quote: "I have developed a workable system using WAD loaded images, including subimages.
During the initial loading of the image, the subimages.txt (if it exists) is loaded and remains resident, so you can refer to the sub image name, even after deleting the image and the subimages.txt file.

I actually load all my images (image ID and name) into a typed, indexed array and have functions to look them up.

For instance, when I call this, the FindImageID function returns the loaded image ID, even though the original files don't exist anymore.

...

An additional benefit here is not having to set properties on various images (wrapping, MIP settings etc.) I have wrapped images in one folder and non-wrapped in another. NoMIP images just have the string "NoMIP" in the name and the loader deals with it."

Clever

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
nz0
AGK Developer
13
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 5th Jan 2021 00:38
Quote: "Couldn't you just number them sequentially since you are in charge of the order?
keep the renumbered xxx subimages.txt created on encryption
"


The subimages.txt is loaded by AppGameKit at the time of loading the associated image to facilitate subimage references.

Nothing to stop you loading or maintaining your own subimages details, but you do away with the performance benefits of referencing a single image with an offset window, thus any speed benefits internally for referencing the atlas image.

Part of the design of WadPacker was to allow the native functions of AppGameKit to still work without hindrance, which meant having certain files present on disk at the required time. I've stopped short at certain further functionality in Wadpacker which would mean Windows only capability (DLL plugin).

I still think that if I added encryption to WadLoader, that would still be the best (with what we have to work with) approach if it is to be cross platform compliant.
Perhaps if I added encryption to WadPacker, we could see if anyone could "hack" the resources? Anyway, as many have said, there's no way to fully protect, as there's always ways to intercept the graphics card calls or simply grab stuff off screen.
It's about deterring the casual hacker and the convenience of packaging.
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 27th Jan 2021 23:55 Edited at: 28th Jan 2021 00:16
This is a function that will dynamically load an image from a sheet using a subimages.txt file.
All responsibility to the programmer.

adambiser
AGK Developer
5
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 28th Jan 2021 07:01
@blink0k: Yes, something like that is doable, but:
- CopyImage would use more memory, especially if the new images are NPOT. SubImages share the same parent image and would probably perform better as well.
- Font images require subimages.txt to get the character positions. (From what I remember.)
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Jan 2021 07:47
Sure. I Agree, but as an alternative to nothing at all it does the job.
Under these cirumstances, where there is no "built-in" solution, comprimises almost always need to be made.
Scraggle
Moderator
17
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Jan 2021 09:01
I have spoken with Rick who in turn spoke to Paul and said there may be fix on its way for this.
My question to Rick was:
Quote: "When you load an image to use as an atlas texture (or bitmap font) then AppGameKit looks for a subimages.txt file with the same filename as the image. That clearly won't exist if I haven't loaded an image but instead loaded data into a memblock and then created the image.

In order for it to work there would need to be a new command in AppGameKit that links an image in memory to a subimages.txt file on disc.

Is that something that could be implemented?"

And the reply:
Quote: "Paul replied back to me on this and said "It's possible we could add a command that loads the subimages file separately, or from a memblock"

I will add it into the list for Paul and hopefully it can make it into a build in the near future."


So there me be a fix coming at some point in the future but when that will be is anyones guess
DavidAGK
AGK Developer
7
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 28th Jan 2021 10:57
I'm talking to Rick/Paul about this at the moment too as I need a solution for my game (7 years in the making!) and willing to help pay for the development. I was suggesting a new command to enable encryption of files (images, sounds etc) and then a set of instructions like LoadEncryptedImage(), LoadEncryptedSound() etc and for text files WriteEncryptedLine() and ReadEncryptedLine() which would enable easy, interchangeable and transparent use (ie the encrypt versions of the commands behave exactly like their regular counterparts - returning IDs, enabling use of subimages etc). I highlighted the subimages issue but forgot about the font image commands, so I can add to the request.

I'm super keen to get this sorted for AGK. I know there are some issues related to encryption with iOS app stores so cross platform support is likely to be more difficult but I'd like to try and kick things off so...

So... Would anyone else be willing to stump up a bit of cash to get encryption stuff sorted?

If so PM me with the sum you'd be happy to put forward and whether a PC only solution would be acceptable to you or whether you'd need cross platform support and I'll collate and report back to Rick/Paul.

AQUILLANTO - A side-scrolling platformer with super tight controls, 3 worlds to explore, hordes of monsters and a quest... Inspired by games on the Amiga computer

FOLLOW ON TWITTER
SEE THE YOUTUBE CHANNEL

Polaraul
AGK Developer
6
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 28th Jan 2021 18:34
DavidAGK wrote: ". I was suggesting a new command to enable encryption of files (images, sounds etc) and then a set of instructions like LoadEncryptedImage(), LoadEncryptedSound()"


The ability to mount password protected zips as part of the file system would mean that you wouldn't have to use commands outside of those already present. I have used this technique in both BlitzMax and Node.js, it does a good job of ensuring that I comply with the terms of use of third party assets.
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Jan 2021 23:53
That file system is a good idea. However i think a prefix like "raw:" (Maybe "zip:") might suit AppGameKit better
adambiser
AGK Developer
5
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 29th Jan 2021 00:00
I also like the idea of mounting/unmounting zips.

I think a prefix would complicate our code though. To switch between using zipped and un-zipped files, the prefix would need to be added and removed from all of the calls.
If mounted zips are automatically checked, just don't mount the zip to test the raw files.
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 29th Jan 2021 04:03
I like the idea of mounting/unmounting zips too but how would you refer to them?
It makes sense on windows but how would that relate to android/iphone etc?
adambiser
AGK Developer
5
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 29th Jan 2021 04:16
Why would files in the mounted zips need to be referred to any differently? I think the file search order goes: 1) write folder, 2) read folder. What if searching mounted ZIPs (in the order mounted) for a matching file name was done before searching the write and read folders?
I haven't tried the existing ZIP commands on Android or iPhone, but I hope these would work similarly.

Login to post a reply

Server time is: 2021-04-11 00:00:34
Your offset time is: 2021-04-11 00:00:34