Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - goffrie

Pages: 1 [2] 3 4 5
16
Darwinbots Program Source Code / NSIS-based installer
« on: June 10, 2008, 09:25:23 PM »
Quote
Assuming we did it, though, would it be able to update all the shortcuts to point to the newest version? It's really a pain trying to find the newest version to run from a list of 20 exes in the directory.
It would update just during installation, and I'm pretty sure I could get the shortcut to point to the right executable. I guess I could make a separate automatic update program, although it'd be tied to my installer (for shortcut updating).

17
Darwinbots Program Source Code / NSIS-based installer
« on: June 10, 2008, 09:01:20 PM »
Okay, new version time!

Has Alga Minimalis, Animal Minimalis, Dominator Invincibalis, Excalibur, Republican Bee, and Seasnake 1.0.
It now creates shortcuts on the desktop (always, just one) and in the start menu (there is an installer page for that). It also creates an entry in Add/Remove Programs.
If the uninstaller is unable to remove any files, it will warn the user. If it cannot then delete the folder, it will prompt to recursively delete the folders, and if it still cannot do so, it will ask if it can schedule the deletion for the next bootup. Yay NSIS.
It includes several basic setting files, although none of them include Excalibur because that was added at the last minute and I was lazy
It's been tested a few times (*cough* I've installed/uninstalled around... what, 20 times already? ) although I don't know if the delete-on-reboot works (it is an NSIS option so it should be okay.)

Once again, if you can put the latest version of Darwinbots in a standard place, I can have the installer automatically download it. You can have a zip called 'Darwin.zip' and it can contain the properly versioned .exe and it should be okay.

Hope you like it

[attachment=957:Darwin_setup.exe]
P.S. Go LZMA, 9MB executable -> 2.5MB installer = win

18
Darwinbots Program Source Code / NSIS-based installer
« on: June 10, 2008, 08:21:49 PM »
Okay, I'll use "Darwinbots" then.

I am aware of .set files, although I wasn't too sure what you meant by "my new install does not start a simulation". Anyways, I did add Dominator Invincibalis, and created some basic (more or less tested) .set files. The only problem is that Republican Bee is significantly better at combat than the other bots, so I basically had to rig the settings in favour of the other bot, but it would still usually win in the end.

Also, I get what you mean by the warnings now. I'll see if I can do anything about that.

19
Darwinbots Program Source Code / NSIS-based installer
« on: June 10, 2008, 07:03:26 PM »
Shortcuts have been added to the script (on my hard drive for now.)

Just a question - is the proper capitalization "DarwinBots" or "Darwinbots"? It's been used both ways, so I'm wondering which I should use for paths and such.
Quote
After I click through the dialogs, my new install does not start a simulation, or it starts an empty simulation (hard to tell either way). I would set up some quick settings for the different bots included, so people can load them immediately when they first start the game.
Sorry, I don't really understand you here - what file(s) should be added?
About uninstalling, I already have the "confirm" page, which lists the install directory. What else should I add there?

20
Darwinbots Program Source Code / NSIS-based installer
« on: June 10, 2008, 07:32:11 AM »
Nobody wants to comment?

21
Darwinbots Program Source Code / NSIS-based installer
« on: June 07, 2008, 07:09:41 PM »
I created an NSIS-based installer for Darwinbots 2.43.1L. It currently installs all the OCX's installed by the original installer as well as msstdfmt.dll (needed for the custom costs dialog), and registers them all. It does not install comdlg32.dll, which is usually already present. If it should be added, tell me. Currently the installed bots consist of Alga Minimalis, Animal Minimalis, Seasnake, and Republican Bee. If you want to recommend any example bots, then do so

I tested it on a brand-new Windows XP SP2 install (hosed my old VirtualBox image thanks to a lack of disk space when merging a snapshot) and it seems to work mostly fine, although for some reason the Settings directory didn't seem to get created (it's in the script though as a recursive copy, although with only default.set).

