Patch Splitting - Basic Tutorial: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
Line 224: Line 224:
Well that's simple and only involves one more step using DarkRadiant. After you have split your patch either Horizontally or Vertically, open the map in the editor. Now for this example I'm going to assume that you have split your patch horizontally. Select the top half of the split patch, and go to Patch->Insert->Insert 2 Rows (pick either beginning or end it doesn't matter). You've now converted the patch back to a 5x5 patch which can now be split again. Remember the minimum matrix for a patch is 3x3, anything less will cause DR to crash or fail to load a map.
Well that's simple and only involves one more step using DarkRadiant. After you have split your patch either Horizontally or Vertically, open the map in the editor. Now for this example I'm going to assume that you have split your patch horizontally. Select the top half of the split patch, and go to Patch->Insert->Insert 2 Rows (pick either beginning or end it doesn't matter). You've now converted the patch back to a 5x5 patch which can now be split again. Remember the minimum matrix for a patch is 3x3, anything less will cause DR to crash or fail to load a map.
Now all you have to do is follow the steps for splitting the patch Vertically or Horizontally if you so wish.
Now all you have to do is follow the steps for splitting the patch Vertically or Horizontally if you so wish.
{{tutorial-patches}}

Revision as of 19:27, 18 February 2010

In this tutorial, I will demonstrate how to manually split patches in your map.

To start off, we need to create a new map file, so go to your darkmod/maps folder and right click and create a new text document. Call the file whatever you want (example: split.map)

Open up your new map file with your favorite text editor (I use Editplus 3 but notepad is fine), and copy these contents (Minus the equals sign bar):

======================================================================================================================================================

Version 2
// entity 0
{
"classname" "worldspawn"
"editor_drLastCameraPos" "-8 -1324 800"
"editor_drLastCameraAngle" "0 90 0"  
//Start of Patch Definition=========================
// primitive 6
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 5 0 0 0 )
(
( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
( ( 256 0 320 2.34375 0 ) ( 256 0 560 2.34375 -0.9375 ) ( 256 0 800 2.34375 -1.875 ) ( 256 0 1040 2.34375 -2.8125 ) ( 256 0 1280 2.34375 -3.75 ) )
( ( 456 0 320 3.125 0 ) ( 456 0 560 3.125 -0.9375 ) ( 456 0 800 3.125 -1.875 ) ( 456 0 1040 3.125 -2.8125 ) ( 456 0 1280 3.125 -3.75 ) )
)
}
}
//END OF THE PATCH DEFINITION=========================
}

======================================================================================================================================================

and paste them into your newly created map file and save the file. Now open DarkRadiant and open your new map file.

You should have one 5x5 patch in the middle. That patch we will be splitting into two patches.


This is the entry that we will be cutting up.


	{ 
	patchDef2
	{
	"textures/darkmod/metal/detailed/bars_rivets_steel"
	( 5 5 0 0 0 )
	(
		Row			Row			Row			Row			Row
Column	( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
Column	( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
Column	( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
Column	( ( 256 0 320 2.34375 0 ) ( 256 0 560 2.34375 -0.9375 ) ( 256 0 800 2.34375 -1.875 ) ( 256 0 1040 2.34375 -2.8125 ) ( 256 0 1280 2.34375 -3.75 ) )
Column	( ( 456 0 320 3.125 0 ) ( 456 0 560 3.125 -0.9375 ) ( 456 0 800 3.125 -1.875 ) ( 456 0 1040 3.125 -2.8125 ) ( 456 0 1280 3.125 -3.75 ) )
	)
	}
	}

As you can see I've marked the colums and rows of your patch mesh. The easiest way to split the patch is Horizontally because there is less cutting and pasting, and is easier to visualize. So as of now we have 5 rows and 5 columns. We want the patch to only have 3 columns and 5 rows, and the second patch to have 3 columns and 5 rows. So first we have to copy and paste the entire patch entry, so do that now.

You want it to look like this:


// primitive 6
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 5 0 0 0 )
(
( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
( ( 256 0 320 2.34375 0 ) ( 256 0 560 2.34375 -0.9375 ) ( 256 0 800 2.34375 -1.875 ) ( 256 0 1040 2.34375 -2.8125 ) ( 256 0 1280 2.34375 -3.75 ) )
( ( 456 0 320 3.125 0 ) ( 456 0 560 3.125 -0.9375 ) ( 456 0 800 3.125 -1.875 ) ( 456 0 1040 3.125 -2.8125 ) ( 456 0 1280 3.125 -3.75 ) )
)
}
}// primitive 7
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 5 0 0 0 )
(
( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
( ( 256 0 320 2.34375 0 ) ( 256 0 560 2.34375 -0.9375 ) ( 256 0 800 2.34375 -1.875 ) ( 256 0 1040 2.34375 -2.8125 ) ( 256 0 1280 2.34375 -3.75 ) )
( ( 456 0 320 3.125 0 ) ( 456 0 560 3.125 -0.9375 ) ( 456 0 800 3.125 -1.875 ) ( 456 0 1040 3.125 -2.8125 ) ( 456 0 1280 3.125 -3.75 ) )
)
}
}

So select the last 2 Columns in the first patchDef2 and delete them, so it looks like this.


// primitive 6
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 5 0 0 0 )
(
( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
)
}

