View Full Version : File Access
xergon
11-08-2009, 01:40 PM
Hello,
is it possible to access a certain file on my harddrive every frame update?
Cheers,
Xergi
elmuerte
11-08-2009, 01:56 PM
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?
xergon
11-09-2009, 08:56 AM
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.
elmuerte
11-09-2009, 09:01 AM
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)
Pr0eX
11-09-2009, 01:07 PM
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 (http://aaronash.com/ut3/UT3_UnCodex_v1.3/Source_engine/filewriter.html)
Shambler
11-09-2009, 08:47 PM
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.
fritzmonkey
11-09-2009, 11:16 PM
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?
Pr0eX
11-10-2009, 06:47 AM
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.
Shambler
11-10-2009, 02:20 PM
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.
fritzmonkey
11-10-2009, 03:03 PM
Does that actually work? I haven't seen anything about executing console commands like that.
Solid Snake
11-10-2009, 06:51 PM
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:Console_Commands/Admin_Console_Commands
Shambler
11-10-2009, 07:34 PM
Hey Solid Snake :) ya I'm about, but not nearly as active.
fritzmonkey: Yea it works, though TCPLink is far more preferable.
Powered by vBulletin® Version 4.1.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.