Post news RSS GreenDuck Prototyping

Introduction OLG is breaking ground with its unique sov. mechanics. It will allow player clans to own systems, the benefits of which are:

Posted by on

OLG is breaking ground with its unique sov. mechanics. It will allow player clans to own systems, the benefits of which are:

  • NPCs patrol for your enemies on behalf of your faction (NPCs are customized by the faction leader).
  • You can build stations and gates and determine who gets access to them.
  • You can do "improvements" on planets in the system such as terraforming to build bases there.
  • You can use stations to do "research" on new guns (the guns cost based on the percentage of improvement over the base model).

But FLServer does not readily support this, and neither do FLHook or FLShell. Solution? Write a new server guard to implement player owned systems in Freelancer.

Primer: Claiming a system
First of all it is important to know how systems will be claimed. First of all, there will be a commodity added for every system, such as "tau ceti sov point", and special depots will be placed that can be destroyed throughout their respective system.

Then players will shoot the depots to get the points (there will be several depots per system) and the points each clan has will be summed up and the clan with the most for that system gets it. Then the points they collected are destroyed.

When control flips, special predefined NPC patrols will be altered to be the clan's faction (clans will have factions so that they can declare war on each other). So, the NPCs help secure the system.

Also, I am implementing the ship loss penalties: if you die you respawn in a basic startracker, creating real losses!

How?! How?!!!! HOW!

The Solution: GreenDuck. GreenDuck is a server tool I have begun writing to manage all this stuff. I have already started writing it in Visual Basic. The picture above is labeled, follow the labels to see what GreenDuck will do at each stage.

  1. When Executed, GreenDuck will load in all the server side player saves and convert them to plain text. Then it will parse them and look for commodity identifiers. It will sum up the points and determine clan using my server's forced clan naming convention (=CLANTAG=|Name).
  2. It removes the commodities in question from the players, and alters the Server side freelancer DATA folder to change player built station/jumpgate as well as clan NPC patrols to the winner.
  3. GreenDuck then packages the parts of DATA that define these things into a FLMOD. It then sends it to an FTP server.
  4. Client versions of GreenDuck check for updates when Freelancer is launched. They will download and apply patches from the FTP server.
  5. The player connects to the server.

What has been written so far?
So far, with the help of flcodec.exe, the decoder for the player files has been written.

Imports System.IO

Public Class fIO
    'Controls the loading and saving (and conversion) of data so that this program can analyze it.
    Public Sub decodeSaveFiles(ByVal indir As String, ByVal outdir As String)
        'backup the FLServer folder
        Catch ex As Exception
        End Try

        My.Computer.FileSystem.CopyDirectory(indir, "C:\.greenDuckBackup", True)
        Dim tmpFList As String = ""
        'declare the final input and final output
        Dim commandInFileList() As String
        Dim commandOutFileList() As String
        'first get the sub folders
        Dim count As Integer = 0
        Dim dir As String = "temp"
        Dim dirs() As String = Directory.GetDirectories(indir)
        Dim subfolders(dirs.Length) As String
        For Each dir In dirs
            count = count + 1
            subfolders(count) = dir
        'then create the needed directory structure in outdir
        For u As Integer = 0 To dirs.Length - 1
            dir = dirs(u)
            'MessageBox.Show(dir, dir, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            Dim tmpFolders() As String
            tmpFolders = dir.Split("\")

            Dim finalFolder As String = outdir + "\" + tmpFolders(tmpFolders.Length - 1)
            'MessageBox.Show(finalFolder, dir, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Catch ex As Exception
                'Nothing it works, it throws a random exception for no reason
            End Try

            'so we need to analyze each subdirectory and create each sub director first
            Dim files As String = ""
            Dim fileList() As String = Directory.GetFiles(finalFolder)

            fileList = Directory.GetFiles(dir)
            For x As Integer = 0 To fileList.Length - 1
                tmpFList = tmpFList + fileList(x) + "~"
            'and finally, delete the folder
            Dim fso As New Scripting.FileSystemObject
        'parse the file list
        commandInFileList = tmpFList.Split("~")
        commandOutFileList = commandInFileList
        For r As Integer = 0 To commandInFileList.Length - 2
            Dim tmp() As String = commandInFileList(r).Split("\")
            'merge the last 2, they are the folder and the file
            Dim finalFile As String = tmp(tmp.Length - 2) + "\" + tmp(tmp.Length - 1)
            'we can take that and smack it onto the end of the final folder!
            commandOutFileList(r) = outdir + "\" + finalFile

        'restore the folder
        My.Computer.FileSystem.CopyDirectory("C:\.greenDuckBackup", indir, True)
        My.Computer.FileSystem.CopyDirectory(indir, outdir, True)
        'then we need to run the flcodec command in each of them
        Dim cmdLocation As String = "C:\greenDuckEXE\flcodec.exe"
        For a As Integer = 0 To commandOutFileList.Length - 2
            commandInFileList = tmpFList.Split("~")
            'do the command
            Dim cmd As String = cmdLocation + " -d " + commandOutFileList(a) + " " + commandOutFileList(a) + ".txt"
    End Sub
End Class

This code parses the server side saves into plain text for other parts of the program to use. It works, and is currently in the GUI as "Decode Player Files". This class will be used many times in the parsing process.

This is an ambitious project, and I hope it will work. Joining clans will be mandatory after level 10 and FLShell or FLHook's /rename function will be used. IONCROSS will be used to automate server reboots and cheat detection.


So is this finally gonna be full online capable?

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.