02-24-2016, 08:35 PM
I have a mild curiosity.
The html5 gamedev stuff I'm working on in my free time uses an asset library that is link-based.
I have done this for a few reasons.
For one, i am porting, or attempting to port, a few flash games, one of which heavily uses the actionscript linkage of its assets.
For two, i want something dynamic. Instead of modifyng my main code every time I add an asset, and a reference to it, I want to simply modify my data files, and the asset libraries, themselves. I also want to have an easy way to free assets wen no longer needed. For example , using a method of my AssetManager object like clearAssetGroup("splashscreens"), would delete that entire section of the in-memory asset library, rather than me having to do something like
assets.splashLegal.remove();
assets.splashTechVideo.remove();
assets.splashDev.remove();
etc...
The same also could be applied to dynamically loading the resources on-demand.
Besides dynamically loading/removing assets, I want to dynamically pre-render those utilizing potentially cpu or gpu-intensive modifications/transforms, if possible. So, for example, if I need to use color matrix filters to make my white box pure red, I can store the color-transformed sprite so all I have to do is access the pixel data from memory, rather than re-apply the color matrix filter every frame.
Also, while I currently am utilizing html5, I might do this in other languages, too, maybe...
Basically, I'd rather do:
external script (i do not utilize these yet, but I might at some point):
OBJ PLAYER
EXTEND ENTITY
DEF SPR "Spr_Player"
DEF HP 10
DEF ISPLAYER true
DEF SPD 5
END
asset library entry:
type: sprite_img
offsets: x:0 y:0
dims: w:16 h:16
src: sprite_player.png
vs.
class Player extends Entity{
import lib.util.graphics.PNGLoader
import lib.util.graphics.Sprite
//etc
Boolean isPlayer = true;
Int hp = 10;
Float speed = 5;
Sprite spr = PNGLoader.loadPNG("sprite_player.png");
//then defining offsets and crap
}
Also, if for some reason I were to change anything about the player sprite, I do not have to re-compile my program (assuming it was a compiled language). This, depends of course, on how the asset library was structured. if it were a series of JSON files, folders, and .png images, fairly easy. If it were a .dll or a .zip, well, I might have to re-compile or re-pack the asset library.
Sorry if I'm less than clear.
Basically, I want something that's easy to extend and doesn't rely on too much hard-coded stuff.
Also, even if I made a closed-source game, I'd like to support some custom content.
If i used the linked assets and external data/scripts, I can give the end-user some pretty good customization options without exposing the heart of the game even slightly. This would be subject to the limitations of the game, itself, but done right, it still yields some nice customization.
What does everyone else think about this, though?
The html5 gamedev stuff I'm working on in my free time uses an asset library that is link-based.
I have done this for a few reasons.
For one, i am porting, or attempting to port, a few flash games, one of which heavily uses the actionscript linkage of its assets.
For two, i want something dynamic. Instead of modifyng my main code every time I add an asset, and a reference to it, I want to simply modify my data files, and the asset libraries, themselves. I also want to have an easy way to free assets wen no longer needed. For example , using a method of my AssetManager object like clearAssetGroup("splashscreens"), would delete that entire section of the in-memory asset library, rather than me having to do something like
assets.splashLegal.remove();
assets.splashTechVideo.remove();
assets.splashDev.remove();
etc...
The same also could be applied to dynamically loading the resources on-demand.
Besides dynamically loading/removing assets, I want to dynamically pre-render those utilizing potentially cpu or gpu-intensive modifications/transforms, if possible. So, for example, if I need to use color matrix filters to make my white box pure red, I can store the color-transformed sprite so all I have to do is access the pixel data from memory, rather than re-apply the color matrix filter every frame.
Also, while I currently am utilizing html5, I might do this in other languages, too, maybe...
Basically, I'd rather do:
external script (i do not utilize these yet, but I might at some point):
OBJ PLAYER
EXTEND ENTITY
DEF SPR "Spr_Player"
DEF HP 10
DEF ISPLAYER true
DEF SPD 5
END
asset library entry:
type: sprite_img
offsets: x:0 y:0
dims: w:16 h:16
src: sprite_player.png
vs.
class Player extends Entity{
import lib.util.graphics.PNGLoader
import lib.util.graphics.Sprite
//etc
Boolean isPlayer = true;
Int hp = 10;
Float speed = 5;
Sprite spr = PNGLoader.loadPNG("sprite_player.png");
//then defining offsets and crap
}
Also, if for some reason I were to change anything about the player sprite, I do not have to re-compile my program (assuming it was a compiled language). This, depends of course, on how the asset library was structured. if it were a series of JSON files, folders, and .png images, fairly easy. If it were a .dll or a .zip, well, I might have to re-compile or re-pack the asset library.
Sorry if I'm less than clear.
Basically, I want something that's easy to extend and doesn't rely on too much hard-coded stuff.
Also, even if I made a closed-source game, I'd like to support some custom content.
If i used the linked assets and external data/scripts, I can give the end-user some pretty good customization options without exposing the heart of the game even slightly. This would be subject to the limitations of the game, itself, but done right, it still yields some nice customization.
What does everyone else think about this, though?