Split default content

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Split default content

#1 Post by o01eg »

While preparing the slow game's server for alternative content I found out with small changes I still need to pack big amount of unneeded data.

What about to separate default/ folder by applications use it? It should be 3 sub-folder:
  • default/client/ - Content used only by the human client, mostly images and sound.
  • default/server/ - Content used only by the server and AI, mostly python scripts and some of FOCS scripts like statistics.
  • default/common/ - Content used by both sides FOCS scripts and translations.
To manage it separately add 3 options resources.path.client, resources.path.common, resources.path.server which override resources.path for appropriate sub-folder.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Uriuk
Pupating Mass
Posts: 99
Joined: Wed Jan 01, 2020 9:06 am

Re: Split default content

#2 Post by Uriuk »

I would divide into four directories:
human-player
ai-player
server
common

Because it will be nice to have AIs which play exactly like humans (and not as in freeciv, where they are hardwired)

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Split default content

#3 Post by o01eg »

Uriuk wrote: Wed Feb 19, 2020 7:48 am I would divide into four directories:
human-player
ai-player
server
common

Because it will be nice to have AIs which play exactly like humans (and not as in freeciv, where they are hardwired)
AI launched on the server side so there no sense for them to have separate folder. Also it's still a separate process with its own memory, universe, and content data.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Uriuk
Pupating Mass
Posts: 99
Joined: Wed Jan 01, 2020 9:06 am

Re: Split default content

#4 Post by Uriuk »

o01eg wrote: Wed Feb 19, 2020 7:52 am AI launched on the server side
Yes, exactly like in freeciv. But what if one want to launch his own custom AI on his client side in a multiplayer game?

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Split default content

#5 Post by o01eg »

Uriuk wrote: Wed Feb 19, 2020 9:17 am
o01eg wrote: Wed Feb 19, 2020 7:52 am AI launched on the server side
Yes, exactly like in freeciv. But what if one want to launch his own custom AI on his client side in a multiplayer game?
Then he doesn't need to use exactly same content as at the server.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Split default content

#6 Post by Ophiuchus »

o01eg wrote: Wed Feb 19, 2020 7:42 am While preparing the slow game's server for alternative content I found out with small changes I still need to pack big amount of unneeded data.

What about to separate default/ folder by applications use it? It should be 3 sub-folder:
Not sure I read you. You mean you do not want to push so much data to the server (so you do not need to push the art over)? Or the problem that every client needs the same data (e.g. as a huge zipped default folder)?

For the server you could simply refrain to push the new art over, couldn't you (e.g. remove the data folder in the build).

For the client: What would better in my opinion would be some plugin (or overlay/diff) mechanism. This would provide for minimal content bundles and maybe even in a way one could mix multiple content bundles (e.g. adding FOCS KISS Targeting, FOCS missiles and FOCS seats of power). If adding new content you have FOCS files for the content and its effects, maybe additional initial content (e.g. ships or tech unlocks), and in a perfect world also AI extensions/hints/changes for the AI to make full use out of the new content.

I do not see a big downside to split folders the way you suggested if it helps you (will break my old FOCS bundles, but not a big deal). But probably I do not see use case yet.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Split default content

#7 Post by Geoff the Medio »

Two possibilities are:

1) have a base content directory, generally the stock default, and an override directory. Every file in the base directory would be loaded and parsed unless it is also present in the override directory. Only altered or new files would need to be present in the override diectory. An empty file in the override dir would effectively remove it from the game.

2) have a special include from default file that can be put into a resources directory that causes all the contents or perhaps just named files (with wildcard functionality) to be loaded from the corresponding default directory (or an arbitrary location?) and be parsed, as if they were in the include file's location. Only altered or new files would new files would need to be present in the override directory and the rest could be linked to with the include file.

A more-flexible plugin mechanism to just support adding content could use the rules mechanism to turn stuff on and off as well.

Post Reply