.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Cyborg Factory > United Bot
United Bot The ultimate beast is being given birth right here! Half-Life 2

Reply
 
Thread Tools
Unreal engine driver communication
Old
  (#1)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Unreal engine driver communication - 08-04-2004

I thought it would be good to open a thread to solve the question of the Unreal engine driver communication.

The problem: Unreal engine is only accessible through UnrealScript, a proprietary scripting (hence interpreted) language that doesn't allow native C++ code communication - unless you buy a license from Unreal.

Two solutions so far:

1. - Use loopback network communication through a third party sockets library available to use for UnrealScript (slow)
2. - As suggested by botmeister, use local disk I/O access and reading/writing through a temporary file for inter-process communication.

*edit* a summary of the previous discussion can be found in this thread:
http://forums.bots-united.com/showthread.php?t=1299

Discussion:



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 08-04-2004 at 16:25..
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#2)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Unreal engine driver communication - 08-04-2004

Does unrealscript allow the address-of operator (&)?
If so, just make a global variable of a structure containing game data and write the address once to a file for reading by the c++ driver.

Once you have the address you should be able to use ReadProcessMemory and WriteProcessMemory on a similar structure ( with all offsets correct ) written in C or C++.

I have not done that much reading on unrealscript so I don't know if their virtual machine uses the actual addresses of objects or if it has it's own memory system.

I guess I'll install UT and check out some more options.
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#3)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Unreal engine driver communication - 08-04-2004

That is a nice idea... I'll check it out (gotta edit this post as soon as I have the answer)

*edit*
hmmm, visibly not... no pointers, no address referencing in UnrealScript.

UnrealScript overview (official doc): http://unreal.epicgames.com/UnrealScript.htm


*edit 2*
Crazy idea then...
tag this structure with an unique magic number (long enough to be REALLY unique), and have the bot core scan the OS memory for that fingerprint. Once it finds it, it knows the address of the struct.

Feasible ?

Anyway, the problem is still half-solved, because it'll only be a one-way communication.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 08-04-2004 at 15:48..
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#4)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Unreal engine driver communication - 08-04-2004

That could work and you could also have two-way by doing something like this...

Force Unreal to load a helper dll.
Call GetModuleHandle( NULL ) from the unreal engine to get the program in memory.
Search for the structure ( with unique id at offset 0 ).
Using shared memory, give the pointer to the data to the c++ driver.

Virtual machines are useful and they have obviously done a nice job with UnrealScript, but forcing it on people is not the right way to go. It's too bad that we cannot use a regular dll.

Edit:
Where were you looking?
I saw what looks like an address-of operator somewhere, there was a function somewhere that had the & operator on a parameter.

Added:
Code:
void Touch(class AActor* Other)
{
	FName N("Touch",FNAME_Intrinsic);
	struct {class AActor* Other; } Parms;
	Parms.Other=Other;
	ProcessEvent(N,&Parms);
}
There it is, I'm not sure but here & looks like an address-of operator.
If not, damn.

Last edited by Lazy; 08-04-2004 at 16:17..
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#5)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Unreal engine driver communication - 08-04-2004

Damn interesting! But weird? What is the URL where you found that piece of code ? It *looks* like UnrealScript indeed...

How come I have seen that nowhere mentioned in the UnrealScript reference pages at epicgames.com ???

*edit*
hmm, no, to me it would rather look like a C++ piece of code from an Unreal game DLL...
UnrealScript doesn't know the keywod "void" AFAIK.
Somehow I wish I had an Unreal copy to install and toy around with. Botman or someone else may be able to tell us more than I presently can.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 08-04-2004 at 16:33..
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#6)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: Unreal engine driver communication - 08-04-2004

It is at the website you posted the link to, I just did a find for &.
Surprisingly, there were only a couple of hits despite the large amount of text which made it easy to find.

Edit:
Bah, I never saw that part where it mentioned it was C++ code.
I simply skipped over the line by mistake, I usually make my screen grey
when reading important text but I was probably too tired to think of it.

Looks like we'll have to inject some code to get the same result, shouldn't be too hard but the method I use only works on 2K/XP so another set of injection functions will have to be written.

Unless someone has a better idea...

Last edited by Lazy; 08-04-2004 at 16:40..
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#7)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Unreal engine driver communication - 08-04-2004

UnrealScript doesn't have pointers to memory addresses. Thus you can't read/write to a memory buffer with UnrealScript.

Yes, the Touch() code Lazy posted is C++ native code which can't be compiled without all the engine .h header files (needed for the member variables and functions in the C++ classes) not to mention needing the .lib libraries to resolve engine functions.

If we plan on using UnrealScript to control a bot, I think the only external interface will be via a TCP/IP socket through the loopback interface to another application running on the same host.

The biggest disadvantage for Unreal will be not being able to get world geometry information (which would be needed to generate navigation meshes). You can do ray traces through the world using UnrealScript and you can search the world for nearby objects (like other players or weapons), but that's about the limit of what can be obtained about the world.

Navigation will probably have to depend on waypoints (which is what UT2k3/2k4 already uses, called PathNodes and NavigationPoints).

UT2k3 can be found for pretty cheap here in the USA...

http://www.walmart.com/catalog/produ...00000000624060

So you might want to pick yourself up a copy if you don't already have it. Once you install the latest patch (available from the Epic website), you won't be required to have the CD available to run the game.

I'll make a new thread with some Unreal coding links that I have found and maybe that will help people investigate it a little more.

botman
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#8)
FrostyCoolSlug
Member
 
FrostyCoolSlug's Avatar
 
Status: Offline
Posts: 318
Join Date: Mar 2004
Default Re: Unreal engine driver communication - 10-04-2004

Have we concidered trying to find a way to reverse engineer the Unreal engine? I'm not sure if this is legal (probably not), but if it is, it could be useful.


=====
Craig "FrostyCoolSlug" McLure
Network Administrator of the ChatSpike IRC Network
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#9)
botmeister
Ex-Council Member
 
botmeister's Avatar
 
Status: Offline
Posts: 1,090
Join Date: Nov 2003
Location: Canada
Default Re: Unreal engine driver communication - 12-04-2004

Quote:
UnrealScript doesn't have pointers to memory addresses. Thus you can't read/write to a memory buffer with UnrealScript.
Botman, can UnrealScript allocate memory buffers?

If so, then we could determine the address of the buffer by having Unreal populate it with a very unique pattern.

The external C++ driver can scan memory looking for the unique pattern, once found we'll have the address of the allocated memory buffer.

Some simple handshaking can be done to coordinate the process and confirm the memory location (using simple file sharing methods for example).

*edit*

Since Unreal cannot work with pointers, what I mean by "memory buffer" is the allocation of a character array or something similar.


Maker of the (mEAn) Bot.Admin Manager

"In theory, there is no difference between theory and practice. But, in practice, there is." - Jan L.A. van de Snepscheut

Last edited by botmeister; 12-04-2004 at 00:51..
  
Reply With Quote
Re: Unreal engine driver communication
Old
  (#10)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Unreal engine driver communication - 12-04-2004

Yes, that's exactly what I was saying. It would still leave one half of the problem unanswered, because it'll be a one-way means of communication (unless we do some real-time polling... I dunno... that would need to be tested but I'm perhaps not the guy to ask to, my coding experience in inter-process communication is near zero).



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com