If you were to make a consistent way of downlloading the newest Darwinbots executable (I.e. in a single place which doesn't change between versions), I could make the installer download the newest version during the installation, using NSISdl. ZIP decompression is also supported in NSIS so that isn't a problem.

The installer is internally compressed with solid LZMA compression so don't bother compressing it again.

(edit: new installer below)

Oh, and here is the NSIS script. It'll need some adjusting to work on Windows since I use it on Linux and it is using Unix-style paths.

Right now, it doesn't uninstall any of the DLLs/OCXs which it installs. If that's an issue I can still add the removal to the uninstall code, but I'd have to add more registry keys to remember whether or not it existed before the installer ran.
Code: [Select]
!include MUI2.nsh
!include VB6RunTime.nsh

Name "DarwinBots 2.4"
OutFile "Darwin_setup.exe"
InstallDir "$PROGRAMFILES\DarwinBots"
InstallDirRegKey HKCU "Software\DarwinBots" ""
RequestExecutionLevel admin
BrandingText " "
XPStyle on
CRCCheck on
SilentInstall normal
SetCompressor /SOLID lzma

Var AlreadyInstalled

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

Section "Install" Install
  SetOutPath "$INSTDIR"

  File "/home/goffrie/Darwinbots/DarwinBotsII/Darwin.exe"
  File "/home/goffrie/Darwinbots/DarwinBotsII/How to setup a DarwinBots server.txt"
  SetOverwrite off
  File "/home/goffrie/Darwinbots/DarwinBotsII/intsett.ini"
  File /r "/home/goffrie/Darwinbots/DarwinBotsII/Robots"
  File /r "/home/goffrie/Darwinbots/DarwinBotsII/Settings"
  SetOutPath "$INSTDIR\Autosave"
  SetOutPath "$INSTDIR\Saves"
  SetOutPath "$INSTDIR\Transfers"
  SetOutPath "$INSTDIR\Transfers\F1"
  SetOutPath "$INSTDIR\Transfers\F1\in"
  SetOutPath "$INSTDIR\Transfers\F1\out"

  SetOutPath "$SYSDIR"

  File "/home/goffrie/Darwinbots/OCX/*.OCX"
  RegDLL "$SYSDIR\COMCT232.OCX"
  RegDLL "$SYSDIR\COMDLG32.OCX"
  RegDLL "$SYSDIR\MSCOMCTL.OCX"
  RegDLL "$SYSDIR\MSINET.OCX"
  RegDLL "$SYSDIR\RICHTX32.OCX"
  RegDLL "$SYSDIR\TABCTL32.OCX"
  File "msstdfmt.dll"
  RegDLL "$SYSDIR\msstdfmt.dll"
  SetOverwrite on

;Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"

;Store installation folder
  WriteRegStr HKCU "Software\Darwinbots" "" $INSTDIR

;Install VB runtime
  IfFileExists "$INSTDIR\Darwin.exe" 0 new_installation
    StrCpy $AlreadyInstalled 1
  new_installation:

  !insertmacro VB6RunTimeInstall /home/goffrie/Darwinbots/vb6 $AlreadyInstalled
SectionEnd

Section "Uninstall"

  Delete "$INSTDIR\Darwin.exe"
  Delete "$INSTDIR\How to setup a DarwinBots server.txt"
  Delete "$INSTDIR\intsett.ini"
  Delete "$INSTDIR\Uninstall.exe"
  Delete "$INSTDIR\Robots\Alga_Minimalis.txt"
  Delete "$INSTDIR\Robots\Animal_Minimalis.txt"
  Delete "$INSTDIR\Robots\Gridlock.txt"
  Delete "$INSTDIR\Robots\Republican_Bee.txt"
  Delete "$INSTDIR\Robots\Seasnake_1.0.txt"
  Delete "$INSTDIR\Settings\default.set"
  RMDir "$INSTDIR\Autosave"
  RMDir "$INSTDIR\Robots"
  RMDir "$INSTDIR\Saves"
  RMDir "$INSTDIR\Settings"
  RMDir "$INSTDIR\Transfers\F1\in"
  RMDir "$INSTDIR\Transfers\F1\out"
  RMDir "$INSTDIR\Transfers\F1"
  RMDir "$INSTDIR\Transfers"
  RMDir "$INSTDIR"
  DeleteRegKey /ifempty HKCU "Software\Darwinbots"

;Remove VB runtime
  !insertmacro VB6RunTimeUnInstall
SectionEnd

Gah, another thing I forgot to mention: It doesn't install any shortcuts, I forgot to add it in. I'll put it in... later

22
Darwinbots3 / P2P Internet Mode
« on: June 01, 2008, 08:47:27 PM »
Quote from: Numsgil
Ooh, neat, I think this will work.  Why does the data need to be coded in base 64, though?

  Gah, you're supposed to use urlencode (with the %hexnumber goodness). The code I "post"ed (haha) doesn't handle this automatically, though, so you'll have to do it manually. I found this VB function at http://www.csie.nctu.edu.tw/~cdsheen/codin...b-urlencode.php :
Code: [Select]
<pre><font><font face="Georgia">Function UrlEncode(ByVal urlText As String) As String
     Dim I As Long
     Dim ansi() As Byte
     Dim ascii As Integer
     Dim encText As String
 
     ansi = StrConv(urlText, vbFromUnicode)
 
     encText = ""
         For I = 0 To UBound(ansi)
         ascii = ansi(I)
 
         Select Case ascii
         Case 48 To 57, 65 To 90, 97 To 122
             encText = encText & chr(ascii)
 
         Case 32
             encText = encText & "+"
 
         Case Else
             If ascii < 16 Then
                 encText = encText & "%0" & Hex(ascii)
             Else
                 encText = encText & "%" & Hex(ascii)
             End If
 
         End Select
     Next  I
    
     UrlEncode = encText
End Function

Using this function, you don't need base64 anymore (d'oh), so remove the "base64_decode" line.

