Hi Dulsi,
I saw the replies you got at the Fedora-Magazine. I can fully understand that you lack the time to program a desktop-agnostic program that creates the connection. Yet the online-function is (imho) the feature you want to offer.
Checking the GamerZilla-Source, it is clear that everything that is needed to establish a connection and transfer the data is within the library.
Maybe it would be a idea to offer a variant of GamerzillaConnect() (e.g. GamerzillaAutoConnect() that searches for a ~/.GamerZilla/login.txt, and returns a true when a connection can be established? If the return is true, the game could call GamerzillaServerProcess(NULL) in its main loop.
Is this intented? Is this working? Whatever.
I implemented it in Acid Flight that way:
Auto-Connect function:
bool GZOnline;
std::string GZserver="";
std::string GZname="";
std::string GZpw="";
int loadLogin() //load the gamerzilla login Data
{
int cScores=0;
std::ifstream file;
std::string str;
std::string homepath = getenv("HOME");
std::string homeDir = getenv("HOME");
homeDir+="/.GamerZilla/login.txt";
file.open(homeDir.c_str());
int HilfsInteger=0;
while (std::getline(file, str))
{
char * writable = new char[str.size() + 1];
std::copy(str.begin(), str.end(), writable);
writable[str.size()] = '\0';
if(speicher=="Server"){GZserver=str;}
if(speicher=="Name"){GZname=str;}
if(speicher=="Password"){GZpw=str;}
delete[] writable;
speicher=str;
}
file.close();
return 0;
}
bool GamerzillaAutoConnect()
{
loadLogin();
bool succes=true;
if(GZname!="")
{
succes=GamerzillaConnect(GZserver.c_str(), GZname.c_str(), GZpw.c_str());
}
else
{
std::cout << "No gamerzilla login found! " << std::endl;
}
return succes;
}
Initialization:
GZOnline=GamerzillaAutoConnect();
if(GZOnline==true)
{
GamerzillaStart(true, "save/");
std::cout << "GZ connected!" << std::endl;
}
else
{
GamerzillaStart(false, "save/");
}
game_id = GamerzillaSetGameFromFile("./gamerzilla/acid.game", "./");
Function to call from the main loop:
int GZUp(void *in)
{
GamerzillaServerProcess(NULL);
}
Call in the main loop:
if(GZOnline==true)SDL_Thread* GZ = SDL_CreateThread( GZUp, "GZ", (void*)in);
Does compile; does run. Not sure if working since my account is atm not verified on your server :). Also, as soon as I'm logged in the whole user list goes kaboom. Is this due to the lacking verification? Is it right to call GamerzillaConnect() before GamerzillaStart()?
login.txt needs to be placed into .Gamerzilla within the users homefolder and contain a file with this schemata:
Server
https://identicalsoftware.com/
Name
Dulsi
Password
YourSecretPasswordGoesHere!
Built and source for this moloch:
https://thunderperfectwitchcraft.org/AcidFlight/runner2-ExperimentalGamerZilla.zip
Once you give your blessing and I confirmed that this does work as intented I'm going to merge it into the main built. Maybe this is a option per se? You would however need to convert my functions to C (I can only do CPP).
Greetings.
Hope this aint to mad, as always my code is fuzzy as hell :D