Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 23:05

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



NavMesh Zone3 green lines problem & obj outlines

Discussion on NavMesh Zone3 green lines problem & obj outlines within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2008
Posts: 31
Received Thanks: 6
NavMesh Zone3 green lines problem & obj outlines

# 2
i loaded sector
entries,
hightmap,
texturemap,
zone1,
zone2,
zone3

and

tile2d.ifo,
object.ifo


How can I put ObjectOutLines on the map. i cant found
mss29 is offline  
Old 04/14/2013, 21:42   #2
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
ObjectOutLines, ObjectInLines, ObjectGround are in the *.bms files
DaxterSoul is offline  
Old 04/15/2013, 17:27   #3
 
elite*gold: 0
Join Date: Mar 2008
Posts: 31
Received Thanks: 6
i converted bms file to obj and looked into only v,vt,vn,f this is 3d model?? but how to calculating objectGround,lines for bitmap file. did not see anything like that in ?.. I am very bad at a lot of 3d modeling.

How do I calculate the objectground into bms ?
mss29 is offline  
Old 04/17/2013, 15:47   #4
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
You don't need to convert it into obj, you can load all needed information out of it.

illstar posted this 3 years ago on a different forum. If you would put some afford into it you would've found this already. There are many hints in all those silkroad collision / navmesh threads here as well.

Code:
Imports System.IO

Public Class cBmsLoader

    Public Structure sPoint
        Public x As Single
        Public y As Single
        Public z As Single
        Dim flag As Byte
    End Structure

    Public Structure sLine
        Public PointA As UInt16
        Public PointB As UInt16
        Public NeighbourA As UInt16
        Public NeighbourB As UInt16
        Dim flag As Byte
    End Structure

    Public Structure sTriangle
        Public PointA As UInt16
        Public PointB As UInt16
        Public PointC As UInt16
        Dim unk As UInt16
    End Structure


    Dim vertex As Int32
    Dim bone As Int32
    Dim triangle As Int32
    Dim unk1 As Int32
    Dim unk2 As Int32
    Dim stat As Int32
    Dim unk3 As Int32
    Dim HitBox As Int32


    Public Points As New Collections.Generic.List(Of sPoint)
    Public ObjectGround As New Collections.Generic.List(Of sTriangle)
    Public Inlines As New Collections.Generic.List(Of sLine)
    Public Outlines As New Collections.Generic.List(Of sLine)


    Sub New(ByVal path As String) 'load the bms 

        path = "\" & path
        Console.WriteLine(path)
        Dim b() As Byte = PK2_Data.Get_file(path)
        If b Is Nothing Then Exit Sub
        Dim Reader As New BinaryReader(New IO.MemoryStream(b))


        '### loding bms header ####
        Reader.ReadChars(12) 'Header --> "JMXVRES 109 "
        vertex = Reader.ReadInt32()
        bone = Reader.ReadInt32()
        triangle = Reader.ReadInt32()
        unk1 = Reader.ReadInt32()
        unk2 = Reader.ReadInt32()
        stat = Reader.ReadInt32()
        unk3 = Reader.ReadInt32()
        HitBox = Reader.ReadInt32()



        '#### Loading Points ####
        Reader.BaseStream.Position = HitBox
        Dim pCounter As Int32 = Reader.ReadInt32

        For i As Int32 = 1 To pCounter
            Dim point As New sPoint

            point.x = Reader.ReadSingle 'point X position
            point.z = Reader.ReadSingle 'point Z position
            point.y = Reader.ReadSingle 'point Y position
            Reader.ReadBytes(1) 'unk

            Points.Add(point)
        Next

        '### Loading ObjectGround ###
        pCounter = Reader.ReadInt32

        For i As Int32 = 1 To pCounter
            Dim Triangle As New sTriangle
            Triangle.PointA = Reader.ReadUInt16 'point A index --> Points
            Triangle.PointB = Reader.ReadUInt16 'point B index --> Points
            Triangle.PointC = Reader.ReadUInt16 'point C index --> Points
            Triangle.unk = Reader.ReadUInt16()
            ObjectGround.Add(Triangle)
        Next


        '### Loading Outlines ###
        pCounter = Reader.ReadInt32

        For i As Int32 = 1 To pCounter
            Dim Line As New sLine
            Line.PointA = Reader.ReadUInt16 'point A index --> Points
            Line.PointB = Reader.ReadUInt16 'point B index --> Points
            Line.NeighbourA = Reader.ReadUInt16 'index of neighbour triangle A --> ObjectGround
            Line.NeighbourB = Reader.ReadUInt16 'index of neighbour triangle B --> ObjectGround --> FFFF --> no Neighbour triangle
            Line.flag = Reader.ReadByte 'seems to intcate if passable (3=not passable 0=passable else=unk)
            Outlines.Add(Line)
        Next


        '### Loading Inlines ###
        pCounter = Reader.ReadInt32

        For i As Int32 = 1 To pCounter 'object inlines
            Dim Line As New sLine
            Line.PointA = Reader.ReadUInt16 'point A index --> Points
            Line.PointB = Reader.ReadUInt16 'point B index --> Points
            Line.NeighbourA = Reader.ReadUInt16 'index of neighbour triangle A --> objectground
            Line.NeighbourB = Reader.ReadUInt16 'index of neighbour triangle B --> objectground
            Line.flag = Reader.ReadByte 'seems to intcate if passable  (7=not passable 3=passable else=unk)
            Inlines.Add(Line)
        Next

        '... unk bytes .... 
        Reader.Close()
    End Sub
