Welcome to the TWC Wiki! You are not logged in. Please log in to the Wiki to vote in polls, change skin preferences, or edit pages. See HERE for details of how to LOG IN.

Difference between revisions of "Introduction to City Editing"

From TWC Wiki
Jump to navigationJump to search
m (taking back out of scriptorium as re-direct page is in there too)
(watermark template)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Link to [http://www.twcenter.net/forums/showthread.php?t=26436 original post at TWC] by [[SigniferOne]]
+
{{RTW Modding Logo}}
 +
Link to [https://www.twcenter.net/forums/showthread.php?t=26436 original post at TWC] by [[SigniferOne]]
 
<hr>
 
<hr>
  
Line 15: Line 16:
 
I determined that a settlement plan mainly consisted of three files: the underlay and overlay files, which I didn't know what they did, and the settlement plan file which determined where the tents would be, where the walls, and in general where all buildings would be located.  
 
I determined that a settlement plan mainly consisted of three files: the underlay and overlay files, which I didn't know what they did, and the settlement plan file which determined where the tents would be, where the walls, and in general where all buildings would be located.  
  
For simplicity's sake, I decided to work on a barbarian town because it has a very simple topography, just one hill, and yet that's already more than what I had in the Roman cities. I knew that to make Rome a reality, I would have to change the very ground of the city, and that I could not be satisfied with simply having a plain level ground with just some new fancy buildings or a different floor plan. I knew I had to work with those strange underlay/overlay files if I wanted to achieve anything. The two files in question are [[data/settlement_plan/underlays/barb_large_town_underlay.cas]] and [[data/settlement_plan/overlays/barb_large_town_overlay.cas]], and both of them are openable with Vercingetorix' CAS tool:
+
For simplicity's sake, I decided to work on a barbarian town because it has a very simple topography, just one hill, and yet that's already more than what I had in the Roman cities. I knew that to make Rome a reality, I would have to change the very ground of the city, and that I could not be satisfied with simply having a plain level ground with just some new fancy buildings or a different floor plan. I knew I had to work with those strange underlay/overlay files if I wanted to achieve anything. The two files in question are '''data/settlement_plan/underlays/barb_large_town_underlay.cas''' and '''data/settlement_plan/overlays/barb_large_town_overlay.cas''', and both of them are openable with Vercingetorix' CAS tool:
  
 
http://img226.echo.cx/img226/1395/barbtown8oy.jpg
 
http://img226.echo.cx/img226/1395/barbtown8oy.jpg
Line 36: Line 37:
 
http://img226.echo.cx/img226/3429/code33ul.jpg
 
http://img226.echo.cx/img226/3429/code33ul.jpg
  
Having backed up the original [[barb_large_town_underlay.cas]], I overwrote it with my new version in the data/settlement plan/underlays folder. Then, I changed the line in [[barbarian_large_town.txt]] from  
+
Having backed up the original '''barb_large_town_underlay.cas''', I overwrote it with my new version in the data/settlement plan/underlays folder. Then, I changed the line in '''barbarian_large_town.txt''' from  
  
 
  "floor barbarian_large_town_underlay.CAS barbarian_large_town_overlay.CAS"
 
  "floor barbarian_large_town_underlay.CAS barbarian_large_town_overlay.CAS"
Line 51: Line 52:
  
 
I had done it!! The principle was discovered, and the rest was only a matter of details. :)
 
I had done it!! The principle was discovered, and the rest was only a matter of details. :)
 
  
 
==How to replicate what I did==
 
==How to replicate what I did==
Line 97: Line 97:
 
5) Backup the original file and overwrite it with the one you made. Start it up in the game and have fun.
 
5) Backup the original file and overwrite it with the one you made. Start it up in the game and have fun.
  
