Mirage Source

Free ORPG making software.
It is currently Thu Mar 28, 2024 10:25 pm

All times are UTC




Post new topic Reply to topic  [ 21 posts ] 
Author Message
PostPosted: Mon Jun 24, 2019 7:07 am 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
I have begun working on K2H again and plan on launching a new server shortly. The new K2H will offer a sizeable client so that you can play in any resolution and new updated UI menus to make it look more modern.
Hope to see you around :)

Website: http://www.key2heaven.com
Discord: https://discord.gg/TmHHJkG
Forum: http://www.key2heaven.com/k2h/forum

http://www.key2heaven.com/screenshots/MainMenu2019.png
Image

http://www.key2heaven.com/screenshots/n ... nt2019.png
Image

http://www.key2heaven.com/screenshots/chars2019.png
Image

http://www.key2heaven.com/screenshots/newchar2019.png
Image

http://www.key2heaven.com/screenshots/s ... 190623.png
Image

http://key2heaven.com/screenshots/screen_big.png
Image

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Wed Jun 26, 2019 8:40 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
I began porting my server to vb.net a few days ago and its going pretty well. There is still a lot of work to be done though. So I will probably share some more information when I get closer to completion.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Wed Jun 26, 2019 10:51 pm 
Offline
Pro
User avatar

Joined: Tue Apr 22, 2008 2:15 am
Posts: 597
That will be neat to read about! Looking forward to it!


Top
 Profile  
 
PostPosted: Thu Jun 27, 2019 12:29 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
How to Port to .net or .net Core.
1. Download Visual Studio 2008.
2. Open your VB project with it and chose convert and run the wizard (begin with the server, its easiest).
3. Run your new vb.net server, and fix all the common errors that appeared.
4. Remove your frmServer and create a new form called ServerWindow (move some data if needed from frmServer).
5. Download https://www.codeproject.com/Articles/11422/Winsock-NET
6. Implement winsock net to your project.
7. If you have byte arrays you will have more difficulties, I had to rewrite all of modBuffer etc.
8. Make sure things work, connect the client.

I'm almost done now I think, but this just covers the porting, not the improving. If anybody wanna try Im more than happy to assist with questions. I will probably make a more detailed post later, but hey I dont think anybody else is actually gonna try it so i'll wait :)

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Thu Jun 27, 2019 1:03 pm 
Offline
Pro
User avatar

Joined: Tue Apr 22, 2008 2:15 am
Posts: 597
You make it sound so simple, but I'm sure there were many hours put into hunting down errors! lol


Top
 Profile  
 
PostPosted: Thu Jun 27, 2019 1:08 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
It all depends on the knowledge/how much time you have. But its very doable, and the less features you have the easier it is. Easiest would be for a normal MS version of course. I think I have spent maybe 15-20hours so far on the server.

And I can share code, for example all the code from the .net winsock so that would save time if someone else wants to try.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Thu Jun 27, 2019 1:12 pm 
Offline
Pro
User avatar

Joined: Tue Apr 22, 2008 2:15 am
Posts: 597
Ya, I think the winsock conversion would be the most troublesome for me.

I think my last project I was working on was using byte arrays, so that'll be fun. What was causing the greater difficulty with the conversion of those?


Top
 Profile  
 
PostPosted: Thu Jun 27, 2019 1:21 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Hmm, the most troubling for me so far has been:
* I was not aware that VB6 and VB.net had missmatching variable declarations. So for example a Long in VB6 is a Integer in VB.net, a Integer in VB6 is a Short in VB.net. So that caused issues for me when I was trying to read all my binary data files (map,items etc...). Because all those bytes need to match exactly. And for some files they still didnt match and that was because VB6 just reads it and doesnt care if it missmatches with the length of the file. While vb.net crashes, but that was basicly solved by try catching the get function for the data, cause the data was still read.
* Encodings was a issue, there is like ASCII, ETF8, UNIFORM etc when converting to and from bytes. It took me sometime to grasp the fact that that was the issue. But I basically use System.Text.Encoding.Default. for now. You mainly just search for System.Text.Encoding. in your vb.net converted server to see all the locations for it.
* Its also a little tricky with the indexes of arrays, since vb6 has arrays from value 1-10 for exmple, but thats forbidden in vb.net (it has to start from 0). So there was a -1 here and there to take care of that.

