Page 2 of 5

Re: Co-opPfft,

Posted: Sun Apr 07, 2013 11:25 pm
by General BlackDragon
pfft, it'd be easy to do from the beginning, I even wrote the code for you already :D

Re: Co-op

Posted: Sun Apr 07, 2013 11:36 pm
by bigbadbogie
QF2 is story-driven. Co-op is not really possible within that, unless it is the basis of the entire game with multiple leading characters.

The best that could be done would be to have 1 main player doing all the SP mission 'stuff', and any subsequent players would be thugs - just like a big MPI.

Re: Co-op

Posted: Sun Apr 07, 2013 11:57 pm
by General BlackDragon
Well, you could make the "host" the "main" player, and the rest be just team mates, then you could even allow some objectives to be completed by the "main" player, while others could be done by any. I know BZ2 lacks any signifigant COOP other thne Dune Command, but it'd be interesting, fun, and would drive up online playing.

Re: Co-op

Posted: Mon Apr 08, 2013 12:05 am
by bigbadbogie
I have my doubts that it would ever be more than a gimmick. A few people might play it at the beginning, and then never again.

It would also detract from the mod itself if it were ONLY co-op, as people would avoid it on that basis. People like being able to save and pause their games, and not be constricted by needing to find time to play with others, set up games etc...

I think that if co-op is to be done, it should be done after the SP campaign has already been finished and released. It should not be part of the main mod initially, but an addon for anyone who wants to play that way later on.

Anyway, we are getting way ahead of ourselves. The mod is barely in the alpha-stage.

Re: Co-op

Posted: Mon Apr 08, 2013 12:09 am
by General BlackDragon
True, but this is something that should be decided at the beginning. The code does need to be "designed" for it, and the missions can use the exact same dll for both SP and coop. You just add the missions to the missions.odf file, and it'd be SP, both versions in the same maps.

Re: Co-op

Posted: Mon Apr 08, 2013 12:13 am
by bigbadbogie
Is there more to it than the DLL simply recognising and 'handling' multiple players?

Re: Co-op

Posted: Mon Apr 08, 2013 12:26 am
by General BlackDragon
Not really, MP DLLs work when you're by yourself. :P

The only other thing is that in MP, "isInfo" doesnt work, but the DLL can tell if it's SP or MP, so you can do inside that player loop this:

if(IsNetworkOn())
{
Handle Target = GetPlayerTarget(i);
if(Target == SpecialObject)
{
SomeTrigger = true;
}
}
else // Network is off, this is SP.
{
if(IsInfo("Filename"))
{
SomeTrigger = true;
}
}

Re: Co-op

Posted: Mon Apr 08, 2013 2:55 am
by bigbadbogie
So GetPlayerTarget(i); will 'get' the targets of every player.

How would you determine the target of a particular player in that list?

Re: Co-op

Posted: Mon Apr 08, 2013 3:10 am
by General BlackDragon
i is the team number of the player, when done within the code snippet on page 1.

Oh, right, I havn't explained for() loops to you yet...well, lets see.

#Define MAX_TEAMS 16; // This is already set in the source code, 16 is the number of BZ2 teams, 0 - 15.

for(int i = 0; i < MAX_TEAMS; i++)
{

Stuff in here is ran in a repeated loop, until the condition is matched. In this case, i starts at 0, and the condition is that it runs until i is >= 16 (or more literally, it runs as long as i is < 16). i++ adds 1 to i each time i loops. So, you're looping over all 16 teams in one game tick, i.e. all at the same time (atleast as far as in game is concerned)
GetPlayerTarget(int Team) takes in the team number of the player in question, so the for loop looks at ALL the player's targets, and looks for any one of them to match the required object.
}

Re: Co-op

Posted: Mon Apr 08, 2013 10:32 am
by bigbadbogie
Anyway... Back on topic.

Would it take much to edit the original BZ2 SP DLLs to get the campaign working as co-op?

Re: Co-op

Posted: Mon Apr 08, 2013 2:19 pm
by General BlackDragon
A fair amount of work. Like I said, it's something you want to do from the beginning.

Also, I've tried camera sequences, in MP they work but are jittery.

Re: Co-op

Posted: Mon Apr 08, 2013 5:56 pm
by Red Spot
General BlackDragon wrote:I find simpler is better.
Go ahead and try making simple plugins for games like X3, and still remain original and give people something to do and compeat with.

Doing things in code as a human would will already make things complex as humans tend to find alternate methods and you have to be aware of those before humans get a chance to try it.

Simple is nice if what you're trying to do allows it, no need for complexity if it doesnt serve any purpose, but that surelly doesnt make simple better.

Re: Co-op

Posted: Mon Apr 08, 2013 9:42 pm
by Red Devil
cramming steps into one statement just makes things harder to debug. it's best to break things down into individual statements to make it readable/easily followed/easily debugged.

Re: Co-op

Posted: Tue Apr 09, 2013 12:30 pm
by Zero Angel
To the OP: I would recommend ZTV Death Ray. It has been converted for use with the latest 1.3 patches. ZTV The Long Journey is also an excellent objective/event based cooperative multiplayer map, but I think that only works in the 1.2 version of BZ2.

Re: Co-op

Posted: Tue Apr 09, 2013 1:08 pm
by Ded10c
Red Devil wrote:cramming steps into one statement just makes things harder to debug. it's best to break things down into individual statements to make it readable/easily followed/easily debugged.
Modularity =/= simplicity.

Also, even modularity pales in comparison to the utility of proper commenting.