23
Darwinbots Program Source Code / What does the 2.1 installer install?
« on: June 01, 2008, 06:11:40 PM »
Nobody knows what the installer does?  

24
Darwinbots3 / P2P Internet Mode
« on: June 01, 2008, 06:04:57 PM »
Quote from: Numsgil
Hmm...  so bear with me if this is a stupid question.  I know some data can be embedded in the url (such as the forum url: index.php?showtopic=2808).  And other data can be sent behind the scenes, not in the URL.  For instance, when I write a really long, almost novel-like, post, all that text seems to get embedded in the stream somehow.  I think the two different types are called POST and GET, IIRC.  So... on the VB (or C#) side of things I can convert a file I want to upload in to a binary data stream.  Let's say, for the sake of argument, that the data stream is about 3MB large.  How would the web server running the PHP script expect to get that data?  What would the PHP script look like that took that data and saved it to a file somewhere?

Data embedded in the URL is GET data, and the data embedded "behind the scenes" as you put it is POST data.
Your 3MB data stream would be sent via POST "behind the scenes", and then the PHP script would receive it like this:
Code: [Select]
   <?php
   if (!isset($_POST['data'])) die("No data sent via POST!");
   $data = trim($_POST['data']); // now $data contains the encoded data - "trim" removes any excess spaces, newlines etc. around it
   $data = base64_decode($data); // assuming base64 encoding, $data now has the binary data. PHP is binary-safe in general but some functions aren't
   $file = @fopen('files/'.time().'.dbo', 'w'); // now open files/(current UNIX timestamp) for writing ('w'). time() returns an integer but it is implicitly converted to a string. the @ suppresses errors
   if (!$file) die("Error opening file ".time().".dbo for writing!"); // error checking
   fwrite($file,$data) or die("Error writing file!"); // write the binary data to the file. the 'or die("")' syntax is quite common for easy error checking, I could have used it for $file but meh
   fclose($file); // close the file. not mandatory
   ?>
This PHP script would take base64 encoded data from the POST stream as the "data" variable (like "data=encodeddata"), decode it, and write it to "files/(time).dbo". Of course, this script would have problems with multiple files being uploaded in the same second - a different file scheme would fix that.
A shortened version (it generates a few warnings/notices on error):
Code: [Select]
<?php
 fwrite(fopen('files/'.time().'.dbo','w'),base64_decode(trim($_POST['data']))) or die("Failed!");
 ?>

25
Darwinbots3 / P2P Internet Mode
« on: June 01, 2008, 11:28:12 AM »
Quote from: Numsgil
Magic lawn leprachauns.  You ask for the file you want to download, and they use their magic to force their way in to a parallel dimension where I already have the file.  They then murder than alternate me, and steal his computer's hard drive.  Using their magics they teleport the bits from the stolen hard drive to my own.  And voila, I have the file I wanted to download


Quote from: Numsgil
Well, let's ignore the whole VB thing for a moment.  If this were for a web site, and we wanted someone to click on a link that would automatically upload a certain file, how would that work?
It wouldn't - you can't force a user to upload a file without using client-side things like Javascript (and even then I don't think that would work.) Basically, it poses too much of a security risk to work.
The VB part comes in because you need to voluntarily put the data stream into the request.

Hmm, I found this information for VB6:
Quote
The transaction with Google happen via HTTP POST requests. There is a control available in VS6 that allows you to perform these simply; the Microsoft Internet Transfer Control. It is basically a wrapper around the WinInet Windows API, making it nice and easy to use. To add this to your project, start a new standard .exe project in VB6. Go to the Project menu, then Components and pick the "Microsoft Internet Transfer Control". Click OK, and a component will be added to the components toolbox ready for use. Drop one of these onto your form.

(...)

In Visual Basic, you can do it as below this. Imagine Inet1 is the  name of the Internet Transfer Control you added above, and your email  address, password and application ID are stored in the string variables  "myEmail", "myPassword" and "mySource". Note the use of the  form-urlencoded Content-Type header.  
Code: [Select]
   strURL = "https://www.google.com/accounts/ClientLogin"
   strFormData  = "Email=" & myEmail & "&Passwd=" & myPassword &  "&source=" & mySource & "&service=cl"
   strHeaders = "Content-Type:application/x-www-form-urlencoded"
   Inet1.Execute strURL, "POST", strFormData, strHeaders
Your application needs to wait for Google to respond. Do this by  looking out for the icResponseCompleted event in the Inet1_StateChanged  event handler. When it does, store Google's reply in a variable, e.g.:

Code: [Select]
vtData = Inet1.GetChunk(1024, icString)
   </p>  <div class="codeblock"><code>      Do While LenB(vtData) > 0
           outputString = outputString + vtData      
            ' Get next chunk.
            vtData = Inet1.GetChunk(1024, icString)
         Loop      
      Response = outputString</code></div>


I suppose you could use this code (replacing the strFormData with "data=some-encoded-form-of-dbo" and the strURL to an appropriate address) to send a file to the server. On the server side, in PHP, $_POST['data'] would contain the encoded data.

26
Darwinbots3 / P2P Internet Mode
« on: May 31, 2008, 08:55:05 PM »
Quote from: EricL
there are serious security issues to overcome in such an architecture depending upon the protocol and the means by which the P2P communication is acheived.  Anytime you start running server code (meaning code that listens for new requests on a port and performs work based on those requests) on clients, you open up a serious security can of works not to mention isuses with NATs and firewalls, etc.
Security issues perhaps are a problem, but they are only moderately severe as long as code is kept well-managed. Issues with NATs can be overcome by relaying through the central server.

Quote
People should not confuse the client connectivity topology we choose to use with transport latency issues or with the connectivty problems inherent in the current FPT-based design.  The current FTP based thing is problematic to be sure, but the connectivity problems are not inherent problems with the design.  Those can be fixed by moving to a more reilable server and moving the server communication code out of proc, both of which I am working on (using in part, some code from Nums).
I'm not talking about latency issues or connectivity problems, I'm just talking about a peer-to-peer system. Moving to a more reliable server would help with thse issues, though, which is definitely appreciated.
"moving the server communication code out of proc" - I'm not too sure what you meant by this.
 
Quote
But we will reach scalability limits on the current architecture.  Understand, there is no real server today.  No server that is, other than the FTP server itself.
Which is a real server.

Quote
There is no code authored by me running on any machine except the client simulators each of us run. They cooperate through the FTP server by moving files, but in an incredibly ineffecient manner becuase they are forced to shoe horn their semantics into file movements and the semantics of the FTP protocol.  Some poeple call this a shared-file or file-sharing version of cleint-server.  Early corporate email systems (circa 1990) such as CC:Mail and Mcirosoft Mail used this archtiecture.   It is not true client-server (like POP/SMTP).  Were we to move to a true client-server model where we had special code runnnig on a server, implimenting our specific semantics, we could easily scale to several thousand sims connected through a single server.  Buidling this on top of HTTP or PHP or sockets or whatever is mostly a discussion of ease of implimentation.  The result is the same, a true cleint-server architecture. Scaling beyond that would require mutliple servers with connection logic or partitioning or a P2P architecuture.
... Why the lecture? I don't see what point you're trying to make.

Quote
As a followup to my last post... There are there any problems having the download script save data to disk? If there is, is it possible to embed binary data in the HTTP the PHP script returns? If that wouldn't work either, an text based organism file would probably be possible. I know for sure that would work...
Yes, you can put binary data into an HTTP stream - how do you think binary downloads work?

Quote
Which leaves uploading the file, which is where I don't know how to proceed.
Neither do I, since I'm not familiar with VB.

27
Darwinbots3 / P2P Internet Mode
« on: May 30, 2008, 07:45:09 AM »
Not quite, POST data is like GET data (which is in the URL) but it goes after the request headers. No idea how to do that in VB or C#, though.
You might be able to encode the data in the URL, but the web server would probably reject it as a buffer overflow attack, (or the server would have a buffer overflow).

28
Darwinbots3 / P2P Internet Mode
« on: May 29, 2008, 09:41:31 PM »
You can't really tell the web client to upload a file like that. (It would be nice though ) You need to read the file and upload it as POST data, like "data=buibtuisnuiremhtr5398nf9324==" (base64 encoded or otherwise made 7-bit friendly). Then you could download the file from the server. I don't know if it's possible in VB, but it's almost certainly doable with C#.

29
Darwinbots3 / P2P Internet Mode
« on: May 29, 2008, 09:03:14 PM »
Hmm, I'm pretty good with PHP  
It definitely is possible, using HTTP POST with multipart/form-data. It could even work with ordinary POST (that wouldn't work with a web browser though). If you wanted, I could cook up a PHP script which would handle organism uploads. I have no idea how you would interface it with Darwinbots though, and you'd have to tell me where to store the files  .

Another thought, for P2P, perhaps it could interface with Tor and hidden services? That would solve any problems with NATs (firewalls would still be a problem though). It would be pretty finicky(sp?) and slow though.

30
Darwinbots3 / P2P Internet Mode
« on: May 29, 2008, 08:34:00 PM »
It would be nice if there was a peer-to-peer network of sorts for Internet Mode in Darwinbots3, in which all capable clients would be able to connect to each other directly. Of course, there would still be a central server, but it would reduce the load on the central server, and a relay system could be set up to allow clients behind firewalls to connect to IM (maybe falling back to FTP). It would also be possible this way to have relatively real-time organism exchanges, as the server could tell the clients when a new organism was available and clients could download it as soon as they were told (the server could randomly choose a client to give it to). If the Darwinbots server can't run custom protocols, it could probably be managed over HTTP. The protocol itself should be fairly trivial, as it does not need to support a lot of features (maybe just compression), and efficiency is not a major issue. The only issue I see with this is that many people run behind routers and the system does not really work that way .

Of course, as Darwinbots3 is still early in development, it's not really time just yet to be implementing these kinds of things, but it's just an idea .

Pages: 1 [2] 3 4 5