Concept: Mod downloader
Moderator: Halo Moderators
Concept: Mod downloader
Here is an idea:
There are two separate applications, one for the client and one for the server. When hosting, the server will take an sha1 hash of bloodgulch.map, then send it to any clients.
A client is an application running on a clients computer. When it receives the hash, it will search for a map in the maps folder with the same hash. If one is found, it will be switched into the correct location, and the halo game will connect to the server. If it is not found, the client will request the map from the server. It will download, switch it in, then the game will connect to the server and the game will begin.
Problems?
There are two separate applications, one for the client and one for the server. When hosting, the server will take an sha1 hash of bloodgulch.map, then send it to any clients.
A client is an application running on a clients computer. When it receives the hash, it will search for a map in the maps folder with the same hash. If one is found, it will be switched into the correct location, and the halo game will connect to the server. If it is not found, the client will request the map from the server. It will download, switch it in, then the game will connect to the server and the game will begin.
Problems?
Re: Concept: Mod downloader
niiccee so like a urban terror type thing except a application!
Mota-Lev wrote:Its like watching an Asian girl crush a cats brain through its eye socket with high heels.. Its horrible but I just can't look away :/.
-
- Commando
- Posts: 2589
- Joined: Thu Jun 24, 2010 6:36 am
Re: Concept: Mod downloader
this sounds good, but the thing is, the mod will be named bloodgulch, and it would have to do a whole bunch of crap to figure out the map lol
Re: Concept: Mod downloader
Mgalekgolo wrote:this sounds good, but the thing is, the mod will be named bloodgulch, and it would have to do a whole bunch of crap to figure out the map lol
Samucos wrote:...the server will take an sha1 hash of bloodgulch.map, then send it to any clients.
Re: Concept: Mod downloader
HOW IS IT THAT WE THINK OF THE SAME IDEAS AT THE SAME TIME, BUT YOU POST THEM FIRST?!
The idea is useful so that Halo Demo does not crash when we join games and don't have the mod. Many other multiplayer games do something similar.
Really, I just thought of this Sunday when I was playing Marathon net games for the first time with Aleph One. I noticed how it was amazing that Bungie made the game so that only a few kilobytes of map data needed to be transferred to the clients; apply this to Halo, and only the internalized map data would need to be transferred over the net code, rather than entire map files.
What you propose here should be integrated with HDemoLauncher and/or the HDM Mod Database and could use an MD5 or SHA1. (By the way, what do people have against MD5 hashes lately?) The application should check to see if HDemoLauncher is open, and if it is, the application would switch to HDemoLauncher or use the same Application Support folders... don't even bother worrying about people who don't download applications anyway.
Call it "Halo Multiplayer Synchronizer", or HMS. Such an application should also make things CSS ...

Really, I just thought of this Sunday when I was playing Marathon net games for the first time with Aleph One. I noticed how it was amazing that Bungie made the game so that only a few kilobytes of map data needed to be transferred to the clients; apply this to Halo, and only the internalized map data would need to be transferred over the net code, rather than entire map files.
What you propose here should be integrated with HDemoLauncher and/or the HDM Mod Database and could use an MD5 or SHA1. (By the way, what do people have against MD5 hashes lately?) The application should check to see if HDemoLauncher is open, and if it is, the application would switch to HDemoLauncher or use the same Application Support folders... don't even bother worrying about people who don't download applications anyway.
Call it "Halo Multiplayer Synchronizer", or HMS. Such an application should also make things CSS ...

