Quote:
Originally Posted by cbkbud
An in-game script to modify files?
You mean he like loaded PNG files as text & parsed them?
Damn, that's intense.
|
PNG format isn't all that difficult to mess around with. The PNG file format is stored like so:
file_header
color_table
image_map
File Closure character
The color table is formatted like so:
Redvalue Greenvalue Bluevalue alpha
FF FF FF FF <- This is white.
A standard 2x2 PNG black and white checkerboard image would look something like this:
(File header)
FF FF FF FF 00 00 00 FF
00 01 01 00
(EOF)
Of course, there are some values and formatting tricks I've forgotten, but I am sure I could open up a PNG file in a hex editor and figure it out in a matter of minutes. It's been a while since I've messed with the inner workings of PNGs, so not all of this may be 100% accurate.
In order to change an image file's colours, one would have to parse past the file header, go into the colour table, parse for the Ovalue, or the Old value, then replace it with the Nvalue, or the New value. You don't actually change the image_map table at all, and most PNGs have a larger image_map than color_table, so the amount of time to change out colours in negligible.
The color changing system is not actually what I want. I could make that on my own if I did want it. Really, what I'm wondering, is whether or not I can modify map files on the fly while my server is running. I'm sure I'd have to do a combination of client-side and server side synched file editing, but I am most interested in the idea of making "instanced zones". Essentially, I want to make copies of maps for certain groups of players. I understand client-side maps do exist, and I plan to use them extensively for my playerworld, but I'd like to have the ability to have a map sort of like a clientside map, but where that player could invite another player along. If two groups enter the same map, there will be a copy for each group, essentially.
I'm certain with file reading/writing, I could do so, unfortunately, I'd have to find some way to execute commands through the RCon using the NPCServer. =/ I'm gonna find a way to do it, problem is, I don't really know much about the new RCon yet, so I'm not really sure just how to run a playerworld.
I've been playing with my RCon for the last few minutes, and it seems simple enough, right?