cacheout, cache, world and http?

Need help seting up a server, or have a question on how to run one? This is the place.
Post Reply
User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

cacheout, cache, world and http?

Post by zaphod » Tue Nov 30, 2010 9:21 am

unfortunately just some basic informations I found seeking how to load a world with: -cache via http.
and I would like to find out more about this feature for faster loading bigger map-file's.
I hope someone can point me to the right direction how to make this work ....

well I started playing around but unfortunately couldn't make it work properly!
what I tried so far:
using bzfs to create a binary from a map.bzw file (bzfs -world map.bzw -cacheout map.out)
copying this binary to my http-server and
replacing -world map.bzw
with -cache http://myserver/path/to/map.out in the config.conf file
starting the server and checking to see that it loads just a generic map.
I tried many possibilities but nothing worked so far!

1- what did I miss?
2- what is stored in the binary?
(server configs? files and plugins to load? world: i.e. "size 400 / freeCtfSpawns / noWalls"? world-options: i.e. "-c, -r, -set _gravity -20"? )
3- what information goes into the config.conf file to start a server with a cache-binary?
4- what perms does the map.out and its folder need on the http-server?

THX for helping!
.
.
.
Image

User avatar
Cobra_Fast
Dev Monkey
Dev Monkey
Posts: 321
Joined: Sat Oct 07, 2006 11:51 am
Location: Germany
Contact:

Re: cacheout, cache, world and http?

Post by Cobra_Fast » Tue Nov 30, 2010 10:18 am

zaphod wrote:replacing -world map.bzw
with -cache http://myserver/path/to/map.out in the config.conf file
-world must be in there, so the server knows what map you are playing with as the server doesnt read the http-file.
zaphod wrote:2- what is stored in the binary?
The cacheout file contains all the data you've written to the map in a ready-to-use format for the client.
I strongly recommend generating the cacheout with the bzfs on the server where the map will run, if you don't there is a good chance that the file generated on your desktop has a different checksum than the file the actual server would be using.
zaphod wrote:4- what perms does the map.out and its folder need on the http-server?
It needs to be readable by the server (644, u+rw-x;ao+r-wx).

User avatar
blast
General
General
Posts: 4729
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: cacheout, cache, world and http?

Post by blast » Tue Nov 30, 2010 11:00 am

The permissions don't even need to include write permissions. Set the user and group to whatever your web server runs as (probably www-data) using chown and chgrp. Basically, if you can hit the link in your browser and have it start downloading, it will be enough for the client to pull down as well.

Also note that if your map uses DrawInfo that cache files do not work.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image

User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: cacheout, cache, world and http?

Post by zaphod » Tue Nov 30, 2010 11:34 am

Cobra_Fast wrote:-world must be in there, so the server knows what map you are playing with as the server doesnt read the http-file.
so basically bzfs uses the map.bzw and the clients the binary map.out

once loaded; does bzflag store then the binary in its cache or does it reload it on each connection?

in general ::: what would you recommend for loading bigger maps?:

1 -cache http://myserver/path/to/map.out
or
2 -world http://myserver/path/to/map.bzw


and THX for your solid inputs!
.
.
.
Image

User avatar
Cobra_Fast
Dev Monkey
Dev Monkey
Posts: 321
Joined: Sat Oct 07, 2006 11:51 am
Location: Germany
Contact:

Re: cacheout, cache, world and http?

Post by Cobra_Fast » Tue Nov 30, 2010 11:44 am

The cache file is cached by the client.
I woudl definitely use the cacheout as it's a lot smaller than the bzw.

User avatar
blast
General
General
Posts: 4729
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: cacheout, cache, world and http?

Post by blast » Wed Dec 01, 2010 12:14 am

The raw BZW is never sent to the client (to the best of my knowledge). The only BZW parser is in the server. The client gets a binary file whether or not you use -cacheout/-cache. It's just that bzfs does not send as fast as a web server since it isn't designed for transferring files. It is limited to sending 1024 bytes per cycle, and on an empty server, the cycles can be spaced out a bit since the server sleeps to reduce CPU usage when it doesn't have any work to do.

Also, if the cache file on the web server is missing or does not match what the server says it should be getting (based on an MD5 hash check) it will download it from bzfs instead. This is why you need to load the -world too. First so that it can calculate the MD5 hash, second so it can provide a fallback for the clients. Plus it needs to know the layout of the map so it can handle spawns, and there might be variables in the map, etc.

So, in summary, you always need to use -world (unless you are using a random map, in which case, -cache isn't possible/necessary). And then you can also -cacheout the cache file once and then -cache for when you run the server.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image

User avatar
mrapple
Sergeant Major
Sergeant Major
Posts: 460
Joined: Wed May 27, 2009 11:59 am
Location: Unknown
Contact:

Re: cacheout, cache, world and http?

Post by mrapple » Wed Dec 01, 2010 1:23 am

Just one last addition to this topic...

Why doesn't drawinfo cache? Is there any logic behind it? Bug maybe?
Image

User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: cacheout, cache, world and http?

Post by zaphod » Wed Dec 01, 2010 1:49 pm

THANKS for all your input and help guys!
works and the map is much faster loading! (plus I learned another lesson!)
.

User avatar
blast
General
General
Posts: 4729
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: cacheout, cache, world and http?

Post by blast » Wed Dec 01, 2010 11:06 pm

mrapple wrote:Just one last addition to this topic...

Why doesn't drawinfo cache? Is there any logic behind it? Bug maybe?
Yeah, a bug.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests