Texture Pack Demo

Back

The Goal

Recall that you can copy the xar package Data/Packages/xar to something like Data/Packages/xar_modded, modify the textures in xar_modded, and then start a new game with the xar_modded package.

However this page is about something different: overriding the textures in the xar package so that when someone starts a new game in the xar package, they can see your textures.

In a nutshell, you create the package Input/Packages/my_texture_pack from scratch and then modify these (without modifying Data/Packages/xar).

Step by Step Guide

  1. Create the directory Input/Packages/my_texture_pack if it does not exist already. Note that you can just download the finished my_texture_pack here, unzip it, and move it to Input/Packages.

  2. Create the file Input/Packages/my_texture_pack/dependencies.txt if it does not exist already. Make sure it reads as follows:
    wf base
    wf xar
    
    Actually, "wf base" is not needed, but we are being safe.

  3. Make sure the file Input/Packages/my_texture_pack/About/mod_for.txt says "xar" and the file Input/Packages/my_texture_pack/About/install_dir.txt says "Input/Packages" (without the quotes).

  4. Create the file Input/Packages/my_texture_pack/Textures/texture_names.txt if it does not exist already and make sure it reads as follows:
    block_dark_green_border    _     onion_the_cat.jpg
    
    The middle underscore says that the image has no alpha. For an image with alpha, put an "a" instead of an "_".

  5. Download this picture onion_the_cat.jpg and put it in Input/Packages/my_texture_pack/Textures. Note that the system also supports png files.

  6. Open up Fractal Block World and go to OPTIONS -> SELECT MOD -> SELECT PACKAGE and select the xar package. Then move the my_texture_pack from the left list to the right list.

  7. Load a game that uses the xar package. Go to a Ying Forest. The green blocks should now have a picture of Onion the Cat on them.

  8. That is it! Now you can add your own textures to Input/Packages/my_texture_pack/Textures and just make sure to modify the file Input/Packages/my_texture_pack/Textures/texture_names.txt accordingly. You can look at Data/Packages/xar/Textures/texture_names.txt to get the list of texture names that the xar package uses.

Download

Here is the final package that we just created.


"Nearest Neighbor" Texture Var

By default Fractal Block World performs linear filtering when rendering textures. However for each texture, you can specify in the texture_names.txt whether "nearest neighbor" filtering is on. To turn it on for a texture, you have line that starts "set" sometime AFTER the line where you define the texture name. So, this would be the texture_names.txt file:
block_dark_green_border     _     low_res.png
set block_dark_green_border nearest_neighbor true


"Clamping" Texture Var

By default, textures in Fractal Block World have the "repeat" texture wrapping mode. However you can change this to make any individual texture have the "clamp" wrapping mode. This is important when a texture is a character used in a font. Here is how to turn clamping on for a texture:
font_char_ascii_98 a ../Font/IndividualChars/98.png
set font_char_ascii_98 clamp true
This defines a texture named font_char_ascii_98, with alpha, which just so happens to be for the lowercase letter "b".

Undefining a Texture Name

You may never need to do this, but just in case you do, there is a way to "undefine" texture names. Consider the following texture_names.txt file:
green _ low_res.png
undefine green
The first line defines a texture name called "green", that has no alpha, that is associated to the file low_res.png. However the second line erases the green texture name from the system.

Warning About Texture Vars #1

When you redeclare a texture name, it erases all old texture variables associated to the texture name. For example, recall that the following will have the texture named "green" use nearest neighbor filtering:
green _ low_res.png
set green nearest_neighbor true
However, in the following, the texture named green will NOT use nearest neighbor filtering:
green _ low_res.png
set green nearest_neighbor true
green _ low_res.png
The system is designed this way in case multiple mods are used.

Warning About Texture Vars #2

A quirk of the current Fractal Block Engine is that texture objects are associated to file names, NOT texture names. You can have multiple texture names that map to the same filename. So consider the following texture_names.txt file:
green1 _ low_res.png
green2 _ low_res.png
set green2 nearest_neighbor true
It is clear that the texture green2 will use nearest neighbor filtering. What is less obvious is that in fact green1 will also use nearest neighbor filtering. This is because green1 and green2 map to the same texture object. You can workaround this by having multiple texture files:
green1 _ low_res.png
green2 _ low_res_copy.png
set green2 nearest_neighbor true
Now green2 uses nearest neighbor filtering, but green1 does NOT.