[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Update of patch #1391 (project freeciv): Depends on: = patch #1928 ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #16, patch #1391 (project freeciv): updated version: * only ppm files possible (no additional tools needed) * save mapimg definitions in savegame * show borders/cities below fow * prepare for using it on server and client * some cleanup (file #10547) ___ Additional Item Attachment: File name: 20101002-trunk-create-map-images.patch Size:104 KB ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #17, patch #1391 (project freeciv): updated version: * working from the client (game = Save Map Image As ...) * options via Save = Options = Local Client = Map mage (file #10572) ___ Additional Item Attachment: File name: mapimg.diffSize:130 KB ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Update of patch #1391 (project freeciv): Status:None = In Progress Assigned to:None = syntron ___ Follow-up Comment #9: an update after a long time ... changes: * implement it as part of ./common * it will replace the creation of ppm files * addition engines using magicwand/gtk/sdl possible * can be called from the server (implemented), from the client (TODO) or as its own client (TODO) * needs the colour definitions in the ruleset (player colours, terrain colours, map overview colours) * can the file ./data/misc/colors.png be generated on the fly by the clients? Thus the colours for the players would be really independent. I think it should be possible for the gtk and sdl clients at least. how to test it: * apply the patch * start the server * define an map image using 'mapimg define zoom=2' * start the game ... * use the script mapimg2anim.bin to generate an animated gif file (file #10179) ___ Additional Item Attachment: File name: 20100905-07-trunk-create-map-images.patch Size:103 KB ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #11, patch #1391 (project freeciv): and a second example showing how the AI gives and remove vision ... (file #10185) ___ Additional Item Attachment: File name: freeciv-M-bcfkutZ1Pid000-anim.gif Size:988 KB ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #12, patch #1391 (project freeciv): It looks great. Is there a way to keep borders out of the vision? ___ Reply to this item at: http://gna.org/patch/?1391 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #13, patch #1391 (project freeciv): It looks great. Is there a way to keep borders out of the vision? yes; see the help mapimg help Available map image defintion options mapdef: name default description formatgif image format ('gif', 'png', 'ppm', 'jpg') show value all show players ('none', 'each', 'all', 'plrname', 'plrid', 'plrbv') plrname valueplayer name (if 'show=plrname') plrid value player id (if 'show=plrid') plrbv value player bitvector (if 'show=plrbv') turns value 1 save each value turns (0 = no autosave) zoom value2 zoom factor (1 = zoom = 5) map map cub definition of the map The map string map can contain: - 'a' show area within borders - 'b' show borders - 'c' show cities - 'f' show fogofwar - 'k' show only known terrain - 't' full terrain - 'u' show units 'k' and 'f' are only available if the map is drawn for one player Examples: 'zoom=1:map=tcub:show=all:format=gif' 'zoom=2:map=tcub:show=each:format=png' 'zoom=1:map=tcub:show=plrname:plrname=Otto:format=gif' 'zoom=3:map=cu:show=plrbv:plrbv=010011:format=jpg' 'zoom=1:map=t:show=none:format=jpg' ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #14, patch #1391 (project freeciv): I meant borders under fog of war when both 'f' and 'b' options are enabled. ___ Reply to this item at: http://gna.org/patch/?1391 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #15, patch #1391 (project freeciv): I meant borders under fog of war when both 'f' and 'b' options are enabled. This is not possible at the moment. There are some problems to solve: * is it really needed? (or is it to much?) * it is only possible if the data for only one player is displayed. * at the moment all information of the server are used. For this the data in the struct player_tile must be analysed (limited knowledge of the player). * a rewrite of this code is needed (and planed!) to use it in the server and the client. I think there should be a interface in the client to save a map image on the client side. ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #8, patch #1391 (project freeciv): time for a little status report: I used the stub client (with some functions from the gtk client) for the new mapimg client. After the server is running it can be started as: ./civ.x --gui mapimg -a -s mattsys -n o1 It will autoconnect as player, drop the player status and switch to global observer. While the game is running it will create a map image for each turn. Most of this is hardcoded. WIP: * a console similar to the one of the server for this client (for this console.(c|h) was moved to ./common); here some hints how this is / should working would be helpfull * remove the dependency on ImageMagick (MagickWand); use gtk instead (see mapimg.c) * some speedup of the image creation * cleanup of the code is needed * the ./civ script (see ./bootstrap/civ.in) does not allows to start different clients. My version (civ.x) uses a bad hack to allow the start of different clients. I will send this as a bug shortly. (file #7846, file #7847) ___ Additional Item Attachment: File name: mapimg.patch Size:279 KB File name: civ.x Size:2 KB ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #7, patch #1391 (project freeciv): The patch I posted here is working but after I had the time to read some additional code (see comment #5) I found some problems with this approach: * it needs a new dependency (MagickWand); using for example gtk one can also create image files (see gdk_pixbuf_save()) * the images would be created by the server; this results in a mess with regard to some *.spec files. Should colors.tilespec be known by the client and the server? Does this definition depend on the tileset or not? Terrain color definitions in the tileset or in the ruleset? I propose the following solution: * create a minimal (gtk) client which works as an observer (no gui!) * its purpose is to write an image of the map for each turn * it can be started from the server (using fork()) or as standalone binary which connects to the server as observer * it also can read a savefile and creates the map images * one can observe one player or the entire game I will have to rework a lot of code for this. Before I start I would like to know how you think about this topic. ___ Reply to this item at: http://gna.org/patch/?1391 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #6, patch #1391 (project freeciv): This patch for generating a animated statistics from a game is exactly a feature I've been looking for, to generate post-game statistcs for http://www.freeciv.net/ I'd like to use this functionality to create an animated .gif to be displayed on the website after the game is finished. Do you have any ideas, plans, or code, for how to trigger your scripts properly once a game has ended, so that the resulting animated .gif will be related to game statistics in a database? At the moment the patch only creates map images. It can be configured to create different types of images (all players, only one player, ...). The animated gif (or mpg/avi/flv) is created by a script. If the server exists after the game ended you could call in a script like # ./ser # civstats2anim options map animation 1 # civstats2anim options map animation 2 # ... # civstats2anim options map animation n This way all animated gifs will be created after the server stops. I've found something similar here: http://munk.wtf.la:5560/game_records.php?game_id=11 Are you the creator of this project also? If so, do you mind sharing the source code? Are all these statics automated? The code for this statistics was created by munk. It is a php script available in the forum (http://forum.freeciv.org/viewtopic.php?t=6128). I created the patch after I read the script and ask myself: Why create a parser for the savegame if we have an excellent one (the freeciv server)? The patch should be seen as a helper for the script. This way the map images as well as statistical data (as civscore.log file or *.csv files for each turn) can be created by the server and used as input for the postprocessing of the played game. I think we should cooperate on this functionality, since I'd like something very similar. On a related note, the Freeciv web client could be used to replay whole games, as well. This would involve setting up an observer player, which stores JSON in a database, which is then replayed to other players when they want a replay. I'm not familiar with the freeciv web client but I think that it would be easier to create a save file for each turn and replay the game loading this files turn by turn and displaying the whole map. This is that the map images do (missing are the exact information about the units and cities). ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #3, patch #1391 (project freeciv): Going on yesterday (or today in the early morning), I found that the overview has similar definitions like I have writen. I will check if I can (re)use some of the code. But I guess that the .tilespec will have to be dropped in this case. That do you mean? Is an other file extension needed? Furthermore, colors.tilespec defines colors for each terrain (hard coded names). As the definition of terrains is variable (number, names, ...), these coors should be within the terrain.ruleset file (as something like 'color = 200, 200, 200' for each terrain). This would require an new version of this ruleset file. Within colors_common.c it is said, that the number of player colors is limited to 14. Is this limitation still valid? I would like to use 30 different colors as defined in score.c? This way the colors would be different for each player. ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #4, patch #1391 (project freeciv): Within colors_common.c it is said, that the number of player colors is limited to 14. Is this limitation still valid? I would like to use 30 different colors as defined in score.c? This way the colors would be different for each player. After some more searching I looked into colors.spec and colors.png. Aha, these files have to be modified for 30 player colors ... ;-) ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #5, patch #1391 (project freeciv): The attached patch shows the current state of this patch. It does: * mapimg command (define, show, delete map image definitions create map images) * it uses the ImageMagick C-binding Magickwand if available; fallback are ppm files * save / restore map image definitions in the savegame * bash script which creates animations from saved map image files (using convert from ImageMagick and ffmpeg) * create csv files with statistical data for each turn * save playercolor within civscore.log file * new binary to generate map images and csv files for savegames TODO: * yesterday I found the files ./clients/colors_common.c and ./data/misc/colors.tilespec. The struct color and also the color definitions within the colors.tilespec file should be used. I plan to move the color definition for the terrains into terrain.ruleset as done within the patch (new capability needed?!) and split the remains of the file into playercolors.spec (with 32 colors from score.c) and gamecolor.spec (all the other color definitions). * Within ./client/overview_commen.c similar functions as in server/mapimg.c are defined. Perhaps some code can be reused. * The patch will be splitted into small parts. * Perhaps create versions for S2_1 and S2_2 (only the extra binary)? Attached is an example animated gif image (on a full terrain map cities, units and borders are show for one player considering known tiles and fogofwar). Comments welcome! (especially if I missed more files which code I have / will possible 'recreate') (file #7660, file #7661) ___ Additional Item Attachment: File name: statistic.patch.bz2Size:27 KB File name: civgame-M-bcfkutZ2P0100-anim.gif Size:82 KB ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
On Mon, 11 Jan 2010, Matthias Pfafferodt wrote: Follow-up Comment #5, patch #1391 (project freeciv): The attached patch shows the current state of this patch. It does: Attached is an example animated gif image (on a full terrain map cities, units and borders are show for one player considering known tiles and fogofwar). Comments welcome! (especially if I missed more files which code I have / will possible 'recreate') Hello Matthias, This patch for generating a animated statistics from a game is exactly a feature I've been looking for, to generate post-game statistcs for http://www.freeciv.net/ I'd like to use this functionality to create an animated .gif to be displayed on the website after the game is finished. Do you have any ideas, plans, or code, for how to trigger your scripts properly once a game has ended, so that the resulting animated .gif will be related to game statistics in a database? I've found something similar here: http://munk.wtf.la:5560/game_records.php?game_id=11 Are you the creator of this project also? If so, do you mind sharing the source code? Are all these statics automated? I think we should cooperate on this functionality, since I'd like something very similar. On a related note, the Freeciv web client could be used to replay whole games, as well. This would involve setting up an observer player, which stores JSON in a database, which is then replayed to other players when they want a replay. Regards, Andreas R. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #1, patch #1391 (project freeciv): I found today that player colors as well as terrain colors are defined within ./data/misc/colors.tilespec. They are read by functions within ./client/colors_common.(c|h). Would it be OK to use these colors for the creation of an map image? This would mean, that colors_common.(c|h) are moved into ./common and that the server would use these functions to read the colors from colors.tilespec to create the images. The basic question is, if the colors.tilespec file will be available for the server like the ruleset files? ___ Reply to this item at: http://gna.org/patch/?1391 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Follow-up Comment #2, patch #1391 (project freeciv): It sounds like a good idea for me. But I guess that the .tilespec will have to be dropped in this case. ___ Reply to this item at: http://gna.org/patch/?1391 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
Update of patch #1391 (project freeciv): Planned Release: = 2.3.0 ___ Reply to this item at: http://gna.org/patch/?1391 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [patch #1391] new code to generate stats (graphics)
URL: http://gna.org/patch/?1391 Summary: new code to generate stats (graphics) Project: Freeciv Submitted by: syntron Submitted on: Sunday 12/20/2009 at 00:23 Category: general Priority: 3 - Low Status: None Privacy: Public Assigned to: None Originator Email: Open/Closed: Open Discussion Lock: Any Planned Release: None Planned Release: ___ Details: If freeciv is played statistics are interesting, most of all as images. The attached patch adds a new binary called civstats which reads a savegame and creates a ppm images with * the map (ocean / land) * cities and units * border The code was tested for all topologies available. It will be extended to * return a ppm image of the map (terrain) * return a txt file with statistics (can be easily interpreted by a script to generate graphs) using a small bash script and ppmtogif and convert animated gif images can be created. ___ File Attachments: --- Date: Sunday 12/20/2009 at 00:23 Name: civstats.patch Size: 39kB By: syntron http://gna.org/patch/download.php?file_id=7526 --- Date: Sunday 12/20/2009 at 00:23 Name: civstats2gif.bin Size: 528B By: syntron http://gna.org/patch/download.php?file_id=7527 ___ Reply to this item at: http://gna.org/patch/?1391 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev