Game Development Community

File Check system

by Ronald J Nelson · in Torque Game Engine · 11/26/2005 (8:22 pm) · 7 replies

I am trying to see if anyone has a working file check system that would work for the following.

A player joins a game and gets told to download a file from a website by each pre-existing player and that player sends each of them a website to get his file from. What needs to happen here is someway to see if you have the file, and if it is the most recent copy of that file.
The reason I am asking is because I have successfully made a multiplayer custom skins system. It uses a heavily modified version of the getJPG code released here:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4926

Unfortunately it's file check system was based upon one file only and its technique really won't work here.

The file type in question for me is a png. But that will be subject to change after I set up my encryption utility to prevent theft of art of a player's custom paint. I would prefer some sort of check to see if the file exists, and a check by date to see if it is the most up to date. I realize Torque uses a system like this with the *.cs to *.dso encryption system. But I really have no idea where to start. Right now I am just basking in the fact that I made a working system. Heheh

#1
11/26/2005 (9:33 pm)
I'd strongly suggest reading Applied Cryptography. Fantastic book on the subject of crypto and how to deal with these suggestions.
#2
11/27/2005 (1:29 am)
I guess what I would like to know first is if I send to another player a string that would equal something like "main/data/shapes/vehicles/car/dtcustom2.carskin.png" which is the save location for the file, if there is some easy way to do a quick check to see if that file is already there?

As for the encryption process, already got something in work.
#3
11/28/2005 (9:30 am)
I guess what I need is a simple "if (this file is already there) then" kinda thing unless someone has got a better method.
#4
11/28/2005 (10:32 am)
Hi Ron,

I believe there is a few functions in Torque for finding files. I am not sure what the name of the functions are but maybe something like findfirst and findnext. They are listed somewhere in the torque documentation.

Hope this helps.

Sean
#5
11/28/2005 (10:46 am)
Just a annoying note here -
you've probably already thought about this,
but consider the case where you've got a malicious player who's sending out fraudulent downloads to say zombify other machines..

allowing one client to specify a DL target on another machine is generally a bad idea.

as for checking that you have the right version of a file, this might be a place to start:
U32 SceneLighting::calcMissionCRC()
#6
12/03/2005 (10:48 am)
@Orion - Well in that regard what I have done is set up my system to only allow the game to download a certain type of file. Then it actually does a quick file check to see if it is the real mccoy. But on top of all of that, I am including a file encryption utility to allow players to avoid having their art work stolen, the encryption format will be the only file type allowed in a download.

Also I have a system that flushes all downloaded files the moment you exit the game.
#7
12/05/2005 (9:19 am)
Sounds like you've thought aboot it a bit.
you might also consider forcing downloaded files into a single directory,
and making sure that "c:\" and ".." and such are not in the client-provided filename,
or hashing the client-provided filename into something else locally.