Author Topic: BLG and AGI Studio  (Read 8518 times)

0 Members and 1 Guest are viewing this topic.

Offline Joel

BLG and AGI Studio
« on: April 25, 2002, 02:45:25 PM »
If we want to decide on some kind of standard command line to call the Base Logic Generator from AGI Studio so that the two can communicate, I think that would be cool. I'm thinking something like:

AGIBLG -i

to indicate that the program is being run in an integrated context and that it should behave appropriately (e.g, close automatically when files are generated, not save options such as whether the program should write to a file or to the clipboard, etc.). Of course the integrated behavior would also be customizable. It would be a simple matter to have the program return different values based on whether the user generates a file or cancels the operation.

Any other options that should maybe be included?

Of course, a communication interface would need to be defined. The clipboard is one possibility (the code for writing to the clipboard is already written, after all). Any other ideas?



Offline Nick Sonneveld

Re:BLG and AGI Studio
« Reply #1 on: April 25, 2002, 06:22:30 PM »
How about pipes you could redirect pipes to and from agi studio and pass along info and commands?

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Joel

Re:BLG and AGI Studio
« Reply #2 on: April 26, 2002, 03:08:05 PM »
what sorts of commands? I'm thinking of the BLG as pretty much a dialog box that comes up when you would choose a menu item to generate a logic template. In which case the only real data exchange needed is to tell the BLG how it should initialize itself and for the BLG to tell AGI Studio (or whatever the calling program may be) whether the user generated the source code or cancelled the operation and if the user generated the source code what the source code is. Are you thinking of something more powerful than that?

Offline Nailhead

Re:BLG and AGI Studio
« Reply #3 on: April 26, 2002, 07:26:58 PM »
This is a great idea Joel!

I can't think of what other types of commands that would be useful to pass between the apps, other than what you mentioned, as far as using BLG as a dialog called from AGIStudio.

example:
success=0 or success=1

Offline Nick Sonneveld

Re:BLG and AGI Studio
« Reply #4 on: April 26, 2002, 07:57:43 PM »
well, sending commands via pipes would be more useful for a sound player (play, pause, stop).. but I thought if we could do some things generically like sending file info.. it could be used in other programs.

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Joel

Re:BLG and AGI Studio
« Reply #5 on: April 26, 2002, 08:13:44 PM »
I don't really know how to redirect pipes (I'm not even 100% sure what it means), but if you have an idea for a standard interface then that's fine with me. I'm simply suggesting that the interface be defined so that I can make the appropriate updates to the BLG. I think it would be good if the version 2.0 full release version already had the capability rather than the ability having to be added in a 2.1 or something like that. On the other hand, I'm not suggesting that we rush the design of the interface, either. I do have a bit of work to do before the BLG is ready for a full release. As you may have noticed, it performs no bounds checking at the moment, and it asks you for the game directory every single time you generate a file (though that problem I've mostly taken care of already).

Offline Mokalus of Borg

Re:BLG and AGI Studio
« Reply #6 on: April 28, 2002, 01:30:16 AM »
Well, then, like good little software engineers, let's start with...
Requirements
  • What do we want to achieve here?
  • What information do we need to send between the two programs to achieve it?

Mokalus of Borg

PS - It'll make the rest of it easier.
PPS - Suggestions? Comments? Airborne rotten fruit?

Offline Joel

Re:BLG and AGI Studio
« Reply #7 on: April 28, 2002, 11:44:35 AM »
I'm not totally sure what we're trying to achieve here. As far as the BLG is concerned, all that needs to be achieved is that AGI Studio needs to be able to say, "BLG, start up and let the user generate a logic, then tell me whether the user actually generated a logic, and if they did then tell me what the logic was," and the BLG should respond appropriately.

However, it would be more versatile to design an interface that allowed any AGI programs that implemented the interface to communicate whatever types of data they're capable of communicating.

As I see it there are five types of resources:

- views
- pictures
- sounds
- compiled logics
- logic source code

The BLG is capable of communicating the last 2 but in the context of AGI Studio I think it would be more likely communicating just the logic source code.

Offline Nick Sonneveld

Re:BLG and AGI Studio
« Reply #8 on: April 29, 2002, 10:19:15 PM »
Yeh, sorry... I didn't want to get things too complicated that you wouldn't bother to get any sort of communication between agistudio and blg.  It was just an idea.

Another application for better communications between apps would be for a debug mode in NAGI.  setting breakpoints in agistudio and then running nagi until it reaches one would be terrific.

so really you'd want some sort of protocol to send file information, breakpoints, settings or commands.

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Joel

Re:BLG and AGI Studio
« Reply #9 on: April 30, 2002, 12:28:08 AM »
that debug mode thing with NAGI does sound cool.

