Author Topic: Need a mod for IM  (Read 755 times)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Need a mod for IM
« on: January 29, 2014, 01:29:16 PM »
I know no one is currently working on IM, but I do need a mod for it already.
I would need a separate IM folder for robots in normal simulations and separate IM folder (or distribution process) for robots in ecosystem survival evolution. I have been considering all other ways to avoid mixing this robots. I can restrict mixing in newer versions of the program. However, due to the backwards compatibility of a (working) IM I have no other choice but to separate the process. Thank you for your consideration.



What is going on with IM Shasta?

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Need a mod for IM
« Reply #1 on: January 29, 2014, 01:50:21 PM »
I would think all that's needed is a ftp server and clients placed with DB2. That shouldn't be too hard, but likely less feature rich than what would be the old solution.
Oh my god, who the hell cares.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7709
    • View Profile
Re: Need a mod for IM
« Reply #2 on: January 29, 2014, 06:03:24 PM »
I think the idea of using a separate program to manage the uploading/downloading is a good idea, like Shasta and Ammeh were playing with.  DB2 could just save and grab bots from its in/out folders and leave the managing of the server architecture to something else.

The main difficulty here is that DB2 gets angry if another program attempts to delete or use a file it's currently reading or writing.  The first step in getting this to work is for the routines that save bots to in/out folders to check if a file is currently in use by the operating system before trying to read or write to it.  I don't know how hard that is in VB6.  Assuming you got the program to play nice with file handles, writing the app that shares robot files isn't too hard, especially since a lot of the work is currently done already in the C# app in the repository.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Need a mod for IM
« Reply #3 on: January 30, 2014, 11:16:07 AM »
Numsgil, I have created this little program called "LocalIM", and it seems to work fine:

Code: [Select]

Imports System.IO
Public Class Form1
    Dim infolder As String
    Dim outfolder As String

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim strFileSize As String = ""
        Dim di As New IO.DirectoryInfo(outfolder)
        Dim aryFi As IO.FileInfo() = di.GetFiles("*.*")
        Dim fi As IO.FileInfo

        Dim fir(0) As String
        For Each fi In aryFi
            fir(UBound(fir)) = fi.Name
            ReDim Preserve fir(UBound(fir) + 1)
        Next
        Dim mf As String = fir(UBound(fir) * Rnd())
        Try
            IO.File.Move(outfolder & "\" & mf, infolder & "\" & mf)
        Catch ex As Exception
        End Try
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim c As Byte
        For Each p As Process In Process.GetProcesses
            If p.ProcessName = "DarwinBotsIM" Then
                c = c + 1
                If c = 2 Then End
            End If
        Next
        ' ''-in "C:\in" -out "C:\out" -name Newbie 5676 -pid  4404
        Dim sp() As String = Split(Command, """")
        infolder = sp(1)
        outfolder = sp(3)
        Randomize()
        Application.DoEvents()
        Timer1.Enabled = True
    End Sub

End Class


I call just move the file only after it is done writing.
edit: .net is smart enough not to move a file that is currently writing based on my experience, so we don't really need to worry about file access as long as we are moving files.
« Last Edit: January 30, 2014, 11:37:35 AM by Botsareus »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Need a mod for IM
« Reply #4 on: February 07, 2014, 12:39:08 PM »
Very sloppy programing for IM found:

Who wrote the loadRobot code? You declare a filenumber, then you completely do not use it and pass a 1 to loadrobotbody? V8 for you!

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Need a mod for IM
« Reply #5 on: February 07, 2014, 12:53:14 PM »
Rofl, file continue of all places?! Eric who is the poor programer now? (Same error as above)

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Need a mod for IM
« Reply #6 on: February 07, 2014, 01:13:00 PM »
File continue?
Oh my god, who the hell cares.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Re: Need a mod for IM
« Reply #7 on: February 07, 2014, 01:15:37 PM »
It is a binary file search code to make individual robots reverse compatible without completely screwing up the save simulation code.