Now select the first 2 Columns of the second patchDef2 and delete them so it looks like this


}// primitive 7
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 5 0 0 0 )
(
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
( ( 256 0 320 2.34375 0 ) ( 256 0 560 2.34375 -0.9375 ) ( 256 0 800 2.34375 -1.875 ) ( 256 0 1040 2.34375 -2.8125 ) ( 256 0 1280 2.34375 -3.75 ) )
( ( 456 0 320 3.125 0 ) ( 456 0 560 3.125 -0.9375 ) ( 456 0 800 3.125 -1.875 ) ( 456 0 1040 3.125 -2.8125 ) ( 456 0 1280 3.125 -3.75 ) )
)
}

Now one last step that's very important or the map will fail to load. Right now we've reduced our 5x5 patch into 2 3x5's. We now have to change the patch's parameters to reflect this change.

So we have to change the Cols for both new patches from 5 to 3.

So for the first patch:


// primitive 6
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 5 0 0 0 )	<----------------------------------------[this means 5x5 patch, change this to ( 3 5 0 0 0 ) ]
(
( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
)
}

And do the same for the second patch. Now save your map file and re-open it in DarkRadiant, you will have your patch split down the middle. Now to split it horizontally, you will just do the opposite; instead of removing columns, we will remove rows. Now copy the map file above one more time and paste it into your map file to undo our changes. Now we are going to split the patch across the middle. Again, we are going to copy and paste the patch definition like so.


// primitive 6
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 5 0 0 0 )
(
( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
( ( 256 0 320 2.34375 0 ) ( 256 0 560 2.34375 -0.9375 ) ( 256 0 800 2.34375 -1.875 ) ( 256 0 1040 2.34375 -2.8125 ) ( 256 0 1280 2.34375 -3.75 ) )
( ( 456 0 320 3.125 0 ) ( 456 0 560 3.125 -0.9375 ) ( 456 0 800 3.125 -1.875 ) ( 456 0 1040 3.125 -2.8125 ) ( 456 0 1280 3.125 -3.75 ) )
)
}
}// primitive 7
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 5 0 0 0 )
(
( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
( ( 256 0 320 2.34375 0 ) ( 256 0 560 2.34375 -0.9375 ) ( 256 0 800 2.34375 -1.875 ) ( 256 0 1040 2.34375 -2.8125 ) ( 256 0 1280 2.34375 -3.75 ) )
( ( 456 0 320 3.125 0 ) ( 456 0 560 3.125 -0.9375 ) ( 456 0 800 3.125 -1.875 ) ( 456 0 1040 3.125 -2.8125 ) ( 456 0 1280 3.125 -3.75 ) )
) 
}
}

But instead of reducing the columns we are reducing the rows. So for the first Patch, we want to remove the last two "rows", and also we want to change the patchParams so that it only has 3 rows instead of 5. So delete the points so that your first patch looks like this, and also change the rows to 3:


// primitive 6
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 3 0 0 0 )
(
( ( -344 0 320 0 0 ) ( -344 0 560 0 -0.9375 ) ( -344 0 800 0 -1.875 ) )
( ( -144 0 320 0.78125 0 ) ( -144 0 560 0.78125 -0.9375 ) ( -144 0 800 0.78125 -1.875 ) )
( ( 56 0 320 1.5625 0 ) ( 56 0 560 1.5625 -0.9375 ) ( 56 0 800 1.5625 -1.875 ) )
( ( 256 0 320 2.34375 0 ) ( 256 0 560 2.34375 -0.9375 ) ( 256 0 800 2.34375 -1.875 ) )
( ( 456 0 320 3.125 0 ) ( 456 0 560 3.125 -0.9375 ) ( 456 0 800 3.125 -1.875 ) )
)
}

Now for the second patch we copied and pasted, delete the first two "rows" so it looks like this:


}// primitive 7
{
patchDef2
{
"textures/darkmod/metal/detailed/bars_rivets_steel"
( 5 3 0 0 0 )
(
( ( -344 0 800 0 -1.875 ) ( -344 0 1040 0 -2.8125 ) ( -344 0 1280 0 -3.75 ) )
( ( -144 0 800 0.78125 -1.875 ) ( -144 0 1040 0.78125 -2.8125 ) ( -144 0 1280 0.78125 -3.75 ) )
( ( 56 0 800 1.5625 -1.875 ) ( 56 0 1040 1.5625 -2.8125 ) ( 56 0 1280 1.5625 -3.75 ) )
( ( 256 0 800 2.34375 -1.875 ) ( 256 0 1040 2.34375 -2.8125 ) ( 256 0 1280 2.34375 -3.75 ) )
( ( 456 0 800 3.125 -1.875 ) ( 456 0 1040 3.125 -2.8125 ) ( 456 0 1280 3.125 -3.75 ) )
)
}
}

And you are done. You have now split your patch Horizontally. Now what if I want to split it both horizontally AND vertically so that I have 4 patches made from 1. Well that's simple and only involves one more step using DarkRadiant. After you have split your patch either Horizontally or Vertically, open the map in the editor. Now for this example I'm going to assume that you have split your patch horizontally. Select the top half of the split patch, and go to Patch->Insert->Insert 2 Rows (pick either beginning or end it doesn't matter). You've now converted the patch back to a 5x5 patch which can now be split again. Remember the minimum matrix for a patch is 3x3, anything less will cause DR to crash or fail to load a map. Now all you have to do is follow the steps for splitting the patch Vertically or Horizontally if you so wish.

Template:Tutorial-patches