• The VOIDRUNNER'S CODEX is coming! Explore new worlds, fight oppressive empires, fend off fearsome aliens, and wield deadly psionics with this comprehensive boxed set expansion for 5E and A5E!

A standard RPG gaming API

Davin

First Post
Re: Re: Re: A standard RPG gaming API

towngen said:
As for the comment that you can't have multiple connections to a single TCP/IP port, actually you can. A single winsock object can only have 1 connection, but nothing prevents you from using 2 winsock objects on the same port. How you do think a web server allows more than one person to connect at the same time all on port 80? The web server just creates a new instance of the winsock object and allows a new connection.
Actually, that's not how it works. Only one program at a time can LISTEN on a port. Once a connection to that port is made, the system routes it immediately off to another socket to handle any work there and the listening socket goes right back to listening. So while there may be many simultaneous connections in use, only one such connection may be made at any given instant and only one running program is allowed to "answer" that connection. Thus you cannot have several programs out there all responding to connection requests on a single port #. Every listener will have to have a different port # to be contacted on, and distributed-managing that can be a serious headache.
 

log in or register to remove this ad

towngen

First Post
My biggest concern with the whole XML thing really just stems from my lack of knowledge about it. If everyone is reasonably sure there isn't any way to make an off the shelf XML parser do something dangerous, then yes it sounds great. So the message is, don't worry about XML opening some security backdoor. Cool. That was something I just didn't know enough to answer.

I agree that speed was a big issue in the old days when I first started with VB. But ever since it started actually compiling the code, it runs really fast now. It's not quite as effecient as C/C++ perhaps, but for the difference in development time and on a even somewhat modern CPU, it's a quite handy development environment. But anyway, the merits of VB isn't really the point here.

I think the speed of the communications is really important. If the speed isn't really fast, it limits what can be done with it. Suppose, someone creates a database of spells. Then another person wishes to link to it to create spellbooks randomly. There could potentially be quite a lot of queries back and forth for a single spellbook. Then suppose that spellbook is created remotely by yet another program that created a wizard. And the wizard is created because of a request by yet another program which is creating an NPC encounter. People are going to bitch at the NPC encounter program for being sluggish and slow. They might be irritated even with the speed of a TCP/IP connection. Crunching the hard drive for 30 seconds to create an NPC encounter party would be unacceptable for a lot of people.

I was under the impression that DDE used the clipboard, which is what I was meaning, but again that isn't very cross platform so it's pretty much out. Again, the best implementation for me would be to just create an ActiveX DLL to handle it, but since I don't think that will work on Linux and Macs, it is too limiting.

Perhaps, I was misunderstanding the suggestion to use the shared libraries. Are you suggesting that the standard we create actually consist of actual code blocks, kindof a glue logic, that programmers can use to link to each other's code? I never really considered doing that. I was thinking just writing a document that described implementing a standard protocol. Then each programmer that wishes to use the protocol would include their own code to implement it. I guess there is fundamentally nothing wrong with this idea, but it would have to come after the API document was written. And it would then become the end programmers choice whether to use a release library (if one exists for their platform) or write their own. But it's a good idea to package the code up for people so they can implement it faster themselves, sorta like a set of working example code they can cut&paste into their program.

Or are you not meaning to put just the comm spec in a library, but our whole programs? Hmmm. Somehow, I'm just not seeing this as a practical solution. Perhaps, if you could explain this better. Many applications require a user interface to operate, so reducing them to a library of platform independent function calls might be difficult to impossible. Or am I misunderstanding you here?

I could have sworn there was an option in winsock to non-exclusively open the port, but perhaps I'm mistaken. The last application I wrote with TCP/IP was a client/server thing about 2 years ago in MFC, so it wouldn't suprise me if I recall wrongly. Whatever ... the point is, whether you have an initial connection port and then you hand off to a different port or not, it is not really that big a deal. If the API required each program to enter into a listen mode for a remote connection, it's not a big deal to me.

As far as the wrapper thing goes on XML, I was only bringing this up because it seemed the XML data might be a security problem. But since it apparently isn't, forget the wrapper idea.

