PyTFall > PyTFall: Game design

<-- Archived --> (Image Tagger 0.3 released!)

<< < (2/6) > >>

Xela:

--- Quote from: rudistoned on August 04, 2013, 03:28:48 AM ---Maybe some of you wondered were I disappeared too? Well, I felt like working on my own projects, so I did. Over the last month, I rewrote Image Tagger and Pytherworld to get rid of design errors I made when I knew a lot less about the MVC design paradigm, event-driven applications and Qt. I went surprisingly well and fast.

--- End quote ---

Hi :)

Yeah, I am surprised as well on how well development progresses as we gain more and more experience.



--- Quote from: rudistoned on August 04, 2013, 03:28:48 AM ---2) The tags package
This package allows your application to retrieve tags stored as XMP metadata from JPEGs and PNGs. It has other things to offer too, just take a look at the docstrings of its classes (for example, open a python interpreter, import the tags package and type help(tags)).


Quick how to:
*)Add this code to your program

--- Code: ---import tags
tags.initialize(tagsdir=tagsdir)

--- End code ---
*) tagsdir is an absolute path to the tags package (the directory containing __init__.py and resload.py)
*) Use the following code to retrieve the XMP tags of an image file at abspath

--- Code: ---taglist = tags.readxmp(abspath)

--- End code ---
*) writexmp will only work if you have pyexiv2 installed; readxmp also works without pyexiv present;

--- End quote ---

Maybe you can write a script that takes care of loading tags info into JSON files when you have time? There s no rush on that front, we'll trully need tags when new systems will be added past 1.0 release of PyTFall.



--- Quote from: rudistoned on August 04, 2013, 03:28:48 AM ---3) Pytherworld
Pytherworld is a fangame for Otherworld, something of an reimagination of that game. It currently focuses on the slave training aspect, ignoring the brothel management aspect.
PyTFall could benefit by sharing code, concepts or ressources with Pytherworld. We can talk more about that when I share it's source code with you.

--- End quote ---

I have a very old version of pytherworld somewhere. Waiting for an upgrade :)



--- Quote from: rudistoned on August 04, 2013, 03:28:48 AM ---Update:
@Xela
Lets meet in the chat.
Sorry, I have to go right now. I'll be back later and look into this problem.

--- End quote ---

I figured it out, ImageTagger was in Cyrillic folder. Images are showing correctly now that I relocated it.

rudistoned:
Glad it works now. Image Tagger should be based on utf-8, which should be able to handle Cyrillic? Well, string encodings are somewhat fiddly in Python 2, so I'm not surprised it's causing problems. I hope it's not a big inconvenience.



--- Quote from: Xela on August 04, 2013, 04:02:57 AM ---Maybe you can write a script that takes care of loading tags info into JSON files when you have time? There s no rush on that front, we'll trully need tags when new systems will be added past 1.0 release of PyTFall.

--- End quote ---
IMHO the best way to do this would similar to the way I do it in Pytherworld:

--- Code: ---picklefile = os.path.join(RESDIR, "chars.res")
if os.path.exists(picklefile):
    logger.info("loaded girl image metadata from pickled ressource")
    self.girls = tags.resload.ImageRessourceMap.from_pickle(picklefile)
else:
    girlimgdir = os.path.join(RESDIR, "chars")
    self.girls = tags.resload.ImageRessourceMap(["*.jpg", "*.png"], girlimgdir, picklepath=picklefile)
    self.girls.load()
    logger.info("created new girl image metadata")

--- End code ---


RESDIR is an absolute path to the content directory of PyTFall
girlimgdir is an absolute path to the directory containing the girl images

This will find all JPGs and PNGs in girlimgdir or any subdirectory, extract XMP tags embedded in them and store that information in self.girls.tagmap. self.girls is an instance of an image ressource map, which has an attribute called tagmap. The tagmap is very similar to and the successor of the TagDatabase class I wrote for PyTFall. So, basically, what TagDatabase did for PyTFall can be accomplished with self.girls.tagmap. However, self.girls also can read XMP tags directly from images and provides a pickling mechanism to store that data in a pickled file (necessary as generating that data takes to long to do it every time to program starts). Writing and loading image tags from JSON is no longer necessary with the new system.


What I could do is write a script that transfers the tags.json data into XMP tags in the images. We'll see.




Oh, and if you think this thread should be in game design, feel free to move it. However, I don't intend to discuss the design of PyTFall a lot here, this thread is about the current version of Image Tagger, how to use it and problems it causes. Discussion of PyTFalls tagging system should be here: [size=78%]http://www.pinkpetal.org/index.php?topic=1895.0[/size]

DarkTl:
I've been thinking, if Image Tagger will create a separate json file for tags instead of manipulating metadata, then if you want to add or change tags, you have to modify one small single file instead of changing a whole huge pack and uploading it once again.

rudistoned:
Yes, that's certainly true. When image metadata is used for tagging, the best model is IMHO to compile the tags into a single file before release and ship that with the game. Only the people doing the tagging need to download the latest version of the images. If every image pack is only tagged by one person, nobody has to repeatedly download the images. In addition, many game releases contain a complete set of their images anyway.


PyTFalls previous system of tags based on image file names has the same problem by the way (tag change requiring image redownload).



With that being said, I do believe that collaboration between many people is easier with tags stored in text files (JSON, XML, INI, ...), for several reasons (file size, version control tools and editing tools to name a few). Therefore, I intend to support text-file based tagging with Image Tagger at some point. Of course, text files also have several disadvantages. For example, any image that is renamed or moved into another folder loses its tags. If you combine a given image archive with a tag text file for an ealier/later "version" of this image archive (moving/renaming/adding/removing files changes the "version" of the image archive), some images will not find their tags because their path has changed. There is no easy way to go around this disconnection between tags and the images they describe. Part of a solution could be a checksum calculated from the image files. This would break as soon as the image file is changed (image optimization to reduce size, remove background and so on).


Adding support for text file based tagging to Image Tagger will require several steps:
1) Allow Image Tagger to export its tag memory for a particular image archive into a text file, probably a JSON file in the same format PyTFall currently uses.
At this point, tagging is still based on XMP metadata in the image files. However, Image Tagger users can create a snapshot of the tag memory in the form of a text file and distribute that file.
2) Allow Image Tagger to import text file based tag data and adapt the tags in its tag memory accordingly.
This creates the danger of destroying lots of tagging data if a user imports the wrong tag data text file and does not check the results of this import. There is also the question of how to handle images described in the tag data but not present in the file system (path changed or file deleted). At this point, XMP metadata is not necessary anymore.


Step 1) is easy and can be accomplished in about a week (depending on free time). I mean, if I get lucky, this could be done in a day, but experience shows I'm never that lucky...
Step 2) is harder due to the problems created by the disconnection between metadata and the image file introduced by abandoning XMP metadata.

DarkTl:

--- Quote from: rudistoned on August 27, 2013, 05:25:06 AM ---Of course, text files also have several disadvantages. For example, any image that is renamed or moved into another folder loses its tags.

--- End quote ---
Indeed. However, there is no need to give images specific names like in WM if we use tags. Sudden renaming of images will be a rare case. As for renaming folder, we might as well put tags files inside pics folders, so they will always be in the same place.


--- Quote from: rudistoned on August 27, 2013, 05:25:06 AM ---This would break as soon as the image file is changed (image optimization to reduce size, remove background and so on).

--- End quote ---
Well, ideally, all this should be done before you release a pack. I guess we could use a checksum, at least in order to throw a warning message in the beginning of the game.

On the other hand, people may dislike some images in packs. If a player wants to delete a couple of images, it shouldn't break the game.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version