The_GTA

GTA:SA Scene2Res Converter

Recommended Posts

Hello MTA community!

Scene2Res was my passionate project back in 2010 when I worked on custom map support in MTA. :)

Convert any GTAIII engine scene into a MTA resource!

Gostown6 test (outdated):

Source Code: http://scene2res.osdn.jp/

Download: https://osdn.net/projects/scene2res/releases/

Tutorial video: https://www.youtube.com/watch?v=aHkSayeZZSE

Fix DFF for GTA:SA: https://forum.mtasa.com/topic/32665-gtasa-scene2res-converter/?do=findComment&comment=850903

How to use this:

  • Put all the IDE and IPL files into the "ipl" folder
  • Extract the textures, models and collisions into the "resources" folder
  • Configure the "config.ini" to fit your needs
  • Run the converter and fix any possible errors output
  • Cut out the contents from "output" into a .zip or a resource folder
  • Start the resource!

You will be able to see your map at the configured offset!

If you experience model loading problems, you can try switching the streaming method. If all attempts at fixing fail please consider contacting the MTA dev team for help. :)

And if you still have any problems beyond all help, expect them to turn from blue to green in a matter of time (ikr).

Ingame commands for caching:

- mcollect: Garbage collects the world, removing cached entries

- mapmem: Displays the current streamMemory

Configuration description:

  • compilator:
    Sets the author name that will be put into the meta.xml file.
  • compile:
    If set to true the map scripts will be compiled using luac.exe (only works if not zipped).
  • applyWorldConfig
    Decides whether the templated compiler will generate logic that changes world settings (far clip, fog distance, etc). If set to false, it will not do that (valid for MTA:BLUE and Eir fork targets).
  • debug:
    Outputs model streaming information for map debugging and error reporting.
    The list on the right displays every loaded model [modelname (refcount, loadstatus)].
  • mode:
    Sets the engine to compile for (either the original MTA:BLUE, the Eir client or the MTA:Eir fork)
  • xOffset, yOffset, zOffset:
    Recenters the map to a position.
  • namesCaseInsensitive:
    The names inside IPL and IDE files are usually treated case-insensitively inside of the GTA:SA engine. Set this to false to turn on case-sensitive checking.
  • jetpackHeight:
    Sets the jetpack maximum height + zOffset
  • method:
    Switches the streaming method. I recommend using stream, since distance is unstable.
    Should be self-explanatory what they do :)
  • mappingType:
    Allows you to switch between .lua and .xml file output for map instances. The .xml type output is much more performant and tested.
  • adjustFiltering:
    The map textures inside TXD files come with rendering pixel filtering settings. Scene2Res can make textures look smoother. Set this to true to set linear filtering for all textures. For more information visit engineLoadTXD.
  • static:
    Unrolls the lua tables to possibly gain performance during execution.
    This feature is experimental; should be optimal for small maps.
  • lodSupport:
    Enables LOD models to be compiled with the map. Setting this to true will apply the original draw distance instead of 500.
  • forceLODInherit:
    Inherits the previous model's collisions. The less collision files get loaded, the less collision errors there are.
  • cached:
    Enabling this will cause models to be loaded on the fly when they are required. Turning this off would theoretically ensure error-free models, but GTA:SA garbage collection picks them up anyway. Recommended.
  • streamerMemory:
    If this value reaches maximum, the streamer tries to free big unused models until the new model request fits into memory. This size is theoretical, since model files scale much higher when loaded by GTA:SA. Recommended at 100.
  • autoCollect:
    Once a model is not used anymore, it gets free'd from memory.
  • runtimeCorrection:
    Due to not having onModelLoad, onModelUnload, onModelInvalidate events, you can set this value to unload models which are in an invalid streamer state after x frames. Experimental feature!
  • zipOutput:
    When set to true, the compiler will create a .zip archive and output everything into it. This will create a ready-made map resource for you. Set the name of the .zip archive using the "zipName" parameter.
  • zipName:
    Changes the name that should be used for the output .zip archive created by "zipOutput" setting.
  • zipResources:
    If set to true, the compiler will look for a "resources.zip" file in its current directory. If found, resources will be loaded from that .zip archive instead of the "resources" directory. This way you can save hard disk space by having resources compressed instead of in many files.

Look into "config.ini" for further documentation!

Addendum 23.02.2017: I have updated this topic with the latest information. Grateful to everyone who enjoys this technology!

Thank you for using this tool.

- Martin

Edited by The_GTA
new codebase location; fix for non-SA DFFs

Share this post


Link to post

I have invested alot of time into the model system of GTA:SA and added ways to minimize the errors surrounding it. :)

Tested the converter recently and errors happened less frequently; the problem is not completely solved though and can only be done by fixing the model loader of MTA.

If you find any tracable errors, feel free to post them here ;)

Share this post


Link to post