Also, Klintus, my guess is the real reason you haven't used my town generator is that the beta version I released a while back was merely the GUI. It didn't actually create anything yet. :) And yes, the GUI isn't entirely necessary if you want a COMPLETELY random town. But most people know whether they want a hamlet of 30 people, or a sprawling metropolis of 130,000. So, you gotta direct the GUI a little bit at least. Unless the party got a weird curse that teleported them to a random town somewhere in the universe, you're gonna have a small idea of what you want the town to be like. And even in that weird case, I doubt many DM's would truly allow their campaign to be driven by a random number generator in VB. Even if I wrote about a thousand logic constraints on the results.

So lets see, where are we?

The consensus seems to be that XML is good. Ok. I guess I gotta read up on it some more. Add one more thing to my list that is 80 miles long already ... Unless we get some volunteers to start doing this, it could be quite a while until it's done if everyone is going to wait on me.

Still a little debate on the TCP/IP thing. Can people who favor using the file system, or using shared libraries support the reasoning for those sytems and their advantages and weaknesses. This will allow everyone to compare them with TCP/IP communications more easily.

Any commentary from other developers on whether they might include this in their applications once it's developed? If so, what kind of functionality might you expose for others to call on?
 

Klintus Fang

First Post
towngen said:

Many applications require a user interface to operate, so reducing them to a library of platform independent function calls might be difficult to impossible.

Now I am misunderstanding. If the program in question requires a user interface in order to do anything, then why is it listening to the TCP/IP port? Are you suggesting that if program X want to create an NPC wizard that the user has to open up the "npc creation program" manually instruct the program to create the wizard, and then manually instruct the program to send the data across to program X? If that's the usage model you are envisioning then I don't see it being useful at all.


Also, Klintus, my guess is the real reason you haven't used my town generator is that the beta version I released a while back was merely the GUI. It didn't actually create anything yet. :)

Well, what I meant to say was that I played with the gui and decided the final product would only be marginally useful because it required everything to be manually configured and wasn't compiled as a library.


And yes, the GUI isn't entirely necessary if you want a COMPLETELY random town.

that is not true. all you have to do is compile it as a library and then provide an external api that looks like this:

bool createTown(town_configuration_data_t& input, completed_town_t& output);

then somewhere above that define the structure town_configuration_data_t so that all the options that the user currently has to manually enter through the gui are variables in this structure. then define the structure completed_town_t so that all the information about the completed town are variables in that structure.

Then you compile your town generator as a dll and distribute it with a header file that defines the things above. Then I install that dll on my machine and I write a program that wants to create a town. I instantiate a town_configuration_data_t structure. I fill in the fields that instruct the town generator what sort of town I want. I instantiate an empty completed_town_t structure. Then I call createTown. The town generator looks at the configuration data, builds a town based upon what the configuration struct says, puts the results in the completed_town_t structure and returns true to let the calling program know that it was successful.
 

Davin

First Post
towngen said:
I could have sworn there was an option in winsock to non-exclusively open the port, but perhaps I'm mistaken. The last application I wrote with TCP/IP was a client/server thing about 2 years ago in MFC, so it wouldn't suprise me if I recall wrongly. Whatever ... the point is, whether you have an initial connection port and then you hand off to a different port or not, it is not really that big a deal. If the API required each program to enter into a listen mode for a remote connection, it's not a big deal to me.
Perhaps you're confusing sockets with ports?