There you go!! This is only an introductory tutorial, because really there is a lot more to be said. But even with this much, a lot can be done already. For example, check out the Roman fort that started it all, the one newly discovered by Webbird (found [http://www.twcenter.net/forums/index.php?showtopic=26866&st=0 here]). It already looks great, but it needs some level ground inside the palisades, so that archers and othe skirmishers can stand on flat ground while shooting, instead of on an incline as they do now, which looks silly. This will be a great introductory project, you guys can practice this tutorial AND get something done that will be useful ever since.
+
There you go!! This is only an introductory tutorial, because really there is a lot more to be said. But even with this much, a lot can be done already. For example, check out the Roman fort that started it all, the one newly discovered by Webbird (found [https://www.twcenter.net/forums/index.php?showtopic=26866&st=0 here]). It already looks great, but it needs some level ground inside the palisades, so that archers and othe skirmishers can stand on flat ground while shooting, instead of on an incline as they do now, which looks silly. This will be a great introductory project, you guys can practice this tutorial AND get something done that will be useful ever since.
  
 
More tutorials, on other aspects of editing settlement_plans, will be written in the future.
 
More tutorials, on other aspects of editing settlement_plans, will be written in the future.
  
 +
{{permitted|link location=[https://www.twcenter.net/forums/showthread.php?t=26436 TWC Article]|Name=[[SigniferOne]]}}
  
{{imported|link location=[http://www.twcenter.net/forums/showthread.php?t=26436 TWC Article]|Name=[[SigniferOne]]}}
+
[[Category:RTW Battle Map Modding]]
 
+
[[Category:RTW_Modding_Tutorials]]
[[Category: Modding]][[Category: RTWModding]][[Category:RTW_Modding_Tutorials]]
 
 
[[Category:3D Modelling]]
 
[[Category:3D Modelling]]

Latest revision as of 12:11, 18 May 2020

Rome:Total War & Remastered - Modding Index


Link to original post at TWC by SigniferOne


The Beginning

I had always wanted to see realistic cities in RTW, much like many other people; Some of the original game trailers had non-flat rising and towering cities, but in the game we basically got a town with a few roads and a huge central square that took a lot of space within an already small city. So I was dissatisfied. There have been some attempts before to try and figure out how cities work and how to edit them, but they didn't get too far. Then, one day Webbird made a nice discovery concerning settlement plans for forts (he basically discovered a hidden and unused settlement_plan for a Roman fort which was much bigger and better than the one in vanilla). I got curious and decided to get into this area of modding help him capitalize on that discovery; then, one day, I happened upon this picture:

230005c0rj.jpg

As the Greeks might say, my passions were completely inflamed. You see, I always wanted to see how Rome would look like in real life, how the hills would look like, but there were no 3d representations of it, and I could never get accurate information (unlike Athens, for example, which has a very simple topography, relatively). So when I saw that picture, I could not believe my eyes because finally what I've been dreaming about was right there before my eyes -- what that picture shows is a model of Republican Rome in a museum in Italy, this model being a brother to the much bigger and more famous Imperial Rome model; the Imperial Rome model is famous, "Plastico d'Urba" or something like that, but I never cared for Imperial Rome and always had a tender fondness for the Republic. After finding that picture I discovered the lesser known Republican model in that very same museum, and was FINALLY able to visualize the great city before my eyes, as it looked when Scipio Africanus, Fabius Maximus, T. Quntus Cincinnatus, and L. Junius Brutus walked its streets; my passions became completely inflamed to do it in the game.

The task would be hard, I realized that, but no matter how much time I would spend on it, this would be, as Thucydides put it, "a posession for all time", finally a first and interactive 3d representation of Rome as it was in the Republic. In short, if we look of RTW as more than just a game but a potential and valuable tool for studying the classics, a more accurate Rome would be a crucial part of it. It would not just be something that would be used and discarded with the needs of gamers but something that would needed by everyone yet found by no one (until now), and would be used for learning and understanding the Classics long after the game itself would be outdated -- in short, "a possession for all time".

With this passionate motivation in mind, I set my mind on recreating the city in the game.

I determined that a settlement plan mainly consisted of three files: the underlay and overlay files, which I didn't know what they did, and the settlement plan file which determined where the tents would be, where the walls, and in general where all buildings would be located.

For simplicity's sake, I decided to work on a barbarian town because it has a very simple topography, just one hill, and yet that's already more than what I had in the Roman cities. I knew that to make Rome a reality, I would have to change the very ground of the city, and that I could not be satisfied with simply having a plain level ground with just some new fancy buildings or a different floor plan. I knew I had to work with those strange underlay/overlay files if I wanted to achieve anything. The two files in question are data/settlement_plan/underlays/barb_large_town_underlay.cas and data/settlement_plan/overlays/barb_large_town_overlay.cas, and both of them are openable with Vercingetorix' CAS tool:

barbtown8oy.jpg barbtown13hs.jpg

Clearly something in these pictures has to do with the ground topography of barbarian towns, since all other candidates are excluded. Now, since these are CAS files, importing them worked so now I tried exporting them. The overlay worked just fine, but when exporting the underlay I got the following error:

barbtown27xs.jpg

This is as far as others have gone, I imagine, and I was very stumped at this point myself. I think I even PMed Vercingetorix asking if this could be fixed. This really stumped me for a long time, and I didn't know what to do, waiting for a solution. Finally, I could not be stopped, even by a very arcane looking script, even to my Computer Science major eyes, so I decided to try and decode it and figure out what was going wrong. Very long story short, there's a function called Write(), and within it is contained the following code:

code14mw.jpg

The red box highlights the section of the code which causes the error when exporting an underlay. I decided to be very blunt about it, and to simply REMOVE the trouble code, hoping that this would still somehow allow the program to work and export things successfully. I did not remove the entire for() loop, only the last three lines, the if() statements, getting the following as a result:

code28hb.jpg

I did some tests and the script actually worked! I was guardedly optimistic at this point. Then I changed the original underlay file to the following (a simple moving of four vertices):

code33ul.jpg

Having backed up the original barb_large_town_underlay.cas, I overwrote it with my new version in the data/settlement plan/underlays folder. Then, I changed the line in barbarian_large_town.txt from

"floor		barbarian_large_town_underlay.CAS barbarian_large_town_overlay.CAS"

to

"floor		barb_large_town_underlay.CAS barb_large_town_overlay.CAS"

Then I restarted the game (it has to be restarted when text files are changed, for them to take effect), and, having my fingers crossed, loaded it up in the Battle Editor:

success7hn.jpg

SUCCESS !!!

I had done it!! The principle was discovered, and the rest was only a matter of details. :)

How to replicate what I did

1) You will need to create two versions of Vercingetorix' CAS script -- one for exporting overlays, and another for exporting underlays. As I said above, you will have to modify the original script in order to export the underlays. So go ahead and make a copy.

2) Open the script designated for underlays, find the following section in the code:

 for i=1 to numVerts do(
 	ttVert = point3 0.0 0.0 0.0
 	for k=1 to numFaces do(
 	tface = getFace tmpMesh k
 	if tface.x==i then ttVert = gettvert tmpMesh (getTVFace tmpMesh k).x
 	else if tface.y==i then ttVert = gettvert tmpMesh (getTVFace tmpMesh k).y
 	else if tface.z==i then ttVert = gettvert tmpMesh (getTVFace tmpMesh k).z

 	)

 	--ttVert = gettvert tmpMesh i
 	WriteFloat fp ttVert.x
 	WriteFloat fp (1.0-ttVert.y)
 )

and change it to

 for i=1 to numVerts do(
 	ttVert = point3 0.0 0.0 0.0
 	for k=1 to numFaces do(
 	tface = getFace tmpMesh k
 	)

 	--ttVert = gettvert tmpMesh i
 	WriteFloat fp ttVert.x
 	WriteFloat fp (1.0-ttVert.y)
 )

3) Change barbarian_large_town.txt data/settlement plan folder so that it points to the barb_large_town_underlay/overlay CAS files (see above).

4) Open the underlay file in 3dsmax. As you'll find out, it has three objects: the underlay mesh, the outline mesh, and the Scene Root. Select the underlay mesh, make whatever modifications you wish. Then run the script designated for underlays, and from there export what you have done.

5) Backup the original file and overwrite it with the one you made. Start it up in the game and have fun.

There you go!! This is only an introductory tutorial, because really there is a lot more to be said. But even with this much, a lot can be done already. For example, check out the Roman fort that started it all, the one newly discovered by Webbird (found here). It already looks great, but it needs some level ground inside the palisades, so that archers and othe skirmishers can stand on flat ground while shooting, instead of on an incline as they do now, which looks silly. This will be a great introductory project, you guys can practice this tutorial AND get something done that will be useful ever since.

More tutorials, on other aspects of editing settlement_plans, will be written in the future.

Initial content for this article was based on: TWC Article

Posted here with the permission of the original author: SigniferOne

Please note that the content may have been altered since import. Subsequent amendments are welcome but are not the responsibility of the original author.