Here is the winsock part, pretty short and simple. All you do is add:

Code:
    Public Shared Network As New Sockethandler

in the ServerWindow class. And add:
Code:
    Network.Initialize()

in the ServerWindow form loaded sub.

And then you will have some errors with frmServer.Socket that you change to ServerWindow.Server...

Code:
Imports System.Collections.Generic
Imports System.Net.Sockets
Imports Winsock_Control

Public Class Sockethandler

    Public WithEvents Server As Winsock
    Public Sockets As New Dictionary(Of Integer, Winsock)
    Private m_SocketsToRemove As New List(Of Winsock)

    Public Sub Initialize()
        Server = New Winsock
        Server.LocalPort = 4000
        Server.RemotePort = 4000
        Server.RemoteIP = "127.0.0.1"
        Server.Listen()
    End Sub

    Public Function GetState(index As Integer) As WinsockStates
        If TryGetUser(index) Is Nothing Then
            Return WinsockStates.Closed
        End If

        Return TryGetUser(index).GetState
    End Function

    Public Function TryGetIndex(socket As Winsock) As Integer
        For Each item As KeyValuePair(Of Integer, Winsock) In Sockets
            If item.Value Is socket Then
                Return item.Key
            End If
        Next
        Return -1
    End Function

    Public Function TryGetUser(index As Integer) As Winsock
        If Sockets.ContainsKey(index) Then Return Sockets(index)

        Return Nothing
    End Function

    Private Sub Socket_ConnectionRequest(sender As Winsock, requestID As Socket) Handles Server.ConnectionRequest
        Try
            Dim i As Integer
            i = FindOpenPlayerSlot()

            Sockets.Add(i, sender)
            Dim ws As Winsock = CType(sender, Winsock)

            AddHandler ws.DataArrival, AddressOf wsk_DataArrival
            AddHandler ws.Disconnected, AddressOf wsk_Disconnected

            ws.Accept(requestID)

            Call AcceptConnection(ws, requestID, i)
        Catch ex As Exception
            Diagnostics.Debugger.Break()
        End Try
    End Sub

    Private Sub wsk_Disconnected(sender As Winsock)
        If m_SocketsToRemove.Contains(sender) Then Exit Sub
        m_SocketsToRemove.Add(sender)

        If m_SocketsToRemove.Count > 0 Then
            Try
                CloseSocket(TryGetIndex(sender))
                m_SocketsToRemove.Remove(sender)
            Catch ex As Exception
                Diagnostics.Debugger.Break()
            End Try
        End If
    End Sub

    Private Sub wsk_DataArrival(sender As Winsock, BytesTotal As Integer)
        If IsConnected(TryGetIndex(sender)) Then
            Call IncomingData(TryGetIndex(sender), BytesTotal)
        End If
    End Sub

End Class

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Fri Jun 28, 2019 10:14 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
I'm finally able to login to the game with the .net server :D :D :D This is big progress, now I just need to take care of the remaining issues, but being able to login is huge in continuing the work.

www.key2heaven.com/screenshots/vbnetserver.png
Image

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Sat Jun 29, 2019 12:03 pm 
Offline
Pro
User avatar

Joined: Tue Apr 22, 2008 2:15 am
Posts: 597
That's awesome! You're making really quick progress there.


Top
 Profile  
 
PostPosted: Sat Jun 29, 2019 7:46 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
I lost many hours trying to investigate a socket/packet issue though. And it turns out there where things needed to be changed in the .net winsock for it to work on mirage. But now Ive made adjustments to it and things are looking better again. So if anybody attempts this they should probably ask me to post the code changes for the .net winsock.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Sat Jun 29, 2019 8:34 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
From what I can see now the server port is finished. There are no more issues that im aware of right now :) This doesnt mean that all the server work is done though, it just means that its playable but there is not much gained from the port at the moment. So next step for the server will be to rewrite the socket system to a modern tcp system etc. But before all that I will port the client also so I have everything in .net working before I start doing optimizations. Thats the plan :) Click url to see full screenshot.

