Results 1 to 12 of 12

Thread: File Access

  1. #1

    Default File Access

    Hello,
    is it possible to access a certain file on my harddrive every frame update?

    Cheers,
    Xergi

  2. #2
    Redeemer
    Join Date
    May 2000
    Location
    between the monitor and chair
    Posts
    1,523

    Default

    There is no real I/O support exposed in UnrealScript.
    Also, you don't want to do something very slow like I/O every frame.

    What are you trying to do?
    Michiel 'El Muerte' Hendriks
    Magicball Network - Little Big Adventure community
    the Unreal Admin page - Unreal server administration
    UnrealWiki - UnrealScript and UnrealEd wiki.
    UnCodeX - powerful UnrealScript tool for programmers

  3. #3

    Default

    I´m trying to get input data (maybe 16 bytes every frame) from a tracking application like max or vvvv into UDK.

    Using TCP Socket access might work, but I´m looking into a more simple alternative to this.

    -> vvvv writes data into a file on a ramdisk, UDK should read this data every few frames.

  4. #4
    Redeemer
    Join Date
    May 2000
    Location
    between the monitor and chair
    Posts
    1,523

    Default

    TCPLink is the only possible method. Because all files used by the engine (i.e. configuration files) are cached in memory. Thus updating those files as no effect in game. Also, passing the data through the TCPLink is much faster than using file i/o (even if using a ramdisk)
    Michiel 'El Muerte' Hendriks
    Magicball Network - Little Big Adventure community
    the Unreal Admin page - Unreal server administration
    UnrealWiki - UnrealScript and UnrealEd wiki.
    UnCodeX - powerful UnrealScript tool for programmers

  5. #5

    Default

    There is actually support for file writing! Although you are very stricted but its verly well possible using the FileWriter - class

    /**
    * Copyright 1998-2009 Epic Games, Inc. All Rights Reserved.
    *
    * This is a simple class that allows for secure writing of output files from within Script. The directory to which it writes
    * files is determined by the file type member variable.
    */

    class FileWriter extends Info
    native;
    source

  6. #6
    Redeemer
    Join Date
    Sep 2002
    Location
    Ireland
    Posts
    1,143

    Default

    You could add a console command (e.g. named DoSomething) for retrieving the information, then externally modify a file in the Binaries folder, named ConsoleCommand.txt, like so:
    DoSomething Data

    Then ingame, call 'exec ConsoleCommand.txt' to retrieve the information in the file through the 'DoSomething' console command.
    This will be very slow (especially for each tick), so you should use the TCPLink stuff instead.

  7. #7
    MSgt. Shooter Person
    Join Date
    Apr 2009
    Posts
    102

    Default

    Quote Originally Posted by Shambler View Post
    You could add a console command (e.g. named DoSomething) for retrieving the information, then externally modify a file in the Binaries folder, named ConsoleCommand.txt, like so:
    DoSomething Data

    Then ingame, call 'exec ConsoleCommand.txt' to retrieve the information in the file through the 'DoSomething' console command.
    This will be very slow (especially for each tick), so you should use the TCPLink stuff instead.
    I don't understand what you are saying here. How does creating a console command make it possible to read data through UScript?

  8. #8

    Default

    Quote Originally Posted by fritzmonkey View Post
    I don't understand what you are saying here. How does creating a console command make it possible to read data through UScript?
    I think what he is really trying to say is:

    1.) Build a program listening for TCP inbound (I recommend using C# on windows, fast and easy development, also you could use any other programming language with a TCP interface). Here you can access a DB, File-System or any other resource you need.
    2.) Implement a class extending from TCPLink communicating with your program you created in 1.) (this step goes in UScript)
    3.) Create a (exec) function to call your class created in 2.) (also Uscript)

    this should do it.

  9. #9
    Redeemer
    Join Date
    Sep 2002
    Location
    Ireland
    Posts
    1,143

    Default

    Well, no that's not quite what I meant, I didn't explain it very well I guess; describing again:
    An external program can modify ConsoleCommand.txt with the data it wants to pass on to UScript, and ingame the script can call the command 'exec ConsoleCommand.txt' to grab the data inside ConsoleCommand.txt.

    What happens when 'exec ConsoleCommand.txt' is called, is the game executes the information in that file as console commands, so you can route the data put in that file through a console command ingame, and grab it that way.

  10. #10
    MSgt. Shooter Person
    Join Date
    Apr 2009
    Posts
    102

    Default

    Does that actually work? I haven't seen anything about executing console commands like that.

  11. #11
    Palace Guard

    Join Date
    Jun 2007
    Location
    Christchurch
    Posts
    3,513

    Default

    Hey Shambler! Long time no hear. Good to see you're still around in the Unreal world.

    This technique goes all the way back to the original Unreal Tournament. Haven't seen it used for quite some time.

    http://wiki.beyondunreal.com/Legacy:...nsole_Commands

  12. #12
    Redeemer
    Join Date
    Sep 2002
    Location
    Ireland
    Posts
    1,143

    Default

    Hey Solid Snake ya I'm about, but not nearly as active.

    fritzmonkey: Yea it works, though TCPLink is far more preferable.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.