Ancient Warfare 2

Ancient Warfare 2

6M Downloads

Feature request - Image saving / displaying the for the template system

TechStack opened this issue ยท 7 comments

commented

Can a feature be added to the template system that will allow it to display an image of how the structure will look if it were to be built.

This would help new players to know what a the end result will look like if they were to put the resources into building the structure when playing on a server.
Currently the only way they could know what it will build (other than the short file name) is to just "try it" and see what the end result will be.

This feature could be a simple as loading an image with the same file name as the template only with a .png image ( I know the image would need to be pushed to the client :( )

as for getting the image it could be done one of two ways.
1 Ask the player to take a screen shot and manually move it to the template folder with the proper name.
or
2. Have the structure scanner save the screen shot with an additional step (right / left click) once the structure is scanned.

Just an idea :)

commented

I understand completely that its a pain and you are correct i was pointing some of the pain points out already.

Just thought i'd toss it out as an idea because it would aid in usability.

Not trying to push for it just more brainstorming.

Instead of adding pushing the images on connect how about pushing it to the client when the user selects a Template or goes to a specific GUI screen for the image.

  • using this method would not introduce lag when users connect and it would only add to the bandwidth usage when it was actually being used.
  • This is similar to how a vanilla map works. it sends the pixels over the network when the user looks at a new map.

-how to handle missing images ? fail gracefully meaning do not display anything or display text image not found.

I agree a smaller sized image could be used. and was actually part of the reason i suggested having the scanner save the image for the player so they cant control the image size.

Finally as an alternative what if the template had a field we could store a URL.
Then in the GUI it had a button that would launch the URL similar to clicking links in chat messages.
This way we put the images on a normal web-server for hosting.

It would be up to the user to edit the .AWS file to add the URL or possibly add a URL field to the Save GUI.

I completely understand if its all to much considering the other work involved in just updating to 1.7

Just trying to help fill the need of the users being able to see what they are investing in :)

commented

Not likely to implement this.

While it is a good idea, I'm thinking it will be a royal PITA to implement.

I'll think on it a bit, but off the top of my head there are multiple problems to solve (most you had pointed out/hinted at):
--where to specify the image name? (could probably use template name + .png)
--synching to clients, potentially a -lot- of images to download from server. could cause bandwidth problems, as they would have to be re-sent on every login. (alternatively, could implement a 'smart' caching system to only send/download new/changed images, but that is a ton more work)
--how to validate images and enforce a set image size? Would have to enforce small images, such as 320x240 or similar. Could possibly use different sized images with dynamic rescaling in the GUI, but then it leads to an even worse bandwidth issue with the larger images.
--dynamic resource loading, e.g. loading images on server connect instead of during init -- haven't tried this...may or may not be doable. (it should be doable, as MC downloads skins on the fly from the skins-server)
--where to display these images? there is not alot of room to display an image that would take up half the screen.
--how to handle missing images?
--would greatly increase the lag-time when connecting to a new server / one where you needed ALL of the images, as the login must hang/wait until images are downloaded completely.
--how to handle conflicting / duplicate image names from different servers? (different templates with the same name on different servers). This is only a problem if images are cached and not downloaded at every connect. Could possibly store images on a per-server basis.

commented

Excellent work !

Using this Method could a server admin that sends out a Modpack Pre-cache the images on the client by including the images in the cache?

The MD5 check-sum sounds like a good idea.

  • I assume the check-sum would change if the server op were to update the image to a new one. Causing the image to re-download to the client on the next connection.

I think a max size of 2MB is fine we wouldn't want to send images bigger than that anyway especially if the server has 100 templates for example. ( again another good reason for a pre-cache in the modpack)

What image format are you using ? I know from experience that PNG is one of the best for good compression & no image quality loss

I think a standard size is desirable and understandable.It would also help enforce the file size limit. Maybe a bit bigger than 320*240 but small file size is desirable.

-- No back-port to 1.6 I'm OK with that ....it's why I posted this on the AW2 (1.7) version :)

While we are talking about templates any way to allow a server op to remove a bad scan from the list without re-starting the server? I've had to delete some "bad" scans from the server before and noticed the template list did not update and still showed them as valid options. I was afraid someone would try to build a template that had been removed causing a crash so I've always restarted the server to avoid issues when removing templates.
No need to change anything just a question.

commented

I took a bit of a look at this today... well.. I have a test-implementation setup and working so far. It is ugly, and will need to be cleaned up, but it is enough to test the concept.

  1. Client loads any images present in its config/structures folder. Matching template/image sets on client-server will require no image transfers.
  2. When client connects, it receives a list of template image names from server. Client returns a list of images needed from the server, after checking already loaded images, and images in the image-cache. Client proceeds to login as normal, with no/little pause (only pauses to check for files, does not wait to receive them)
  3. Server sends needed images to client one at a time. As client receives images, they are loaded into an image-cache folder.
  4. When viewing structure selection, if an image is present for the selected template name, display it, else display nothing

A few problems I have not sorted out yet:
--no handling of duplicate template/image names for different template/image sets (could possibly send name/md5 pair for image-list)
--max image size is ~2mb, as that is the largest the packet-system can handle. however, I'm currently limiting sizes to 320*240, so that shouldn't be too much of an issue. Could probably use larger images (so they look decent in the GUI), as long as they are all the same set size, and below 2mb.
--currently no way to load different sized images, all must be the same dimensions (will need to set a standard image size)
--no placeholder image yet
--no way to back-port to 1.6, as the max packet size is 32k, and would be unable to send even medium-sized images.

Still looking at this a little bit...but it looks like it might work out.

Any other thoughts/ideas?

commented

"Using this Method could a server admin that sends out a Modpack Pre-cache the images on the client by including the images in the cache?"

Yes -- as long as the contents of the AWConfig/structures folder match, no images will be downloaded, and the cache would be un-needed. (It examines templates/images prior to cache) Otherwise, yes, the admin could send a pack of the image cache for the user to load into their cache folder.

Yea, if I went with the MD5 check, it would allow the server to re-send any images that had updated server-side.

Yes, currently using PNG -- has some of the best compression for non-photo based images (e.g. computer graphics).

"While we are talking about templates any way to allow a server op to remove a bad scan from the list without re-starting the server? I've had to delete some "bad" scans from the server before and noticed the template list did not update and still showed them as valid options. I was afraid someone would try to build a template that had been removed causing a crash so I've always restarted the server to avoid issues when removing templates."

Possible, but not the easiest. Would require at least more network code to inform clients that a template had been removed. I'll think about it/look into it -- might just do a chat command to remove templates, as I think an item/GUI is probably overkill for such a simple function.

commented

This is the 1.7 structure-selection GUI so far:
test2

(I'll probably use the same/similar GUI anytime structures are selected, the SS is from the creative instant-builder, but would be easy to hook it in for the drafting station selection GUI as well)

Moved up to 512*288 for image size -- pretty direct scale down from the standard 16:9, and pretty direct scale from the default MC window size.

Adding the preview area removed some of the selection scroll-box area....but meh...that is why there is a text-input box..so you don't have to scroll :)

Just got the layout re-sorted out...now off to figure out the rest of the issues.

commented

Feature has been implemented, with md5 verification for cached images.