The problem is not having each program do its own listen (that's trivial). And it's not any trick for each program to listen on a different port number. But when program #1 wants to call program #2 to do some work for it, what port # does it call on? How does it know program #2 is using port #7651 instead of #5912? And does the port # change every time it's run, or is it fixed? If it's fixed, how do we know that the next developer doesn't pick that same exact # to use?

None of these problems are insurmountable, but you have to figure them out well ahead of time so you don't end up running into a brick wall.

(One possible method is a variation of something just mentioned, and that is a "service clearinghouse". If one program was written that does all the communications between all programs, then all other program could "sign up" with it to give & get services. FWIW, I don't think this is the best idea.)
 

DMFTodd

DM's Familiar
DMTodd - Have you been importing/exporting pcg files (character save files for the rest of you. )

No, I import stat blocks. This is the whole idea of interoperability: If I import your PCG files, then I can't import from anything else. Or I have to write different imports to deal with everyone else's file formats. Yucky.

If there was an XML standard for PCs, I would have written an import for that. There isn't so I went with the only standard I could find: the d20 stat block foundation format.

I just have to massage your data (and E:Tools and others) into that format. But the import can stay the same. It works, but a XML standard rather than a stat block standard would work smoother.
------------------------------

As much as I think this is a good idea, I don't see it happening on this level. Too many cooks, too many views, too abstract. At least for me.

What I think might work: If 4 or 5 of us with existing tools, sat down and decided how we could get our programs to talk to each other.
 

Sm!rk

First Post
Fast Learner said:

Please. Compiled VB (not to pseudo-code, but to machine code) runs very fast, many, many times faster than Java. It's the next best thing to C/C++ for speed and (generally, depending on the programmer) kicks butt in development time.

Yeah, big picture though you have X developers and unless its a truelly internal use only app, you will have X+N users. As N goes up your tradeoff for development time versus user run time starts to become a bad choice.
This same concept applies to Java as well but at its heart it is a better bargin since you get cross platform use without doubling development time. But as with VB the Java argument without using an ideal world equates to the same loss eventually, there aren't that many people using anything but Windows.

For example if pcgen takes 10 more seconds to load versus the same program implemented in C++, and if it has 10000 users that run it 10 times a month, you have just wasted a million seconds of people's time in a month which eqautes to about one 5 day, 8 hour a day work week. And what was saved in development time? Looking at the life of pcgen this amounts to about 6 months of normal work weeks spent only on waiting for the program to launch.
These are educated guesses, I'm sure pcgen had less users 2 years ago, but I also think it is slower than just 10 seconds in normal use.
One other thing though, its not all bad, it takes much longer to build characters by hand, this is just an argument about running time versus development time


Another thing, there are far more tradeoffs with using VB than just speed. But if you know C++ and VB you are well aware of these tradeoffs. VB is like candy, might be good for a brief spurt of energy, but if you are doing real work you better get a sandwich.
 

towngen

First Post
Sm!rk, I understand what you are saying, and I agree with some of it in theory. But what you are talking about seems to be more on the theory side of an argument rather than a practical side of an argument. There are a great many program that do "real work" which are written in VB. The total efficiency of society is not my concern here. The theoretical limits of effeciency as the numbers of users gets big compared to the number of programmers is completely missing my point.

The reason I am interesting in a platform independent solution, and obviously I can't speak for the rest of you so this is just MY reason, is that I want to "reasonably maximize" the number of developers out there who are creating programs which can work with each other. It is the number of developers creating programs that support the standard which is going to decide the standard's success or failure.

DMFTodd, I am glad to hear that you ran into this exact issue of interprogram communication with your program. I hope that fact helps solidify your support of SOME standard, even if it has nothing to do with what I am trying to motivate people to support.

Davin, it wouldn't suprise me in the least that I am confusing a great many things here. I just want to get everybody onboard and excited about a standard of interapplication communication for RPG programs. Frankly, I could care less the final form of it. As long as it works and doesn't add 6 months to my programs already too long development cycle. I just wan't something to be created that everyone will actually start using eventually.

Klintus, you are correct in your view that my town generator should be able to create a town as a function call without needing to interact with the user interface. That being said, I don't plan to release a GUI'less program as a library to be included in other people's programs. The program should support exporting it's functionality IN ADDITION TO having a GUI and running as a stand alone program. So if you gotta open my program for the export stuff to work, that seems great to me. If it opened automatically as a minimized application, that would be a convienence bonus, but not a necessity (IMO). But I don't think I would want to allow my program to be invoked invisibly. If the town is coming from my generator, but being presented in someone else's program, that's cool, but the user ought to be at least vaguely aware that the town was created by my program. I'm sure other programmers would like to make sure users of the program know that their program is being used.

As for the question of why is it listening to a TCP/IP port if it requires the GUI to function, because a particular program may export only SOME of it's functionality. I might decide that I only want to enable the exporting of a town when the user is sitting at the summary screen. Or, perhaps I don't have time to implement the full blown "function call" like interface, and will only export a town that was created via the user interface normally because that's all I had time to do. I don't really know. I'm just trying to come up with examples. The issue is that I don't know what all people are going to want to export, or import, or why, or what the resources are for people writing these programs, etc...

I do like the idea of creating a distributable library which contains the code of a simple implementation of this protocol. Kinda like a RPG-API SDK, or something like that. If we wrote one in VB, VC++, and Java it would probably cover 99% of all the developers out there.

The idea of using a single dll that resides in the windows/system directory as a clearing house for communication is a good one. I know so little about Macs & Linux that I don't even know if they utilize dlls the same way Windows does. If I wrote a dll for Windows in ANSI C that didn't use any specific Win32 function calls, how difficult would it be to create a dll on the Mac & Linux platforms from that source code? When 1 application calls a dll on a Mac, does it create a new virtual instance of that DLL in memory that only that application can touch? Or can multiple applications all call the same instance of a dll. In Windows 98, all Windows applications share the same virtual machine, but Windows 98 obviously has a different approach to it's architecture, so will such a method work on a Mac or on Linux? Does anyone know how the separate application spaces in WinNT based platforms would affect such a clearing house dll? I've never tried this on a NT box, so I don't know if the instances of the dll would be the same or not. Anyway, if no one knows for certain about WinNT, I'll probably look into it some one of these days when I get more spare time. But I'll need someone to help with figuring out the Linux & Mac versions of that question. I don't even have access to a Mac, not that I'd know what to do with one anyway. Boat anchor anyone? jk :)

I guess we need to resolve this single dll as a clearing house idea to see if it's feasible. If it is, then that would definately be the easiest way to go by far. After we go it up and running for the local machine only, we could potentially add in some distributed communications aspects to it later on.
 

Klintus Fang

First Post
Sadly, I still think the simplest, most efficient and most elegant way to establish intercommunitation is simply to encourage developers to compile that portion of the functionality that they'd like to share into a library and then to publish an api.

If I have to manually configure each program then the usage model you are proposing is only fractionally better then manually cutting and pasting, in my opinion.

But if that's the way people want to go then don't let me stop it from happenning.
 

towngen

First Post
Perhaps we are talking past each other. What manual configuration are you talking about?

The API would define a method to allow programmers to expose those functions that they wish to expose. I imagine that most functionality will be exposed as function calls requiring no interaction with the called programs GUI. It would simply be sitting quietly on the task list, answering requests made via this API.

Some programmers may wish to implement certain functions by invoking their GUI to supply details. But this would in no way be a requirement.

The API would be nothing more and nothing less than a definition of how to talk to one another. What was implemented and the other details would be up to each implementation. It's merely a comm spec.
 

Fast Learner

First Post
Right, exactly. The worst case scenario would be that the user would have to type in a port number and a url where a given program could go out and grab an xml dtd and SOAP spec (envelope, I think) so that the calling application would know how to specifically talk to any given application.

A better (imo) method that would require almost no work at all on the users' parts would be for the group to set up a central (very low volume) server somewhere that would contain a small database of port numbers, schema/envelope urls, user-friendly names, and addresses to download the applications. If this was in place then users would be able to quickly configure the app and say "get spellbooks from this application" (either on a local system or via a SOAP-based web service), "get magic items from here and here," "get names from here," etc. The user wouldn't need to have any urls or port numbers or anything. If the user didn't already have the application in question (assuming it wasn't web-based) then a link would be provided for downloading it or more information.

The whole thing requires only a small amount of code be added to each of our apps, and that chunk could certainly be distributed as platform-specific libraries to make it a snap.

Oh, and yes, there's solid xml parsing code out there for the mac and *nix.
 

Remove ads

Top