Hello I realize that this is a long email. I didn't split it up to keep the context. The 4 parts are about my requirements, my ideas about how to reach them, questions about the AI-interface and what Freeciv may be interested in using. I don't expect a reply to be a reply to everything (but I won't mind it). If there are better ways to fulfill my requirements than my current ideas it would be nice to be told about them and why they are better. Corrections where my understanding is wrong, answers to my questions and other information that could be useful would also be appreciated.
Requirements: I'm planning to connecting an AI that will run on the JVM to Freeciv. It will need: 1) A way to play where it will have access to the same information that a human player has 2) Access to records of played games where it can see all players at a level of detail that at least include the full game state and what actions a player does (but preferably also the time they did it). One way to get this is to connect in a way that will permit that information to be recorded. Another way to get it is to read existing records containing this information. (I noticed that modders using Lua is advised to use Freeciv's random number generator to make games repeatable. Does this mean that action level records exist?) My ideas on how this could be achieved: My research have so far left me with 2 options for connection: connecting as a client vs connecting to the C code of the AI-interface. For connecting to the client there are again two OK looking options when it comes to creating the code for connecting: generate from packets.def vs connect to the C-files generated from packets.def. An advantage of connecting to the AI-interface is, as far as I understand, that Freeciv knows it's an AI. Since Freeciv is aware of this AI-effects can apply to it, it can be initiated to take control over a player during a civil war etc. The AI interface also appear, by what I have seen, to be more high level than the protocol. (That could of course just be me mixing up the default AI's internal state with the interface) In addition, since the AI-interface is there, it appears that using it is preferred. So if a chance at getting Java bindings into Freeciv exist at all I assume that, unless a Java client is desired, using the AI interface probably will increase it. The advantages of connecting as a client is that everything available to the client will be available to the AI as well, nothing less and nothing more. Records, unless that feature already exist, can here be had almost for free. (If the observer mode sends actions and not just their results it can connect as an observer and log. If it don't a logger that logs the communication with each player could be added to the server) The AI will be alerted to changes in the game state (like an enemy moving an unit) by the packet informing the client. In the case of generating Java code from packets.def it permits avoiding the trouble of having to mix code written in Java with code written in C at the cost of having to implement a mechanism for sending and receiving the packets. Avoiding mixing C and Java could perhaps also be achieved for the AI interface by creating C code that connects to the Freeciv AI interface and then launches the Java AI and connects to it over a socket. But in that case the problem of what protocol to "talk" over the socket appears. Would it be much work (translation etc) to reuse the client protocol to get a hybrid solution of the client and the AI interface? Would the opposite hybrid, extending the client interface for AI's (so it at least will inform Freeciv that it is an AI), be more or less work than this? Questions about the difference between the client and AI interface: * Will something connected to the AI interface get to know all that a client gets to know? Say that a new concept (plague, nationality for citizens, etc) is added. The protocol to the client would then be extended so players can use it. Would the same be done with the AI interface or would it wait until the official AI got that feature? Will an AI get noticed about changes in the game state or must it constantly query it? Can an AI know things about the game state a client can't, like the content of enemy cities, the world map, etc? (Knowlege of the actions and full state of the enemy it would be useful to create records but should be avoided while playing unless I get desperate enough to cheat) * Can an AI move at the same time as client controlled players? * How different is the AI interface, the client protocol and any action level records (if they exist). Would it be simple to map between them? * Are there any differences between the AI interface and the client interface I have forgotten to ask about? What may be useful to the readers of this list: I hope that at least parts of what I'm doing can be used by the Freeciv project. By using Freeciv I may find bugs or add small features. I understand those patches are welcome on the patch tracker. Would patches for Java bindings for AI's be welcome as well? A lot of AI libraries and frameworks already exist for the JVM. Having Java bindings may help attract AI coders. I could try to make them as autogenerated as possible to minimize the Java coding needed for the Freeciv project. I could also make it optional to build the Java bindings, so no new dependencies would be introduced for the default case. When it comes to the AI I'm making it will primary be done as an academic AI. I'm still hoping to at least have it at a level where it may be useful for scenario creators that want to have a different behavior than the default AI has. If a more ambitious part of my project is achieved it could also be useful for modders that create exotic rules and want an AI that makes use of them. However, if my AI will be able to do better than the built in AI in all cases I would be surprised.  as in reviewed as opposed to rejected at once Sincerely Sveinung Kvilhaugsvik _______________________________________________ Freeciv-dev mailing list Freecivemail@example.com https://mail.gna.org/listinfo/freeciv-dev