Jump to content

Atlas and TeX


bankey

Recommended Posts

I am a beginner to programming, especially in lua. I am trying to create a mod at the moment, and am taking a lot of information from other mods to try to create my own. I DID have a couple of questions, and hopefully I can get some insight:

 

When I open up TeX documents, they are coming up as jibberish, as in question marks and nulls, and it basically looks like webdings. I am trying to open up in Notepad++...am I doing something wrong? (And a question in a question: what do they .teX documents do? I guess it would solve this question if I knew how to open them up properly.)

 

And the second one is Atlas.... Is Atlas just a variable? Or a variable that locates what type of artwork to use for the mod? I am so confused.

 

I have been trying to learn .lua through videos and my own research but there's no video that I can find that actually uses lua for Don't Starve specifically. Any help would be very appreciated.

Link to comment
Share on other sites

I am a beginner to programming, especially in lua. I am trying to create a mod at the moment, and am taking a lot of information from other mods to try to create my own. I DID have a couple of questions, and hopefully I can get some insight:

 

When I open up TeX documents, they are coming up as jibberish, as in question marks and nulls, and it basically looks like webdings. I am trying to open up in Notepad++...am I doing something wrong? (And a question in a question: what do they .teX documents do? I guess it would solve this question if I knew how to open them up properly.)

 

And the second one is Atlas.... Is Atlas just a variable? Or a variable that locates what type of artwork to use for the mod? I am so confused.

 

I have been trying to learn .lua through videos and my own research but there's no video that I can find that actually uses lua for Don't Starve specifically. Any help would be very appreciated.

 

You need a texture convertor to change .tex into workable files.

http://forums.kleientertainment.com/files/file/73-matts-tools/

The game should have a compiler that will change an image of the right size (64x64 image for inventory items) into a .tex file. But you need the convertor if you wish to change it back.

 

The atlas file is a simple xml that defines the position of the image to be used. The coordinates in the atlas file are based on a percentage of the .tex file's total dimensions.

 

u1 = left side, u2 = right side, v1 = bottom, v2 = top

Note the V coordinate measures percentage from the bottom up while the U coordinate measures from left to right.

 

So here is an example of 8 inventory images from a 512 x 256 .png file

<Atlas>

 <Texture filename="modinventory.tex" />

 <Elements>

  <Element name="item1.tex" u1="0.001953125" u2="0.123046875" v1="0.75390625" v2="0.99609375" />

  <Element name="item2.tex" u1="0.126953125" u2="0.248046875" v1="0.75390625" v2="0.99609375" />

  <Element name="item3.tex" u1="0.251953125" u2="0.373046875" v1="0.75390625" v2="0.99609375" />

  <Element name="item4.tex" u1="0.376953125" u2="0.498046875" v1="0.75390625" v2="0.99609375" />

  <Element name="item5.tex" u1="0.501953125" u2="0.623046875" v1="0.75390625" v2="0.99609375" />

  <Element name="item6.tex" u1="0.626953125" u2="0.748046875" v1="0.75390625" v2="0.99609375" />

  <Element name="item7.tex" u1="0.751953125" u2="0.873046875" v1="0.75390625" v2="0.99609375" />

  <Element name="item8.tex" u1="0.876953125" u2="0.998046875" v1="0.75390625" v2="0.99609375" />

 </Elements>

</Atlas>

So item 1 begins 0.1953125 % from the left edge of 512 pixels and ends at 12.3046875 %

If you do the math it begins at pixel 1 and ends at pixel 63, the next image begins at pixel 65 and ends at 127, etc. etc.

This gives each 64x64 image in the file a 1 pixel border (I am not sure if it is neccessary, but everything I have seen gives a 0.5 to 1 pixel border for the images).

 

But honestly its really much easier to make individual atlas and .tex files for each image since the game will compile it for you. Plus you don't have to do all the math, you can simply use the same Atlas file change the name of the .tex within it and save it under a new name.

<Atlas>

 <Texture filename="image1.tex" />

 <Elements>

  <Element name="image1.tex" u1="0.0078125" u2="0.9921875" v1="0.0078125" v2="0.9921875" />

 </Elements>

</Atlas>

That is pretty standard for a single 64x64 pixel image or 128x128 image.

Link to comment
Share on other sites

I am a beginner to programming, especially in lua. I am trying to create a mod at the moment, and am taking a lot of information from other mods to try to create my own. I DID have a couple of questions, and hopefully I can get some insight:

 

When I open up TeX documents, they are coming up as jibberish, as in question marks and nulls, and it basically looks like webdings. I am trying to open up in Notepad++...am I doing something wrong? (And a question in a question: what do they .teX documents do? I guess it would solve this question if I knew how to open them up properly.)

 

And the second one is Atlas.... Is Atlas just a variable? Or a variable that locates what type of artwork to use for the mod? I am so confused.

 

I have been trying to learn .lua through videos and my own research but there's no video that I can find that actually uses lua for Don't Starve specifically. Any help would be very appreciated.

 

Midrealm went a bit into detail there XD

 

.tex means texture, it's a unique format, but there are matts tools and ktools to de- and recompile those.

.xml (atlas) is the map that tells the game where in that tex what textures are

Link to comment
Share on other sites

The more technical the better! Thank you for some background information :) And atlas is basically...a map for a TeX (texture file) to give the mod the art to be used. Thank you for the information, will post if I have anymore questions!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...