noxworld-dev / opennox

OpenNox main repository.
GNU General Public License v3.0
442 stars 23 forks source link

Multiplayer campaign #212

Open dennwc opened 3 years ago

dennwc commented 3 years ago

This is a pretty common feature request.

@angrykirc I remember you mentioned maps could be converted, but it requires quite a few changes in there. Could you please elaborate on it?

dennwc commented 3 years ago

Looks like Solo maps can be started via Arena game mode with almost no issues. There are minor some issues with the clients who join, but nothing that cannot be fixed.

dennwc commented 3 years ago

There are two separate issues, if the game is started this way:

dennwc commented 3 years ago

Currently due to #272, the game sometimes announces regular Solo games to XWIS. We noticed that it appears as a "Coop" mode in the server list. So maybe worth checking that out instead of Arena.

2asoft commented 2 years ago

If there is no good way to get "Coop" working (eg, its support in-game is just a vestige of what was planned), perhaps the target can change a little. Instead of "support playing solo maps in multiplayer", it is possible to take original solo maps, make some modifications to support proper multiplayer in them in some form (ie a new game mode of sorts, eg, there is a main player and others are 'support' of some kind, etc), and release them as a mod.

There is no fear of missing out on future updates to original maps (EA is not going to publish more updates). There will likely not be a need for workarounds within the code to allow half-baked in-game code to work. This can be used as a testing ground for all kinds of new OpenNox things -- mod support, scripting, any new strings or graphics, etc. A poll with the existing community would be a good idea, but my gut feel is that something familiar yet different can result in more interest towards the game.

dennwc commented 2 years ago

I'm not ready to give up the initial idea just yet, since even with modified maps we do need to run it via some special game mode.

But in general I totally agree with your reasoning: original maps will need to be fixed anyway for high-res, scripts will need to be adjusted for multiple players, etc.

2asoft commented 2 years ago

even with modified maps we do need to run it via some special game mode.

Why? How do we see coop working here? More than one player can't possibly get the same quest item, for example. And what happens when eg cutscenes are triggerred, do all players see them, or just one? What if they're in different locations, enough for the cutscene to not make sense for some of them?

I think a lot of scripts would have to be modified for this to be a proper coop experience, and if that work happens anyway, I think adding workarounds internally into "supporting" coop isnt the right place to spend time (treating this as a proper project with patreon funding etc, not a pet project where people just want to figure out the code, as it was in the early days of this)

dennwc commented 2 years ago

How do we see coop working here?

There are different balance setting enabled for campaign vs arena. There are different expectations about the player level (starts from 1, can level up, as opposed to capped at level 10), etc.

More than one player can't possibly get the same quest item, for example.

Yes, those are the things we might need to fix somehow. Engine already tracks silver/golden keys for Quest, so we might need to allow the same handling for custom items (via scripts).

And what happens when eg cutscenes are triggerred, do all players see them, or just one?

I would assume we will block both players (Freeze, which already works with LUA), but show an area where the first player is (the one triggered the event). We could teleport the second player, but that may break some cutscenes.

I think adding workarounds internally into "supporting" coop isnt the right place to spend time

The truth is we actually need both: proper way to run a network-enabled coop mode (for correct balance settings), and also change scripts to avoid the second player breaking them.

Evengard commented 2 years ago

I am unsure that adapting the existing campaign to coop is really needed. I'd opt for a new coop campaign, and leave the solo one for, well, solo. That still requires to solve all of the above questions, but at least we won't have problems with the maps themselves being balanced towards solo players rather than coop.

...And don't assume Nox is similar to Magicka in this regard - the RPG part in Magicka is almost nonexistant, while there it is pretty important, even if minimalistic.

2asoft commented 2 years ago

To be clear, I do definitely want coop supported natively by the engine. I just think it is too early to really focus on that.

My thinking on coop in general is that taking something that players are familiar with (campaign) and creating something different based on it (coop campaign-like experience) would be interesting to play. Whole new maps can be built too, its just more time consuming.

The benefit of changing maps instead of changing engine is that a lot more can be accomplished (we dont understand everything in engine, but scripting is much better understood now, plus we have lua scripting that could be demonstrated well with this).

This would also allow for playing with balance etcall within maps, distributing them quickly (its just a mod update), and seeing results. Once we're ready to do proper in-engine coop, we'll have all those learnings.

dennwc commented 2 years ago

Not dismissing the messages above, but two things are still valid:

  1. Patrons voted for Multiplayer Campaign during features voting, so we must at least start working on it.

  2. We cannot run new campaign maps without figuring out how to start game in solo-like mode, but with network enabled. See the point above regarding balance, leveling up, etc.

