Site Tools

en:creer_icone_objet

Creating an object icon

In the game inventory, one can see it's equipment thanks to icons which pile up in the inventory: These icons are created using a system that assembles several items(quantity, quality, background color, etc.).

Creating an object item

There is a repository with the released assets, which takes an inventory of all items that can be held, at least their icons, in

database/interfaces/v3_items

. Let's focus first on the objects of “AR_pantabotte.png” type, in below example. Just use these examples to create a new one. The final motif will be in .PNG format, with a transparent background, and a 40×40 pixels size.

Creating an interface file

The images used in the interface are gathered in one single file, named “new_texture_interfaces_dxtc” in the Ryzom Core version (the calling name can be changed, and so does the file name), to which is related a descriptive text file: “new_texture_interfaces_dxtc.txt”. It concentrates a big part of what is needed to generate the icons.
To create these two files, there is a copiled binary in the Ryzom Core tools: build_interface

USAGE : build_interface [-s<existing_uv_txt_name>] <out_tga_name> <path_maps1> [path_maps2] [path_maps3] ....
   -s : build a subset of an existing interface definition while preserving the existing texture ids, to support freeing up VRAM by switching to the subset without rebuilding the entire interface

Just enter the command mentionning which name is to be used for the exit files (one for image and one for index) and indicate each of the folders that will have to be incuded in the final image:

build_interface my_interface_images icons/tools icons/weapons icons/armors icons/food 

allows to get all the images in the named sub-sub-folders of “icons” (the tool doesn't go through the sub-folder by itself), and generates the following output:

\\ Writing tga file : my_interface_images.tga
\\ Writing UV file : my_interface_images.txt

These two files will be given in the .bnp of the client.

Hence, you have to gather all the icons you'll need into a sub-folder of an interface folder, and recreate the global image for the interface each time you create a new icon.
Then, in the Datasheet, call the .png file name of the object icon you want. In the below example, it will hence be “AR_pantabotte.png”.

Tools: perl script to extract the icons

Knowing that we don't have the sources for all the icones of the texture images, here is a perl script which automatically recreates these “icon images” from the texture file:

#!/usr/bin/perl -w
 
use strict;
 
# Check that there are 4 arguments 
my $num_args = $#ARGV + 1;
if ($num_args != 4) {
    print "\nUsage: extractor tga_file txt_file tga_width tga_height\n";
    exit;
}
 
my $tgafile=$ARGV[0]; # nom du fichier tga de texture
my $txtfile=$ARGV[1]; # nom du fichier txt listant les icones
my $w=$ARGV[2];  # largeur de l'image tga ( normalement 1024 )
my $h=$ARGV[3];  # hauteur de l'image tga ( normalement 1024 )
 
# function that rounds a number to the closest integer
sub round {
  $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5)
}
 
# opens the txt file to get a list of the icones
open(TXT, $txtfile) or die ("Coud not open the '$txtfile' file\n");
 
my $line ;
foreach $line (<TXT>) {
  chomp $line ;
  # splits a line in items separated with spaces
  my @array = split(/\s+/, $line);
  if ( scalar @array == 5 ) {
    my $iconname = $array[0]; # premier élément de la ligne, nom de l'icone
    my $x1 = round($array[1]*$w); # coin supérieur gauche ( x )
    my $y1 = round($array[2]*$h); # coin supérieur gauche ( y )
    my $x2 = round($array[3]*$w); # coin inférieur droit ( x )
    my $y2 = round($array[4]*$h); # coin inférieur droit ( y )
    my $ww = $x2-$x1+1 ; # largeur de l'image icone
    my $hh = $y2-$y1+1 ; # hauteur de l'image icone
    print "extraction de l'icone '$iconname' en ${ww}x${hh}+${x1}+${y1}\n" ;
    system ("convert -extract ${ww}x${hh}+${x1}+${y1} $tgafile $iconname") ;
  } else {
    print "invalid line : \"$line\"\n" ;
  }
}

Use: launch the command in the folder where you want to recreate the icons. For example, on my computer, the “texture_interfaces_v3.tga” texture file and the file that gives the icons list (“texture_interfaces_v3.txt”) are in the ~/lirria/user/interface folder. The tga texture has a height and a width of 1024×1024 pixels.

$ mkdir  mes_icones
$ cd mes_icones
$ ./extractor.pl ~/lirria/user/interface/texture_interfaces_v3.tga ~/lirria/user/interface/texture_interfaces_v3.txt  1024 1024 

Caution, the “convert” tool from the imagemagick packet has to be installed on the computer. Note: In addition to the tga icons, it can create special files because of the existence of lines with strange file names and zero-sized icons:

r2ed_tool_draw_region_over.psd 0.000000000000 0.000000000000 0.000000000000 0.000000000000
r2ed_tool_split_road_over.psd 0.000000000000 0.000000000000 0.000000000000 0.000000000000
road_flag.max 0.000000000000 0.000000000000 0.000000000000 0.000000000000
road_flag.shape 0.000000000000 0.000000000000 0.000000000000 0.000000000000

Note: It seems that those lines are errors, “psd”(photoshop) files of 3d models (.max and .shape) that were in the images folders when the texture has been created. It also explains the 0 0 0 0 coordinaters, since the tool wasn't able to read these formats. These files can be deleted.

en/creer_icone_objet.txt · Last modified: 2016/12/28 19:13 by Domperss