You mean the previous version of my converter which was used for the video? It used the "distance" streaming method! If you want to have the map yourself, download the GTA:United mod and do this:

  • Download ImgTool 2.0 (http://grandtheftauto.filefront.com/file/IMG_Tool;44920)
  • Download ColEditor II (http://www.steve-m.com/downloads/tools/colleditor2/)
  • Extract all the contents from GTA3.img and LC2SA.img into a "res" folder on your desktop
  • Start up ColEditorII and list the directory contents of your "res" folder by type
  • Mark all .col files and drag&drop them into the tool
  • Select all collision entries, right click on them and extract them as Single Collision Files into your converter "resources" folder
  • Put the other files from the "res" folder in your "resources" folder too
  • Do the remaining steps from my main post :)

Share this post


Link to post

Oh, I did not know that. I am going to add LOD support and reduce the memory usage :)

LOD support - WIP

Reducing memory usage - done!

Share this post


Link to post

Nice, The_GTA. I still remember those days you started to work with custom models and now I see this has grown into complete program. Waiting for the LOD support. Good job! :)

Share this post


Link to post

After alot of testing I have realized that the GTA:SA streamer uses garbage collection and unimportant flags itself to stream models. That means, that the engine tries to load the LOD if there are too many model instances given to balance the memory usage. Some of you might know that the GTA:SA world starts flashing if you are high up with a enormous draw distance; that is when the streamer has reached it's memory or instance limit!

All that being said, if you engineLoad too many models, GTA:SA simply deactivates them D:

That is why engineReplaceModel did not work! I noticed that some models never got replaced no matter how often I called the function; who could have thought that the model turned invalid by that time? o_o Or better yet, that the engine has reloaded the original one in the blink of an eye?

I have no idea how to get a stable LOD system done like that xD

Share this post


Link to post

Now RC2 includes LOD support, though it is unstable due to GTA:SA model mechanics and error detection limitations D:

I have also added an option for automatic garbage collection.

EDIT: WOW, I cannot believe that I had this error in! I will immediatly release a bugfix, because I have changed some schematics in the Release Candidates which broke the directory sheme :S

EDIT2: Fixed :D

Share this post


Link to post
Hows Project Green?

I am about to redesign the shared class system of MTA:BLUE to prohibit future errors in conception. Then custom projectile support is gonna be implemented. After that I will fix up the entity classes. Finally, the model loader is gonna be finished.

Share this post


Link to post

I have now released the final version! It includes a tweak which the devs pointed out (engineLoadDFF, tested in 1.3). Should fix some texture garbage collection errors :)

Happy converting!

Share this post


Link to post

Hello,

First of all, I really like this tool.

I actually spent quite alot of time trying to port maps to resources (manually.. yea..)

As soon as I found out about this tool, I started porting some things, but I'm having a few issues.

I'm guessing it just has something to do with the config of the tool, which I probably set wrong.

1. I first tested it with a small map mod, a mountain with a road going down the mountain (road existed out of 3 objects).

Bringing the total amount of objects to 4.

The problem was that the big object (mountain) just went invisible when I neared the top or bottom of the mountain.

I'm guessing this has something to do with the streamer distance, but I have yet to figure out how to edit this.

Could you maybe explain me what I should edit in the config to fix this? And what the things that I'm editing actually mean?

2. Since this was giving me issues, I thought, I'll just follow the small tut you gave in this topic to port GTA:United Liberty City into a resource. So I did, with all settings default, only the memory extended to 500 MB (There is no shortage of system memory on my PC so I went a little overkill).

But this caused a second problem, crashing.... and crashing.... and crashing... Aslong as I fly next to the city looking at the borders, I am having no problem, but as soon as I move closer to the city, MTA just crashes. Now I know this explination is a bit vague, but how can I fix this? I'm guessing something in the converter settings... but what?

Anyways, thank you for all your work on this converter, I absolutely love it.

P.S. Is there any way to make the converter put out non encrypted client files? I'm guessing most people who want to use it will also have LUAC themselfs to encrypt it.

Share this post


Link to post

Thank you for your feedback, Infinate!

1. I first tested it with a small map mod, a mountain with a road going down the mountain (road existed out of 3 objects).

Bringing the total amount of objects to 4.

The problem was that the big object (mountain) just went invisible when I neared the top or bottom of the mountain.

I'm guessing this has something to do with the streamer distance, but I have yet to figure out how to edit this.

Could you maybe explain me what I should edit in the config to fix this? And what the things that I'm editing actually mean?

The mountain will go invisible under these circumstances:

  • The draw distance is set too low in the IDE file
  • GTA:SA occludes away your object (failed .col)
  • A unexpected streaming error happened

You enabled LOD support, right? I will be posting a description on all parameters in the original post :)

2. Since this was giving me issues, I thought, I'll just follow the small tut you gave in this topic to port GTA:United Liberty City into a resource. So I did, with all settings default, only the memory extended to 500 MB (There is no shortage of system memory on my PC so I went a little overkill).