to reduce the complication of this thing, how about designing communication protocols in terms of application classes?

for example, a logic template generator would be one application class needing only a logic template generator communication protocol. The BLG would need only implement that simple protocol to be able to communicate with AGI Studio (or more generically, the IDE application class).

there could be an interpreter application class which needs to obey an interpreter communication protocol in order to communicate with AGI Studio.

of course, going this route there are things to look out for, such as designing the protocols specifically for the tools that exist at this very moment and not in a generic way that would allow extensions. and, of course, it would be advisable that any tools that are developed continue to produce resources that can be imported into AGI Studio even if AGI Studio can't just get the thing by "simple" communication.

Offline Joel

Re:BLG and AGI Studio
« Reply #10 on: May 01, 2002, 11:13:06 AM »
another possibility -- do you think sockets would be a good communication platform?

the only Win32 stuff I can find regarding pipes talks about creating named pipes, but only WinNT/2000/XP can create them. Windows 95, 98, and Me can't.
« Last Edit: May 01, 2002, 11:14:09 AM by Joel »

Offline Nick Sonneveld

Re:BLG and AGI Studio
« Reply #11 on: May 02, 2002, 06:42:27 AM »
I was thinking more of redirecting the stdin and stdout for communications.  I believe they're just unnamed pipes.

Sockets was my other choice.. but I wanted it to be simple to implement for all apps.

Microsoft has a nice article on all the interprocess communications they have.  If we want to have source that's compatible with unix.. pipes and sockets are probably the only ways to go.

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Joel

Re:BLG and AGI Studio
« Reply #12 on: May 02, 2002, 12:02:19 PM »
Ok, I got a program to work with redirecting unnamed pipes. This may be simply because I just finished a network programming course and this is the first time I've used pipes, but it seems to me that sockets are more straightforward, at least for the parent process, which really seems to have to jump through hoops to set up all the pipe redirection.

The only problem I see with using sockets is that Windows doesn't seem to support the PF_UNIX (a.k.a. PF_LOCAL) style communication (although I may just be doing it wrong -- I can't find anything about it on MSDN), but that could possibly be overcome using PF_INET instead and specifying the server address as INADDR_LOOPBACK. It depends on how portable that solution is, but that would allow the use of TCP or UDP on the local machine without needing to know the local machine's IP address. I remember reading about some kind of issue with IPv6, but I assume there will continue to be a loopback address in IP version 6, so there may just need to be a recompilation if there's a problem.

On the other hand, pipe redirection is fairly simple on the child end of things, so I guess as long as pipes are as versatile as sockets in a local machine context, then I guess I don't have any problem with using them.

Offline Nailhead

Re:BLG and AGI Studio
« Reply #13 on: May 02, 2002, 05:09:03 PM »
The problem with sockets is it would ring people's firewall software and therefore worry them about what's really going on with the app.

What about using a DDE connection?

Offline Joel

Re:BLG and AGI Studio
« Reply #14 on: May 02, 2002, 06:24:31 PM »
I thought of that problem with firewall software, actually. But anyone who's really, really concerned about it to the point where they might consider blocking the communication would hopefully recognize 127.0.0.1 or whatever as the loopback address. Of course, using any of our fan-made AGI software also requires a bit of faith in the authors not to be doing stuff they shouldn't be doing. I agree that it is an issue, though.

The problem with DDE is I think that it's Windows-specific, and it requires broadcasting messages to all the programs running in Windows to get the communication started. I think we should design the communication protocol so that Linux, etc. users aren't left out of the possibility of utility integration.

I think Nick's got it right. If we want to be portable, we're probably going to have to use either pipes or sockets. Where each of them stands is pretty much like this:

where "server side" refers to the utility application such as the BLG and "client side" refers to the application that invokes the utility application, such as AGI Studio

sockets

the good:
- slightly less complicated than pipes on the client side; possibly less work for Nailhead :)
- Internet capable; whatever possible application that might have I don't know
- documentation is easy to find
- highly portable...the Windows Sockets API is designed to be compatible with the Berkeley Sockets API

the bad:
- slightly more complicated than pipes on the server side; may prevent novice programmers from developing integration capable AGI utilities
- could trigger firewalls; might make some people suspicious...might be a security hole

Pipes:

the good:
- very easy to use on the server side
- no triggering of firewalls

the bad:
- not so easy on the client side; I got it to work but I only understand what it's doing in an intuitive way; the MSDN example code is not completely clear
- no Internet capability - in order to be compatible with Windows 95, 98 and Me, we have to use unnamed pipes, which can't be created across a network connection
- documentation is not as easy to find
- less portable when doing things the MSDN example code way -- althought Unix may support pipes, it wouldn't set them up the same way the MSDN example code did


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.024 seconds with 15 queries.