Either you are groping for answers, or you are asking God and listening to Jesus.
Re: Concept: Mod downloader
With checking some kind of file hash, it doesn't sound that difficult.Mgalekgolo wrote:this sounds good, but the thing is, the mod will be named bloodgulch, and it would have to do a whole bunch of crap to figure out the map lol
I do question the practical-ness of the idea. There's no question it would work great if it was actually built into Halo Demo, which is what urban terror probably does (though I haven't played it, so can't say for sure).
Of course, to get things to work...:
The host needs to be "smart." He needs to know about bypassing firewall and/or port forwarding, for the server to work at all.
The clients need to tell the app who the server actually is (may not be so convenient).
Both the server and client will need to be restricted to organizing mods in some way.
Also I imagine checking the hash for every map could be sloooow, not to mention that the host that would most likely use this kind of utility is a modder, which is also the kind of person who would be likely to make small css adjustments to a mod, without wanting to make the clients download the whole map again (that'd be a cool challenge to only send the small changes I suppose).
I am no longer active to Halo or MGM, and don't guarantee a response on the forums or through email. I will however linger around the discord room for general chatting. It's been fun!
Re: Concept: Mod downloader
HDM can list the hash for the mod file. Just another field on the mod database page.
Either you are groping for answers, or you are asking God and listening to Jesus.
Re: Concept: Mod downloader
That does not appear to be a sane or reasonable approach at the least, if even possible (after all, we are just ideally looking at bloodgulch.map files here.)Sparky wrote:HDM can list the hash for the mod file. Just another field on the mod database page.
I am no longer active to Halo or MGM, and don't guarantee a response on the forums or through email. I will however linger around the discord room for general chatting. It's been fun!
Re: Concept: Mod downloader
Bit more of ideas:
Basically, we want the "user" to be able to simply join a room, the client program hacks the IP Address out of halo (or something). Halo would then be frozen, map inserted and halo resumes. If you pay close attention to when joining room, it says:
Here is what we basically want to do:
Some more ideas:
To freeze halo, simply
and...
Halo would show the "spinning wheel of death" while the hack is running.
Basically, we want the "user" to be able to simply join a room, the client program hacks the IP Address out of halo (or something). Halo would then be frozen, map inserted and halo resumes. If you pay close attention to when joining room, it says:
Code: Select all
"Connecting to server...."
"Connection established"
"Loading map bloodgulch"
Code: Select all
"Connecting to server...."
"-----------------------------------"
"HACK NOTICES CHANGE IN IP"
"-----------------------------------"
"Hack connects to the server program using the ip address. If no connection can be established, halo is resumed"
"If a connection, hack requests the hash of the map (The host program hashes the map ONCE when launched)"
"Server sends hash to the client"
"Client searches for a map containing the hash (all hashes are created only once to save time. they are stored in a plist array file)"
"If file found, switch map in and resume halo"
"If no file found, request map from server"
"download map (with a pretty progress bar overlaid on halo)"
"download complete! switch in the map and resume halo"
"-----------------------------------"
"Connection to server failed... retrying (1)"
"Connection established"
"Loading map bloodgulch"
To freeze halo, simply
Code: Select all
killall -STOP Halo\ Demo
Code: Select all
killall -CONT Halo\ Demo
Re: Concept: Mod downloader
Great minds think alike, but I think faster =PSparky wrote:HOW IS IT THAT WE THINK OF THE SAME IDEAS AT THE SAME TIME, BUT YOU POST THEM FIRST?!![]()
I just hashed a map and it took: 0.375387 seconds.
Hashing my whole folder of maps (24 maps) took 6 seconds. (The program skips bitmaps.map, b30.map, sounds.map and ui.map)
Not exactly fast, but not slow either.
Re: Concept: Mod downloader
There is one problem I am having, which you may be able to help with nil...
How do I establish a working connection between the client and the host (with tcp)? It just doesn't want to work. I haven't done any networking before...
Client:
Server:
However, it just doesn't work. Am I missing something?
How do I establish a working connection between the client and the host (with tcp)? It just doesn't want to work. I haven't done any networking before...
Client:
Code: Select all
- (void)connectToServerAndReceiveMessages:(id)object
{
NSString *server = connected_ip;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
socketDescriptor = socket(AF_INET, SOCK_STREAM, 0);
if (socketDescriptor == -1)
{
perror("socket");
NSLog(@"BAD DESCRIPTOR");
[self errorMessage]; return;
}
const int portNumber = 2502;
struct hostent *hostEntry = gethostbyname([server UTF8String]);
struct sockaddr_in theirAddress;
theirAddress.sin_family = AF_INET;
theirAddress.sin_port = htons(portNumber);
theirAddress.sin_addr.s_addr = inet_addr(inet_ntoa(*(((struct in_addr **)hostEntry->h_addr_list)[0])));
memset(theirAddress.sin_zero, '\0', sizeof(theirAddress.sin_zero));
// wait for five seconds to connect
fcntl(socketDescriptor, F_SETFL, O_NONBLOCK);
NSDate *startDate = [NSDate date];
BOOL connectionDidSucceed = NO;
while ([[NSDate date] timeIntervalSinceDate:startDate] < 5)
{
if (errno == EISCONN || connect(socketDescriptor, (struct sockaddr *)&theirAddress, sizeof(theirAddress)) == 0)
{
connectionDidSucceed = YES;
break;
}
}
if (!connectionDidSucceed)
{
perror("socket");
NSLog(@"NO CONNECTION");
[self errorMessage]; return;
}
char data[] = "did_connect();";
send(socketDescriptor, data, strlen(data), 0);
int numberOfBytes = 0;
do
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
fd_set readSet = masterSet;
FD_SET(socketDescriptor, &readSet);
struct timeval timeValue;
timeValue.tv_sec = 0;
timeValue.tv_usec = 300000;
select(socketDescriptor + 1, &readSet, NULL, NULL, &timeValue);
if (!FD_ISSET(socketDescriptor, &readSet))
{
continue;
}
char buffer[MAX_BUFFER_SIZE];
numberOfBytes = recv(socketDescriptor, buffer, MAX_BUFFER_SIZE, 0);
if (numberOfBytes == -1)
{
[pool release];
perror("recv");
break;
}
else if (numberOfBytes > 0)
{
buffer[numberOfBytes] = '\0';
NSArray *messageComponents = [[NSString stringWithUTF8String:buffer] componentsSeparatedByString:@"\n"];
NSEnumerator *messageEnumerator = [messageComponents objectEnumerator];
NSString *message;
while (message = [messageEnumerator nextObject])
{
}
}
[pool release];
}
while (numberOfBytes != 0);
[pool release];
}
Code: Select all
- (void)startRemoteAccessServer:(id)object
{
NSRunAlertPanel(@"Server started", @"The server has been correctly started.", @"OK", nil,nil);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
listenerSocket = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in myAddress;
myAddress.sin_family = AF_INET;
myAddress.sin_port = htons(2502);
myAddress.sin_addr.s_addr = INADDR_ANY;
memset(myAddress.sin_zero, '\0', sizeof(myAddress.sin_zero));
bind(listenerSocket, (struct sockaddr *)&myAddress, sizeof(myAddress));
listen(listenerSocket,100);
FD_ZERO(&masterSet);
FD_SET(listenerSocket, &masterSet);
while(1)
{
pool = [[NSAutoreleasePool alloc] init];
[pool release];
fd_set readSet = masterSet;
struct timeval timeValue;
timeValue.tv_sec = 0;
timeValue.tv_usec = 300000;
select(maxSocket + 1, &readSet, NULL, NULL, &timeValue);
int socket;
for (socket = 0; socket <= maxSocket; socket++)
{
if (FD_ISSET(socket, &readSet))
{
if (socket == listenerSocket)
{// handle new connection
struct sockaddr_in theirAddress;
socklen_t sinSize = sizeof(theirAddress);
int newSocket = accept(listenerSocket, (struct sockaddr *)&theirAddress, &sinSize);
if (newSocket == -1)
{
perror("accept");
}
else
{
if (newSocket > maxSocket)
{
maxSocket = newSocket;
}
FD_SET(newSocket, &masterSet);
}
NSRunAlertPanel(@"New client accepted", @"A client has successfully joined the server", @"OK", nil, nil);
}
else
{
// client sent us something
const int MAX_BUFFER_SIZE = 256;
char buffer[MAX_BUFFER_SIZE];
int numberOfBytes = recv(socket, buffer, MAX_BUFFER_SIZE, 0);
if (numberOfBytes == -1)
{
perror("recv");
}
else if (numberOfBytes == 0)
{
// client quit
FD_CLR(socket, &masterSet);
close(socket);
NSRunAlertPanel(@"Client quit", @"A client just quit.", @"OK", nil, nil);
}
else
{
// we got something from the client
buffer[numberOfBytes] = '\0';
NSArray *messageComponents = [[NSString stringWithUTF8String:buffer] componentsSeparatedByString:@"\n"];
NSEnumerator *messageEnumerator = [messageComponents objectEnumerator];
NSString *message;
while (message = [messageEnumerator nextObject])
{
if (!message || [message length] < 2)
{
continue;
}
NSRunAlertPanel(@"Client message sent", [NSString stringWithFormat:@"A client just said \"%@\"", message ], @"OK", nil, nil);
}
}
}
}
}
}
NSRunAlertPanel(@"Dead server", @"", @"", @"", @"");
[pool release];
}
Re: Concept: Mod downloader
--------------------
And don't forget to Sign-up our MGM community ;D
Please and thx
And don't forget to Sign-up our MGM community ;D
Please and thx
-
- Commando
- Posts: 2589
- Joined: Thu Jun 24, 2010 6:36 am
Re: Concept: Mod downloader
he has an account, he just doesnt like it lol. and hey its good to have you back. i want to test when its working (:
so idk really what this will do...
will this work for bsp mods too?
so idk really what this will do...
will this work for bsp mods too?
Re: Concept: Mod downloader
This will probably require root access, either way you go about it (that is, memory reading from process, or somehow finding the IP you're connecting to on a given port with some net utility/functionality [yummy's banner does something like that]). Root access is of course undesirable, but not much you can do here unless you want clients to enter the IP themselves, but then everything else won't be automatic....the client program hacks the IP Address out of halo (or something)
The connecting to server/establishing connection/loading map part, would seem to be a challenge to get right, if it's actually even possible. By the time you realize it's connecting to a server, the next moment it could be loading the map before you know it. Switching maps somewhere in that time frame could very well cause Halo Demo to crash. Freezing Halo Demo too long for an active client, normally, will cause the client to lag/exit out of the server. Some hosts may not have the bandwidth to transfer over a map file without creating issues as well, so data transfer would ideally have to be optimized/kept to a minimum somehow.
0.34 seconds for a map file is kind of slow, and people may have larger map collections and processor speed varies as well.
Before I attempt to dive into your code, what doesn't work exactly? Does the server start up without complaints? Does the client just time out? Also, I'd initially try using one machine instead of two different ones, and connect to 'localhost' in the client. Also, here's a notable networking resource (though it's definitely changed a bit since I've referenced it; I do it the "old" way).
I am no longer active to Halo or MGM, and don't guarantee a response on the forums or through email. I will however linger around the discord room for general chatting. It's been fun!
Re: Concept: Mod downloader
So far my code can do this:
1) It runs in the background
2) When Halo is opened, it activates
3) When you connect to a server, the ip address is extracted and halo is completely frozen (so it doesn't load the map)
4) It comes up with a connecting to server dialog...
Im having problems actually getting a working connection between the client and the host programs. I know the server Ip address, I just don't know how to code TCP in very well.
1) It runs in the background
2) When Halo is opened, it activates
3) When you connect to a server, the ip address is extracted and halo is completely frozen (so it doesn't load the map)
4) It comes up with a connecting to server dialog...
Im having problems actually getting a working connection between the client and the host programs. I know the server Ip address, I just don't know how to code TCP in very well.
Who is online
Users browsing this forum: No registered users and 12 guests