http://www.key2heaven.com/screenshots/s ... t_done.png
Image

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Tue Jul 16, 2019 8:30 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
The progression is going really well, we now have SFML in the VB.NET client. You can follow the work here:
https://discord.gg/TmHHJkG

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Thu Jul 18, 2019 12:20 pm 
Offline
Pro
User avatar

Joined: Tue Apr 22, 2008 2:15 am
Posts: 597
Forgive my ignorance but what is SFML?


Top
 Profile  
 
PostPosted: Thu Jul 18, 2019 9:42 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
I'm using SFML for the graphics and most likely the audio ( https://www.sfml-dev.org/ )

Quote:
SFML provides a simple interface to the various components of your PC, to ease the development of games and multimedia applications. It is composed of five modules: system, window, graphics, audio and network.
With SFML, your application can compile and run out of the box on the most common operating systems: Windows, Linux, macOS and soon Android & iOS.


It is basically .dll files that you include in your project that allows you to render graphics.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Fri Jul 19, 2019 12:43 pm 
Offline
Pro
User avatar

Joined: Tue Apr 22, 2008 2:15 am
Posts: 597
oh neat! Trying to go cross platform or just found it easy to use?


Top
 Profile  
 
PostPosted: Fri Jul 19, 2019 1:46 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
It's mainly easy to use and works well for this project, I dont have any plans to go cross platform for the client.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Sat Sep 14, 2019 9:20 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Posting this here for further info on how to port to .net, I had these notes on my computer so before they get lost I share them:

Quote:
1. Download and install: http://go.microsoft.com/fwlink/?linkid=321343
1.1 Make sure it works on computer without powerpacks installed. Those files should be included in EXE.
2. Needed to put Interop.DxVBLib.dll into my: C:\Windows\SysWOW64 folder!
3. Temporarily added ms symbols (should be able to ignore this): http://www.vbforums.com/showthread.php? ... e-PDB-file
4. Net framework 4 on project.
5. Used this for smooth form transitions: http://vbcity.com/forums/t/158363.aspx (put in my basepage).

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
PostPosted: Tue Nov 02, 2021 7:15 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Robe333.8PERFBettXVIIWindQuenPierAlisNelaPrakDISCSambOrieBlooQuatJoseOpenProjSwisZoneKursRond
SifrRondTramDaliOreaBandCrysEdgaThinPatrDignIrenDefoDomaPhilErneNivePantXVIIAloeJeanTonyCaud
LacaKathBillAlivMercXVIIButcMidiRitoJohnVIIIPeteMariAndrAagePaulIrenVIIINikiSelaMPEGFinimust
ShanLinkKeviGiorXIIIAlfrMidnZoneCircWindRusiZonePetiArtsAlbeSalmSecrLavaZoneChetdarkMakiZone
EarlOlimZoneIntrSwarZoneChetThetXVIIStanZoneMisfMontZoneZoneZoneHenrFyodXVIIRaymHeleDaysLoui
JerrXVIIXVIIEpluOPALRoddBoscHappspraHenrDawnClivChanPETETropVanbPlutFortWarhCalePENNAPLSfolk
YORKEditBeadProSMOXIponyFlooWildTeacRiveLandPhilhappCafeMonAAndrDaviThisOZONFantMornSistHear
SideDragRichForeLouiAdamRudoHenrLocoEditGoogKingJohnDonaValesterJohnDaledetaMicrMichSidnBeau
SethJavaHereSusaJohaGeneHaroInteXVIIKathMaryEccewwwrDaniPetrBertTheoMicrAutoManfWindEpluEplu
EpluPentWindCharLewiReadSomeNazaMuddMagnStevDigivoictuchkasMariKanw


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group