Announcement

Collapse
No announcement yet.

Betrayal for UT4 [Gametype][Port][C++]

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [PROTOTYPE] Betrayal for UT4 [Gametype][Port][C++]

    Update:
    This mod has been recently released. Check out its release thread here:
    https://forums.unrealtournament.com/...-Gametype-Port

    This thread still stays as development thread.



    Original post:

    Lately, I've been working on the port of Betrayal. Betrayal is a gametype in UT3 which was added by the Titan Pack patch. While this thread isn't meant to be the release thread (WIP, beta, or anything similar), I don't want to explain that gametype that much. If you aren't familiar with Betrayal or want to know what the gametype is all about, check the Liandri archive for information or watch the Guide To Betrayal video (by HenrikRyosa).

    This gametype is created in C++ (as plugin) with the latest source (2fabc2e). If you want to try it out, check the following GitHub repository:
    https://github.com/RattleSN4K3/UT4-Gametype-Betrayal

    The gametype is fully working which includes:
    • Ported sounds and textures
    • Player beacons including player score
    • Bot AI betraying team mates
    • Scoreboard showing daggers (and other stats)
    • HUD showing game type info like team, current pot and roque players
    • Additional stats for player cards
    • etc.


    Development Screens:




    There are still some workarounds for specific engine/game limitations which are requiring a change to the existing code (by pull requests for instance). The code also needs some cleanup and code commenting but in general it is pretty much finished. I would also like to create a pull request to add this gametype to the main/core game. From now on, I actually wait for made pull request and/or until changes were made to the code game (like proper team colors, character post render to HUD, etc.).


    Personal note regarding this gametype:
    I actually like that gametype a lot. But it isn't really well working for public games as the rules are very complex. If you ever played it online, you'd notice that most players just killed every team mates whenever they could. This resulted into several retribution kills which made the whole purposes of a semi-team game nullified. However, I really like playing it with players who know how to play it properly (playing as a team, increasing the pot and decide when or if to betray your mates at given pot).


    PS @Epic Devs:
    The codebase for Betrayal contains a very small portion of UE4 engine code (due to some known limitations). Also, Betrayal for UT (C++) is a straight port of Betrayal for UT3 (UC). The original code is copyrighted. I actually planned to create the gametype as pull request, but couldn't be tested quite well in that case. How to deal with such problem?
    Attached Files
    Last edited by RattleSN4K3; 09-01-2015, 12:25 PM. Reason: Typos. Fixed URL for Liandri wiki
    ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
    ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

    #2
    Since you mentioned it being a straight port of the UT3 version, I'd like to point out my UT2004 port of the game mode. Players quickly identified and abused loopholes in the scoring rules, so I added some modifications to encourage players to stick with the intended game play idea instead of turning the game into plain iDM. See the old Epic Games forums for the original release thread. (There also was a beta thread.)
    There are a number of changes from the UT3 version to improve gameplay:
    • The bot AI was improved. Bots stop trying to betray each other after one player in a three player team betrayed the team. Also they will try to betray towards the end of the game to either win themselves or prevent a teammate from winning.
    • There are some balacing changes to encourage teams to stay together for a while. You do not get the bonus for killing a player with more points than you if you are a rogue or on the same team. Also, rogue time is doubled if you betray really early.
    • The Shockrifle gets serverside ping compensation in network games. A server admin can turn this off entirely, but when the feature is enabled, clients can still turn it off individually via the Betrayal HUD settings. That menu can also be accessed through the UTComp and TAM config keybinds.
    • Team colors can be swapped via the same menu, i.e. teammates can be made red instead of blue. The color swap affects player skins, HUD and scoreboard, but not the color of the shots.
    If you want I can post my source code. (Not sure if that'd help.)
    Last edited by Wormbo; 06-27-2015, 03:20 AM.
    <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort
    <TNSe> nono
    <TNSe> its always funny to find code a week later you dont even remember writing
    <Pfhoenix> what's worse is when you have a Star Wars moment
    <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!"
    <@Mych|Lockdown> ...and the award for the most creative spelling of "Jailbreak" goes to ... "Gandis Jealbrake Server"

    Comment


      #3
      Hey Wormbo

      At the time I was writing the port, I searched if the UT3 version is actually the original one. I saw your UT2k4 port. But I didn't check the source, the threads or even playing that game types. You're right about the scoring. Not sure how to fully solve that issues. You're idea seems to work. Gonna check out your changes and threads. The quoted improvements are all related to workarounds in UT4. So I probably have to wait .

      I also planned/thought-about adding the team-invitation. There is a code part which hints that the original author tried adding an option to perform requests to specific players to form a team. There are only properties, no code logic. Not sure how that could have worked. But I'm thinking of allowing to form a team by shooting players with blue beam (alternative fire mode). Not sure if it would be a great addition or not. Sometimes the auto-team logic is not working very well and you're assigned to the same player over and over again. You would get betrayed quite often (and pay back). This would result into a fastly increasing personal score for you (and maybe even the other player) without other players even have a chance to interfere. In that case, not the best player (or the player with the best tactic) would win but the player with the dumbest teammate or the greatest luck.
      ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
      ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

      Comment


        #4
        As I've read your beta thread, there were issues about AI not trying to kill teammates (betraying). I've noticed this as well in my initial code. The AI part of Betrayal is probably hidden in native code (somehow). Some of that is also in the Squad class. However, I mostly fixed these issues by using a custom bot which rates the enemy. With that addition, the bots are working well (too well as the aiming precision is currently too high in UT4).
        ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
        ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

        Comment


          #5
          The problem with joining the same team over and over again is also fixed in the final version of my port. That part was a bit tricky due to the temporary nature of the originally stored betrayer information. But in the end I managed to keep betrayers and betrayed reasonably well.
          The key function here is BetrayalTeam.MemberWasBetrayedBy() and the fact that BetrayalPRI.Betrayed will only be cleared after forming new teams. That may cause players to stay freelancers a bit longer, but it's far less annoying than being thrown in a team with the same hated opponent again and again.

          The part about bot AI (start betraying without finishing the current hunt) should not require native code in UT2004 or UT3, as it's always possible to tell a bot to stop what it's doing and think about what to do now. The AI part about bots not stopping to betray right after they have been betrayed is also solvable by simply resetting the "I should betray now" flag and telling the bot to rethink its current strategy again.
          <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort
          <TNSe> nono
          <TNSe> its always funny to find code a week later you dont even remember writing
          <Pfhoenix> what's worse is when you have a Star Wars moment
          <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!"
          <@Mych|Lockdown> ...and the award for the most creative spelling of "Jailbreak" goes to ... "Gandis Jealbrake Server"

          Comment


            #6
            I've updated the gametype to the current UT codebase. I also released a playable version for the client build. There is an additional thread for this release:
            https://forums.unrealtournament.com/...read.php?19061

            This thread remains to be the development thread of this gametype.
            ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
            ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

            Comment


              #7
              Hey Wormbo,

              I got this gametype pretty much polished (as far as my options are) and I want to incorporate changes you made or fixing issue with the original code. I would actually like to see your additions (from source). If you like to (been able to), you can contribute to the Github repo directly.

              My pending additions are the following:
              - Fix issue with teaming for few players (like 2 which always get in the same team)
              - Allow to configure items which shouldn't be removed (like JumpBoots)
              - Invitation system (not fully sure how it could work / should've worked)
              ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
              ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

              Comment


                #8
                I probably won't actively contribute to any UT4 projects in the near future, but the UT2004 Betrayal sources are now available on Github:
                https://github.com/TheRealWormbo/UT2004-Betrayal

                I haven't looked at it in quite a while. Give me a bit to read into them again and I'll be able to help you locate the interesting parts.

                [edit]
                You'll probably want to look for "MemberWasBetrayedBy(PRI)" in BetrayalTeam and its usage in BetrayalGame as a starting point.
                Last edited by Wormbo; 09-01-2015, 01:16 PM.
                <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort
                <TNSe> nono
                <TNSe> its always funny to find code a week later you dont even remember writing
                <Pfhoenix> what's worse is when you have a Star Wars moment
                <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!"
                <@Mych|Lockdown> ...and the award for the most creative spelling of "Jailbreak" goes to ... "Gandis Jealbrake Server"

                Comment


                  #9
                  More details:
                  • On each successful betrayal (BetrayalGame::ShotTeammate()), the betrayer's PRI remembers the betrayed team (BetrayalPRI::BetrayedTeam) and victim player (BetrayalPRI::Betrayed), while the betrayed team's remaining players' PRIs remember the betrayer. (BetrayalPRI::Betrayer)
                  • BetrayalPRI::BetrayedTeam and BetrayalPRI::Betrayed are used for the check when adding players to a new or existing team in BetrayalGame::MatchInProgress::Timer().

                  I think the difference to UT3 is BetrayalPRI::Betrayed. UT3 only checked the team, but as soon as a player joins a new team, or the betrayed team no longer exists due to the betrayal, that information was gone. The UT2004 version additionally uses the BetrayalPRI::Betrayed reference to prevent adding a former betrayer to a newly formed team that already includes the previously betrayed player.
                  <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort
                  <TNSe> nono
                  <TNSe> its always funny to find code a week later you dont even remember writing
                  <Pfhoenix> what's worse is when you have a Star Wars moment
                  <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!"
                  <@Mych|Lockdown> ...and the award for the most creative spelling of "Jailbreak" goes to ... "Gandis Jealbrake Server"

                  Comment


                    #10
                    Ah thanks for the source link. Gonna look at it.

                    The teaming part is a bit rudimentary in its original state, that's for sure. Checking for the temp team reference might not always be the best. Your approach seems to solve that (judging from the explanation in your post). But if the restrictions are to complex, it might end up in a plain Deathmatch as no one is grouped due to such rules. Need to find suited rules when and how to group.

                    I'm also thinking of adding something you've posted in the beta thread:
                    Originally posted by Wormbo
                    • Teammates and rogues who betrayed you now apply a team-colored or yellow glow to their immediate surrounding area.
                    • Spawn point selection was tweaked so you spawn somewhat closer to your teammates or the rogue who betrayed you. The new algorithm also attempts to spawn you somewhere out of nearby players' sight.
                    ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
                    ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

                    Comment


                      #11
                      Originally posted by Wormbo View Post
                      I probably won't actively contribute to any UT4 projects in the near future
                      Just something offtopic, let me guess... it has something to do with Blueprint / a non-textual and non-progamming-friendly environment ... respectively no way to proper mod stuff (non-content related) for UT4?
                      ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
                      ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

                      Comment


                        #12
                        Originally posted by RattleSN4K3 View Post
                        The teaming part is a bit rudimentary in its original state, that's for sure. Checking for the temp team reference might not always be the best. Your approach seems to solve that (judging from the explanation in your post). But if the restrictions are to complex, it might end up in a plain Deathmatch as no one is grouped due to such rules. Need to find suited rules when and how to group.
                        A team can only have two members when looking for a third player to join. It's very unlikely all of the remaining players will be held a grudge against and those other players can't form a new team of their own.
                        Originally posted by RattleSN4K3 View Post
                        I'm also thinking of adding something you've posted in the beta thread:
                        The glow is essentially a light (BetrayalTraitorLight) that is attached to the corresponding player locally. The intend here is to give a better idea of where the important targets are, so they can't just run away and sit it out.

                        Spawn point selection is pretty much a complete rewrite to pick any kind of navigation point that makes sense, to randomize starts a bit more. Almost all of it should be in BetrayalGame. RestartPlayer() uses FindPlayerStart() to pick a start spot, which in turn assesses each potential start spot using RatePlayerStart(). ValidateStartSpot is used to find a nearby PlayerStart, just to still take into account what the mapper originally had in mind, regarding primary and secondary or disabled player starts. The start spot candidate is then assessed in terms of visibility by other players and whether a certain player's proxiomity should be preferred, which would include current or former teammates and the rogue. All other players are preferably avoided, but not quite as much as the proximity of interesting players is desired.
                        Originally posted by RattleSN4K3 View Post
                        Just something offtopic, let me guess... it has something to do with Blueprint / a non-textual and non-progamming-friendly environment ... respectively no way to proper mod stuff (non-content related) for UT4?
                        Maybe. But I found fun in modding UT2004 again, and the few spare time I find that I don't need to regenerate from work goes into that. Well, yeah. Part of that fun probably comes from being able to use a higher-level language than C++.
                        <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort
                        <TNSe> nono
                        <TNSe> its always funny to find code a week later you dont even remember writing
                        <Pfhoenix> what's worse is when you have a Star Wars moment
                        <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!"
                        <@Mych|Lockdown> ...and the award for the most creative spelling of "Jailbreak" goes to ... "Gandis Jealbrake Server"

                        Comment


                          #13
                          @Epic devs:
                          I would like to add a license to the code. Since the original code comes from UT3 and is copyrighted (UnrealScript), is a license of MIT or (L)GPL compliant with my port?



                          @Wormbo:
                          Hopefully, one day there will be a script language *hoping_really_hard*.

                          Originally posted by Wormbo View Post
                          Maybe. But I found fun in modding UT2004 again, and the few spare time I find that I don't need to regenerate from work goes into that. Well, yeah. Part of that fun probably comes from being able to use a higher-level language than C++.
                          I also have fun modding UT3.
                          Last edited by RattleSN4K3; 12-06-2015, 01:04 PM.
                          ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
                          ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

                          Comment


                            #14
                            Originally posted by Wormbo View Post
                            There are a number of changes from the UT3 version to improve gameplay:
                            • The bot AI was improved. Bots stop trying to betray each other after one player in a three player team betrayed the team.
                            I wasn't aware of that. Jus tested it and played UT3 bot match for about 20 minutes and it didn't happend. Could be coincidence tho as my own implementation in UT4 does have this problem. I'm not sure if there is a native code which is clearing that flag.
                            ] Map Scaler Tool | Betrayal for UT4 | No Spawn Protection | No Pickup Timer | BioLauncher (revived) | ForcePickupSpawn | Map cosmetics::P | Safe Spawn::P | Why numbers for Health/Armor suck!::ANALYSIS/CONCEPT
                            ] UT3 Addons: NoMoreDemoGuy | PickupRespawnTweak | Mutate Spec | MutePawnSounds | NoPlayerBeacon | Epic FTW | Epic FOCK | TripodSound (... and many more)

                            Comment

                            Working...
                            X