PDA

View Full Version : .s3d to .txt map files ?



Angahran
01-22-2004, 04:15 AM
I know this has been talked about before, and I'm sure someone will post here saying 'use search n00b' or something similar, but a) I have already read all the old posts, and b) I have already used search.

What I would like to know is has anyone come up with a way of generating a .txt map file from the .s3d(?) game files ?

All I have been able to find is this:


Here's how I do it:
* use Mitselplik's zone converter to get a povray file for the zone
* convert each mesh in the povray file to its own showeq map
* generate gif images of those maps
* pick which maps to use and merge them together
* spend a day running a map optimizer on it

Looks fairly simple.

1: Use VBZoneConverter (http://pages.sbcglobal.net/mitselplik/VBZoneConverter.html) and POV-Ray (http://www.povray.org/)

2: "convert each mesh in the povray file to its own showeq map"
This is the difficult bit, HOW ????

3: "generate .gif images of those maps"
huh ? isn't the idea to get a .txt file ?

4: "pick which maps to use and merge them together"
merging .gif files together ? *getting really confused*

5: "spend a day running a map optimizer on it"
the only map optimizer I have seen is Mappie, which optimizes .txt files

If anyone could shed any light into this dark confusing mess it would be appreciated. Apparently it seems at the moment that unless you know a whole load of graphics stuff there is no way to get decent amps out of the would files :(

Thanks for any replies

Angahran.

LordCrush
01-22-2004, 05:34 AM
I have played around with this a bit, but i have not enough time to go further atm.


Originally posted by Angahran

1: Use VBZoneConverter (http://pages.sbcglobal.net/mitselplik/VBZoneConverter.html) and POV-Ray (http://www.povray.org/)

If you do this you get some Mesh Textfiles.



Originally posted by Angahran

2: "convert each mesh in the povray file to its own showeq map"
This is the difficult bit, HOW ????


I have written a *very* basic converter in VBS


'Extract Mesh to Map
'V 0.4 By LordCrush



Const OpenAsASCII = 0
Const OpenAsUnicode = -1

' FileSystemObject.CreateTextFile
Const OverwriteIfExist = -1
Const FailIfExist = 0

' FileSystemObject.OpenTextFile
Const OpenAsDefault = -2
Const CreateIfNotExist = -1
Const FailIfNotExist = 0
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Dim oFileSystemObj, sOUT, fOUTFILE, sIN, fINFILE
sMapName="Arena"
sPOVFile=".\" & sMapName & ".pov"
sLineName=sMapName & "Line"
sColor="grey"
bDebug=0
iXMax=0
iYMax=0
iZMax=0

Set oFileSystemObj = CreateObject("Scripting.FileSystemObject")
Set fPOVFile = oFileSystemObj.OpenTextFile(sPOVFile, ForReading)

' WScript.Echo "POVFile " & sPOVFile
iMapNr=1
bVectors=false
Do While fPOVFile.AtEndofStream =False
sBuffer=fPOVFile.ReadLine
' WScript.Echo "Line " & sBuffer
if InStr(sBuffer,"vertex_vectors") > 0 then
sOUT=".\" & sMapName & iMapNr & ".txt"
' WScript.Echo "Line valid, File = " & sOUT
Set fOUTFILE = oFileSystemObj.CreateTextFile(sOUT, ForWriting, OpenAsASCII)
bVectors=true
sBuffer=fPOVFile.ReadLine
End If

if bVectors then
' WScript.Echo "Precheck Line " & sBuffer
if left(sBuffer,1) = "<" then
' WScript.Echo "Line " & sBuffer
fOUTFILE.WriteLine sBuffer
else
fOUTFILE.close
Set fOUTFILE = nothing
' WScript.Echo "File = " & sOUT & " done ..."
iMapNr=iMapNr + 1
bVectors=false
End If
End If

Loop

fPOVFile.close
set fPOVFile=nothing

'Conv mesh start
iMapNr=1
sIN=".\" & sMapName & iMapNr & ".txt"
sOUT=".\" & sMapName & iMapNr & ".map"
' WScript.Echo "Map = " & sIN & ", " & sOUT

Do while oFileSystemObj.FileExists(sIN)
Set fOUTFILE = oFileSystemObj.CreateTextFile(sOUT, ForWriting, OpenAsASCII)
Set fINFILE = oFileSystemObj.OpenTextFile(sIN, ForReading)
fOUTFILE.WriteLine sMapName & "," & sMapName & iMapNr & ",10,10,10"

Do While fINFILE.AtEndofStream =False
sBuffer=fINFILE.ReadLine
iLenSBuffer=Len(sBuffer)

' WScript.Echo "Line " & sBuffer
if left(sBuffer,1) = "<" then
' WScript.Echo "Line valid"
sP=""
iPCount=0
do
' Get Point 1
iPEnd=InStr(sBuffer,">")
iPStart=InStr(sBuffer,"<")
sP1=Mid(sBuffer,iPStart+1,iPEnd-IPStart-1)
'Reduce Buffer
iLenSBuffer=iLenSBuffer-iPEnd
sBuffer=right(sBuffer,(iLenSBuffer))

sPTmp=sP1
ToInt sPTmp
' WScript.Echo "sPTmp= " & SPTmp
GetCoord sPTmp,iCoord
if abs(iCoord) > iXMax then iXMax = abs(iCoord)
iX1=iCoord * (-1) 'Turn 180 Deg
' WScript.echo "X1= " & iX1 & ", iXMax " & iXMax & " sPTmp " & sPTmp
GetCoord sPTmp,iCoord
if abs(iCoord) > iYMax then iYMax=abs(iCoord)
iY1=iCoord
' WScript.echo "Y1= " & iY1 & ", iYMax " & iYMax & " sPTmp " & sPTmp
GetCoord sPTmp,iCoord
if abs(iCoord) > iZMax then iZMax=abs(iCoord)
iZ1=iCoord
' WScript.echo "Z1= " & iZ1 & ", iZMax " & iZMax & " sPTmp " & sPTmp
' Switch y<->z
sP = sP & iX1 & "," & iZ1 & "," & iY1 & ","
iPCount=iPCount+1
' WScript.Echo "P= " & sP
' WScript.Echo "Line " & sBuffer

loop until iLenSBuffer < 14
' WScript.Echo "Line: M,"& sLineName & "," & sColor & "," & iPCount & "," & sP
fOUTFILE.WriteLine "M,"& sLineName & "," & sColor & "," & iPCount & "," & sP
' WScript.Quit(0)
End If

loop


fOUTFILE.Close
Set fOUTFILE = nothing

fINFILE.Close
Set fINFILE = nothing

iMapNr = iMapNr + 1
sIN=".\" & sMapName & iMapNr & ".txt"
sOUT=".\" & sMapName & iMapNr & ".map"

' WScript.Echo "Map = " & sIN & ", " & sOUT
Loop
WScript.Echo (iMapNr-1) & " Maps written"


Function ToInt(sPTmp)

'X
iCoordEnd=InStr(sPTmp,",")
sCoord=Left(sPTmp,iCoordEnd-1) & ","
sPTmp=Right(sPTmp,Len(sPTmp)-iCoordEnd)
iCoordEnd=InStr(sPTmp,",")
sPTmp=Right(sPTmp,Len(sPTmp)-iCoordEnd)
'Y
iCoordEnd=InStr(sPTmp,",")
sCoord=sCoord & Left(sPTmp,iCoordEnd-1) & ","
sPTmp=Right(sPTmp,Len(sPTmp)-iCoordEnd)
iCoordEnd=InStr(sPTmp,",")
sPTmp=Right(sPTmp,Len(sPTmp)-iCoordEnd)
'Z
iCoordEnd=InStr(sPTmp,",")
sCoord=sCoord & Left(sPTmp,iCoordEnd-1)
sPTmp=Right(sPTmp,Len(sPTmp)-iCoordEnd)

sPTmp=sCoord
End Function



Function GetCoord (sPTmp,iCoord)
iCoordEnd=InStr(sPTmp,",")
if iCoordEnd <> 0 then
iCoord=Left(sPTmp,iCoordEnd-1)
sPTmp=Right(sPTmp,Len(sPTmp)-iCoordEnd)
else
iCoord=sPTmp
sPTmp=""
End If
if iCoord="" then iCoodr=0
End Function


This extracts the Meshinfo into map-files


Originally posted by Angahran

3: "generate .gif images of those maps"
huh ? isn't the idea to get a .txt file ?

You need the pictures to get an overview of what you have in the map-files. But you can use this tool to look on the maps without converting them to gif

EQMapviewer Binary & Src from slartibartfast:
Thread: http://seq.sourceforge.net/forums/showthread.php?s=&threadid=2163
Downloads:
http://seq.sourceforge.net/forums/attachment.php?s=&postid=13778
http://seq.sourceforge.net/forums/attachment.php?s=&postid=13777


Originally posted by Angahran

4: "pick which maps to use and merge them together"
merging .gif files together ? *getting really confused*


You need to merge the map-files that you choose at point 3


Originally posted by Angahran

5: "spend a day running a map optimizer on it"
the only map optimizer I have seen is Mappie, which optimizes .txt files


Yep... i am stuck there too


Here is the result of a try with the Arena-Map

Map from Mesh (GIF)

If you want the other files just send me a PM .. I have no webspace atm, which is not related to my RL name ;)

Greetings

--Lord Crush

LordCrush
01-22-2004, 05:38 AM
Orginal SEQ-Map:

Angahran
01-22-2004, 08:57 AM
Thanks,
things starting to get a little clearer :P

Any chance you could post the .exe for your VB code ?
I don't have access to VB at the moment :(

LordCrush
01-22-2004, 09:11 AM
This is a vb-script, just cut and paste into a texteditor and name it with extension .vbs ... should work on W2k or XP ... i have only tested it on XP


The the XP-script-engine has version 5.6 ( just execute cscript from a command-window)

I have attached it to this post. The Second Script is to convert the ZoneConverter output to US-Style of Numberdisplay ( use "." insted of "," otherwise PovRay gets confused 8) )

-- LC

Angahran
01-30-2004, 02:57 AM
Tried doing this on the arena, got it into pov-ray35 ok, looked good.
exported it, but couldn't you your .vbs files on it for some reason :(

double checked using your .vbs files against the arena file in your zip and it worked, so not sure what I've messed up :(

Thanks for the help.

Ang.

ksmith
01-30-2004, 08:02 AM
1: Use VBZoneConverter and POV-Ray

2: "convert each mesh in the povray file to its own showeq map"
This is the difficult bit, HOW ????

3: "generate .gif images of those maps"
huh ? isn't the idea to get a .txt file ?

4: "pick which maps to use and merge them together"
merging .gif files together ? *getting really confused*

5: "spend a day running a map optimizer on it"
the only map optimizer I have seen is Mappie, which optimizes .txt files

I didn't post the perl scripts I used for steps 2 and 5 because they're really not in a state that I wanted to support. Also, the optimizer I wrote probably only works well for hateplaneb; it's very aggressive.

ksmith
01-30-2004, 02:13 PM
You can find all the files for steps 3 and 4 from when I was working on the hateplaneb map here (http://kyle.13th-floor.org/eq/maps/gif/hateplaneb/)

This (http://kyle.13th-floor.org/eq/maps/povray/povtomap3.pl) is the perl script I used to convert the .pov file to a .map.

This (http://kyle.13th-floor.org/eq/maps/optimap3.pl) is my aggressive map optimizer.

I will not help anyone get either of the perl scripts to work. They are being released to save time for someone who already knows what they are doing.

Comments on algorithims are welcome.

Fatal
02-06-2004, 11:22 PM
ksmith.. the new algo for mappie is pretty aggressive.
let me see if I can get the code to ya.

UnGod
02-28-2004, 01:49 AM
I tried doing this myself (as part of SEQ actually) came up with pretty much the same results as you crushy, this was back when uhhm LDON first came out I think, and there were no decent maps yet.

My generated arena map looked exactally like yours :P

UnGod/Belith