End Class
How to draw it:
Code:
//Draw it line by line ... something like that: 
foreach(Bms.sLine L in bms.Outlines) { 
            Pointf pA = new Pointf(bms.points(l.PointA).X,
					bms.points(l.PointA).Y)
            Pointf pB = new Pointf(bms.points(l.PointB).X,
					bms.points(l.PointB).Y)

            fx.DrawLine(new Pen(new SolidBrush(Color.Silver)),pA,pB)
}
Rotation Fix:
Code:
'You have to rotate before add the offset from the nvm 
            For Each Point As cBmsLoader.cPoint In Bms.Points
                'aObject.Rotation --> rotation from the nvm
                Dim newX As Single = Point.X * Math.Cos(-aObject.Rotation) - -Point.Y * Math.Sin(-aObject.Rotation)
                Dim newY As Single = Point.X * Math.Sin(-aObject.Rotation) + -Point.Y * Math.Cos(-aObject.Rotation)

                'aObject.Position.X/Y --> offset from the nvm
                Point.X = newX + aObject.Position.X
                Point.Y = newY + aObject.Position.Y
            Next
You're still far ways from loading all bms files because there are some bugs in the code.
DaxterSoul is offline  
Thanks
1 User
Old 04/18/2013, 18:42   #5
 
elite*gold: 0
Join Date: Mar 2008
Posts: 31
Received Thanks: 6
wow
Thank you it was a very nice resource
mss29 is offline  
Old 04/20/2013, 21:53   #6
 
elite*gold: 0
Join Date: Mar 2008
Posts: 31
Received Thanks: 6
omg little problem i cant find problem ? :S


this is my rotation and drawlines function :/
Code:
               //'You have to rotate before add the offset from the nvm 
                    float rotation = float.Parse(textBox2.Text);
                    for (int i = 0; i < bmfile.Points.Count; i++)
                    {
                        BmsLoader.BmsLoader.sPoint spoint = bmfile.Points[i];
                        // 'aObject.Rotation --> rotation from the nvm
                        float newX = ((spoint.x) * (float)Math.Cos(rotation)) - ((spoint.y) * (float)Math.Sin(rotation));
                        float newY = ((spoint.x) * (float)Math.Sin(rotation)) + ((spoint.y) * (float)Math.Cos(rotation));

                        //'aObject.Position.X/Y --> offset from the nvm
                        spoint.x = (newX + entrie.x) ;
                        spoint.y = (newY + entrie.y);
                        bmfile.Points[i] = spoint;
                    }

                    //Draw it line by line ... something like that: 
                    foreach (BmsLoader.BmsLoader.sLine item in bmfile.Outlines)
                    {
                        try
                        {
                            PointF pA = new PointF(bmfile.Points[item.PointA].x / float.Parse(textBox3.Text), bmfile.Points[item.PointA].y / float.Parse(textBox3.Text));
                            PointF pB = new PointF(bmfile.Points[item.PointB].x / float.Parse(textBox3.Text), bmfile.Points[item.PointB].y / float.Parse(textBox3.Text));
                            //grT.DrawPolygon(new Pen(Color.Blue), new PointF[] { pA, pB });
                            grT.DrawLine(new Pen(new SolidBrush(Color.Blue)), pA, pB);
                        }
                        catch (Exception)
                        {

                        }
                    }
mss29 is offline  
Reply


Similar Threads Similar Threads
[Help] LoadFail NavMesh GuardPost!
11/12/2012 - SRO Private Server - 3 Replies
http://www.elitepvpers.com/forum/attachment.php?at tachmentid=152439&stc=1&d=1352670078 Guys Why i Get this Error???? As u see i have these Files ?!? Hope for Answers Thanks
Navmesh X, Y Collision
08/03/2011 - SRO Coding Corner - 21 Replies
Soo lately I've been working on the navmesh files and I used drew's edxNVMViewer for this. But I've got a little stuck right now. For my project I'm using the nvm.h and nvm.cpp to load the navmesh file and I'm saving it in my memory. Everything goes fine and I get the correct Z position from the navmesh but I can't figure out how to get the forbidden area's in the navmesh. Like when a character walks up a mountain it will stop at some points since there is a collision. How am I able to...



All times are GMT +1. The time now is 23:05.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.