So at the end, my argument still stands: we should figure out how to enable that solo-like mode and just use existing maps to have at least some (possibly buggy) MVP during this cycle.

2asoft commented 2 years ago

ok that's true, Patreon priorities win :)

Ephreaym commented 10 months ago

There are two separate issues, if the game is started this way:

  • If the second player joins AFTER the Solo map is started, he correctly joins the host's team, but sees a black screen.
  • If the second player joins BEFORE the Solo map is started, he joins incorrect team, but everything else works.

The second issue can be resolved by adding the new team function.

For example:

package test

import (
    "github.com/noxworld-dev/noxscript/ns/v4"
)

func init() {
    ns.NewTimer(ns.Seconds(2), func() {
        ns.PrintStrToAll("Welcome to Nox coop campaign.")
        TeamHost := ns.GetHost().Team()
        arr := ns.Players()
        for i := 0; i < len(arr); i++ {
            ns.Players()[i].Unit().SetTeam(TeamHost)
        }
    })
}

If we could hook onto WideScreen and Frozen and have a function to observe the host, that could work for cutscenes.

dennwc commented 6 months ago

I have some news here. I recently played with my friend to figure out what's missing.

Things work surprisingly good, to be honest. I expected far more breakage in terms of scripts or map switching, for example.

First, here's what we did exactly:

  1. Create regular chat lobby.
  2. Second player joins.
  3. set maps allow.all and load wiz01a.
  4. Fix for P2 team: eval ns4.Players()[0].Unit().SetTeam(ns4.Players()[1].Team()).

That was enough to get things going :tada: Later we did hit a few issues:

Other random thoughts:

I will start opening tickets for some of these to finally move it further :rocket:

dennwc commented 6 months ago

Also, going back to the idea about a new campaign - totally agree.

Now that the new NS4 scripts are more mature we can convert old scripts to it and start modifying them. I'm already working on it in the background. It definitely takes time, but nothing hard there.

Ephreaym commented 6 months ago

I guess you could start from quest and use something like:

    ns.Players()[0].Unit().ChangeGold(ns.GetHost().GetGold()) // In a loop to keep it updated.
    ns.Players()[0].Unit().SetMaxMana()
    ns.Players()[0].Unit().SetMaxHealth()

The same could be done for strenght. And then you could simply increase them for each milestone.

dennwc commented 6 months ago

Yeah, need to try the Quest mode instead of Arena. It should be much closer to campaign in terms of settings.

dennwc commented 5 months ago

Definitely works better with Quest mode as a base!

Roughly the same procedure:

  1. Host Quest game.
  2. Let other player(s) join.
  3. set maps allow.all and load wiz01a.

No need to fix teams! Also, spell books work as they should too (you start with no spells and collect them as you go).

Didn't test if dying triggers instant death screen or consumes lives as in Quest.

Strangely, despite it's being based on Quest, you see your own HP/MP, but not the others. Also no player names.

dennwc commented 5 months ago

Added a couple of commands in 2f6df5db993033de505d4d66be8a9538394aa9b6:

Ephreaym commented 5 months ago

Awesome! I’m going to try and convince a friend to have a go with me.


From: Denys Smirnov @.> Sent: Tuesday, January 30, 2024 01:23 To: noxworld-dev/opennox @.> Cc: Ephreaym @.>; Comment @.> Subject: Re: [noxworld-dev/opennox] Multiplayer campaign (#212)

Added a couple of commands in 2f6df5dhttps://github.com/noxworld-dev/opennox/commit/2f6df5db993033de505d4d66be8a9538394aa9b6:

— Reply to this email directly, view it on GitHubhttps://github.com/noxworld-dev/opennox/issues/212#issuecomment-1915819113, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A7B6EX7CQC443WPEGR22UKLYRA4ORAVCNFSM44RM6HN2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJRGU4DCOJRGEZQ. You are receiving this because you commented.Message ID: @.***>

Ephreaym commented 5 months ago

The campaign maps have the deathscreen hooked to PlayerDeath(). That's why it happends. If we can prevent that I think we solved that issue.

Ephreaym commented 5 months ago

Yea, you respawn at the start of the map if you remove the deathscreen from the original playerdeath function. This leads to some issues at times though. For example getting locked out of locations that have been walled off.

Ephreaym commented 5 months ago

If started with quest: 1.) On death you don't lose ankhs, just respawn. 2.) On death you drop all items. This creates a duping effect because you respawn with gear.