FL code structure
-
Well, first i wrote it as a reply in the Limit Breaking, but maybe it deserves a separate topic.
There’s no server in SP
Actually, there is
Well, i’ll write my vision of FL code chunks:
1. FL has internal-server and internal-client parts. These not to be confused with MP server and client, both of them have internal server and internal client.2. Internal client is responsible for user interaction (graphics, sound), network interaction (in MP)… well, etc
Internal server is the game itself. It is where the game logic engine is running.
They interact via IServerImpl structure.3. Common parts. First, of course, is common.dll. It is high level of the game engine itself. It contains code for objects interaction logic (int-server) and for calls to user-interaction engines (graphics, sounds).
The low level is contained in dacom.dll and dalib.dll. Internal server part there is physics, i guess, and internal client is graphics, sound. There are also common engines like networking, math, file reading, including FL file formats.
All of these are loaded with so called…4. Plugins.
I didn’t do any research there, 'cause i never got so far in FL programming So it’s just an assumption, based on that sizes of da*.dlls are too small to contain real engines, and that there are lists of these ‘plugins’ in [Libraries] in dacom.ini and dacomsrv.ini.
Don’t know how they interact with the main program and do their work either.5. And finally the last part: Content.dll.
As the name says it is content of the game. I guess it reads all files, creates the universe from them and shows it to user. Long story short - it makes the game ‘breathe’, runs game’s DATA on game’s engine (EXE).
The way of interaction with the engine code is mystery too for me.6. And here are interaction schemes which i built like half-year ago for better FL understanding:
SP - here we have both client in server on the same machine running in the same process. Here we have freelancer.exe as an int-client, rpclocal.dll as an interface and server.dll as int-server.```
System <-> dacom.dll (and plugins) <-> FL.exe <-> IServerImpl [rpclocal.dll] <-> IServerImpl [server.dll]MP - on a client machine we have freelancer.exe as an int-client, and remoteserver.dll as stub-int-server which just redirects all queries to the real server on the other network end. On a server machine we have server.dll as an int-server which runs game universe, flserver.exe is an int-client providing user interface for server admin. And we have stub-int-client remoteclient.dll which again links server and the client on the other network end on high level.``` System <-> dacom.dll (engines in plugins) <-> FL.exe <-> IServerImpl [remoteserver.dll] <-> dacom.dll (network) <-> System <-> /network/ <-> System <-> dacom.dll (network) <-> remoteclient.dll <-> IServerImpl [server.dll] IServerImpl <-> FLServer.exe
Content.dll is absent on these schemes, 'cause as i said i don’t know how it interacts with the game.
Hope any of this makes any sense
Oh, and this is just my understanding, corrections and additions are welcome -
Good overview. Just wanted to note that a lot of the low-level stuff is also happening in Freelancer.exe, such as the actual rendering. (I know, there is rp8.dll, but thats mainly a wrapper for d3d8.dll)
content.dll is mainly for game logic, as you said.
Interaction is done by using “Controllers”, just have a look in Freelancer.ini under
[Initial MP DLLs]
and
[Initial SP DLLs]Those controllers get called a lot in server.dll for example.
What is a mystery to me is what BaseWatcher actually does.
Its used a lot but I dont really get what it is about. Does anybody have a clue?
(BaseWatcher::set_pointer is called very often in multiple places)
To me it seems its some sort of list. -
w0dk4 wrote:
What is a mystery to me is what BaseWatcher actually does.
Its used a lot but I dont really get what it is about. Does anybody have a clue?
(BaseWatcher::set_pointer is called very often in multiple places)
To me it seems its some sort of list.I thought it might be adding objects to a list to have their update(float fTimeElapsed) functions called in the main loop. I’d have to do some checking to see if that guess is anywhere near what it’s actually doing though.
-
I recognized the BaseWatcher call when i undocked from a station. So may it has something to do to point the ship to an available undocking point, so if other docks are busy?! Actually i can try to set breakpoints for this call to see where else this will be called… Just a thought to try to figure out for what it is used