But this caused a second problem, crashing.... and crashing.... and crashing... Aslong as I fly next to the city looking at the borders, I am having no problem, but as soon as I move closer to the city, MTA just crashes. Now I know this explination is a bit vague, but how can I fix this? I'm guessing something in the converter settings... but what?

There are invalid models which were probably fixed in a hack for the United mod. I do not know which models are invalid, but there are quite some. I crash in the second town too btw :S

I suggest you check my original post in a moment. Gonna update it now :D

P.S. Is there any way to make the converter put out non encrypted client files? I'm guessing most people who want to use it will also have LUAC themselfs to encrypt it.

Why do you want the files to be not compiled? I do not want anyone to play around with the source code, since it is unstable enough.

Share this post


Link to post
Hello,

I Tried the Resource for the test i downloaded this map : http://www.libertycity.ru/files/file33730.html

(i also tested it on other maps)

Does the map spawn on Mountain Chilliad if i start the Resource?

if yes it Don't work ;/

Already Thanks for Help.

Have you followed these instructions?

You mean the previous version of my converter which was used for the video? It used the "distance" streaming method! If you want to have the map yourself, download the GTA:United mod and do this:

  • Download ImgTool 2.0 (http://grandtheftauto.filefront.com/file/IMG_Tool;44920)
  • Download ColEditor II (http://www.steve-m.com/downloads/tools/colleditor2/)
  • Extract all the contents from GTA3.img and LC2SA.img into a "res" folder on your desktop
  • Start up ColEditorII and list the directory contents of your "res" folder by type
  • Mark all .col files and drag&drop them into the tool
  • Select all collision entries, right click on them and extract them as Single Collision Files into your converter "resources" folder
  • Put the other files from the "res" folder in your "resources" folder too
  • Do the remaining steps from my main post :)

Share this post


Link to post

i don't get it :/

Example : At this mod : Mountain Chilliad Map

Do i must extract the countrys.IPL and countryS.ide and then put it into the Folder "ipl"

and then run the ipl_mtaconv.exe and put the files from "output" to a zip file and start the map ? xD

Share this post


Link to post
i don't get it :/

Example : At this mod : Mountain Chilliad Map

Do i must extract the countrys.IPL and countryS.ide and then put it into the Folder "ipl"

and then run the ipl_mtaconv.exe and put the files from "output" to a zip file and start the map ? xD

Well Well man, this Mountain Chilliad Map adds some objects to countrys.ipl, make some changes on .ide and keep the standard GTA:SA map.

The Scene2Res program will generate a resource that's clean the GTA:SA Map, load new models and spawn it based on .ide and .ipl reference.

What's your problem? This Mountain Chilliad mod doesn't clean the GTA map. It spawns some objects from GTA SA standard models.

What you sould do? Compare the both .ipls (the original and the mod one), look at the differences and convert it to a .map file (some websites do it for you)

.IPL = the file thats holds x,y,z coordinates and rotation from all GTA objects on world

.IDE = holds all objects information and references.

models = texture, geometry and collision files that build the object in GTA world.

Edit: Moutain House v.1mod will replace the old house to a new one and will add a new object ( i think ), well well, it doesn't make lots of changes.

You may make a .lua script to replace the house and replace an unused object for this new model and spawn it some where.

Share this post


Link to post
i don't get it :/

Example : At this mod : Mountain Chilliad Map

Do i must extract the countrys.IPL and countryS.ide and then put it into the Folder "ipl"

and then run the ipl_mtaconv.exe and put the files from "output" to a zip file and start the map ? xD

Well Well man, this Mountain Chilliad Map adds some objects to countrys.ipl, make some changes on .ide and keep the standard GTA:SA map.

The Scene2Res program will generate a resource that's clean the GTA:SA Map, load new models and spawn it based on .ide and .ipl reference.

What's your problem? This Mountain Chilliad mod doesn't clean the GTA map. It spawns some objects from GTA SA standard models.

What you sould do? Compare the both .ipls (the original and the mod one), look at the differences and convert it to a .map file (some websites do it for you)

.IPL = the file thats holds x,y,z coordinates and rotation from all GTA objects on world

.IDE = holds all objects information and references.

models = texture, geometry and collision files that build the object in GTA world.

Edit: Moutain House v.1mod will replace the old house to a new one and will add a new object ( i think ), well well, it doesn't make lots of changes.

You may make a .lua script to replace the house and replace an unused object for this new model and spawn it some where.

Well,

The Mountain Chilliad mod Was just a test

I downloaded lots of Maps and all doesn't work!

i tried it also Maps witch replace the Normal map!..

it don't work and you don't need to explain me what is .IPL , .IDE and models :D i'm self Modeler!

But eh :/

so it just replace the map and you can't add new maps ?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.