Announcement

Collapse
No announcement yet.

Greed Anywhere

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

    Greed Anywhere

    Greed Anywhere

    Play Greed on any map, including Warfare and Deathmatch.

    Comments

    On Warfare maps, the conduits are placed on the closest pathnodes to the cores. On Deathmatch maps, the Red conduit replaces the Udamage, the Blue conduit replaces the shield belt.

    This is really just an alpha to see if the Warfare and Deathmatch mapping goodness could be unlocked for Greed gameplay. If anyone wants to take over this project, you're more than welcome. Just let me know. Source code is included in the download.

    Known issues
    • Not every map might be suitable for Greed Anywhere. Your Mileage May Vary.
    Compatibility
    • Bots know how to play but seem to score by accident more than anything... not that different from standard Greed, I suppose.
    • Net code not tested.
    Credits
    • Me.
    • Epic for the Unreal Tournament franchise.
    Download (includes source code)

    #2
    I would appreciate the source code for this. I tried to adapt it for my Alloverflags gametype. My intention was to replace the power cores just with the flagbases.
    In the code below the powercores, berserk, shield belt just disappear and no flag bases appear??
    Code:
    class AllOverFlags extends UTVehicleCTFGame_Content;
    
    simulated event PostBeginPlay()
    {
        if(!HasCTFBases())
        {
            // This map does not contain any flag bases.  Let's add some.
            AddBases();
        }
    
        // Let the super spawn the conduits, as per usual.
        super.PostBeginPlay();
    }
    
    // Don't filter the NoOrb mutator.
    static event bool AllowMutator(string MutatorClassName)
    {
        if(MutatorClassName ~= "UTGame.UTMutator_NoOrbs")
        {
            return true;
        }
    
        return super.AllowMutator(MutatorClassName);
    }
    
    event ActivateVehicleFactory(UTVehicleFactory VF)
    {
        // TODO: Set vehicle factory team to that of its node.
        // For now, just unlock all vehicles in Warfare.
        if(HasPowerCores())
        {
            VF.bStartNeutral = true;
        }
    
        super.ActivateVehicleFactory(VF);
    }
    
    //------------------------------------------------------------------------------
    // General.
    //------------------------------------------------------------------------------
    
    private simulated function bool HasCtfBases()
    {
        local UTCTFBase CTFBase;
    
        ForEach WorldInfo.AllNavigationPoints(class'UTCTFBase', CTFBase)
        {
            return true;
        }
    
        return false;
    }
    
    private simulated function bool HasPowerCores()
    {
        local UTOnslaughtPowerCore Core;
    
        ForEach WorldInfo.AllNavigationPoints(class'UTOnslaughtPowerCore', Core)
        {
            return true;
        }
    
        return false;
    }
    
    private simulated function AddBases()
    {
        if(HasPowerCores())
        {
            // Must be a WAR map.
            ReplacePowerCores();
        }
        else
        {
            // Must be a DM map.
            ReplacePickups();
        }
    }
    
    private simulated function ReplacePowerCores()
    {
        local UTOnslaughtPowerCore PowerCore;
        local bool bRedCoreReplaced;
        local NavigationPoint NearestSpot;
        local UTCTFBase CtfBase;
    
        ForEach WorldInfo.AllNavigationPoints(class'UTOnslaughtPowerCore', PowerCore)
        {
            if(!bRedCoreReplaced)
            {
                NearestSpot = GetNearestSpotToPowerCore(class'PathNode', PowerCore);
                CtfBase = Spawn(class'UTCTFRedFlagBase',,, NearestSpot.Location, NearestSpot.Rotation);
    
                if(CtfBase == none)
                {
                    WarnInternal("Could not spawn Red conduit!");
                }
    
                PowerCore.SetHidden(true);
                bRedCoreReplaced = true;
            }
            else
            {
                NearestSpot = GetNearestSpotToPowerCore(class'PathNode', PowerCore);
                CtfBase = Spawn(class'UTCTFBlueFlagBase',,, NearestSpot.Location, NearestSpot.Rotation);
    
                if(CtfBase == none)
                {
                    WarnInternal("Could not spawn Blue conduit!");
                }
    
                PowerCore.SetHidden(true);
            }
        }
    }
    
    private simulated function NavigationPoint GetNearestSpotToPowerCore(class<NavigationPoint> BaseClass, UTOnslaughtPowerCore PowerCore)
    {
        local NavigationPoint FoundSpot;
        local NavigationPoint NearestSpot;
        local float Distance;
        local float NearestDistance;
    
        NearestDistance = 1000000;
    
        ForEach WorldInfo.AllNavigationPoints(BaseClass, FoundSpot)
        {
            if(!FoundSpot.bBlocked)
            {
                Distance = VSize(FoundSpot.Location - PowerCore.Location);
    
                if(Distance < NearestDistance)
                {
                    NearestSpot = FoundSpot;
                    NearestDistance = Distance;
                }
            }
        }
    
        return NearestSpot;
    }
    
    private simulated function ReplacePickups()
    {
        local UTPickupFactory_UDamage UDamage;
        local UTArmorPickup_ShieldBelt ShieldBelt;
    
        ForEach WorldInfo.AllNavigationPoints(class'UTPickupFactory_UDamage', UDamage)
        {
            Spawn(class'UTCTFRedFlagBase',,, UDamage.Location, UDamage.Rotation);
            UDamage.SetHidden(true);
            break;
        }
    
        // For now, replace shield belt with Blue base.
        ForEach WorldInfo.AllNavigationPoints(class'UTArmorPickup_ShieldBelt', ShieldBelt)
        {
            Spawn(class'UTCTFBlueFlagBase',,, ShieldBelt.Location, ShieldBelt.Rotation);
            ShieldBelt.SetHidden(true);
            break;
        }
    }
    
    defaultproperties
    {
    	bAllowHoverboard=true
    	bAllowTranslocator=false
    	bMidGameHasMap=true
    	TeamAIType(0)=class'UTGame.UTCTFTeamAI'
    	TeamAIType(1)=class'UTGame.UTCTFTeamAI'
       bSpawnInTeamArea=False
       MapPrefixes(0)="WAR"
       MapPrefixes(1)="CTF"
       MapPrefixes(2)="CTF"
       MapPrefixes(3)="DM"
       GameName="AllOverFlags"
    }
    I tried batch exporting your file, but thats never 100%. If you don't mind giving me a hand I would appreciate it.

    Comment


      #3
      Updated the download to include the source code.

      That code spawns CTF flag bases on the Udamage and shield belt. After that, the main Greed gametype code places conduits on that as per usual.

      I had to extend the CTF flag bases because they had bNoDelete, which makes them unable to spawn. Maybe that was your problem. Check your log; there should be a line in there about that.

      Comment


        #4
        Well, I got my AllOverFlags game to work based thnx. However in testing I notice that some DM maps don't have a Udamage and a shield belt. Such as biohazard.

        I think it would be better if you placed the pickup (greed stand) based on a pathnode. You can place pickups (like in relic madness) 1 stand for red and 1 stand for blue any where on the map. And just use a distance (as far away as possible). Maybe you could also repalce the spawning point with team spawning points to eliminate "bSpawnInTeamArea=False" it is annoying being on red and having blue spawn in my red base in CTF/VCTF/WAR maps. To get around this you could, have your red stand placed and then place red team spawning points around them. (Also placed on top of pathnodes).

        Comment


          #5
          Nice mod! I know a few people that want something like this.

          I had started on a warfare mod but got stuck when I couldn't replace the powercores with my modified versions. They are set 'bStatic'. Although it won't work in my case, setting them hidden is a nice solution/workaround.

          Comment


            #6
            This release is still very rough around the edges. I just wanted to see if it could work, so I didn't spend any time tweaking things.

            Originally posted by euchreplayer23 View Post
            it would be better if you placed the pickup (greed stand) based on a pathnode.
            Possibly. The thing I like about the powerups is that they're always in some speshul nice-looking location. Pathnodes are often in an awkward looking spot.

            In a next version I would look for the two powerups furthest away from each other rather than always replacing Udamage and shield belt. And as a backup plan, if no powerups are found, I could always go for pathnodes.

            Originally posted by euchreplayer23 View Post
            you could also repalce the spawning point with team spawning points
            Certainly. Or overwrite the spawn point selection algorithm to pick something close to your home base.

            Comment


              #7
              Originally posted by CaptainSnarf View Post
              I had started on a warfare mod but got stuck when I couldn't replace the powercores with my modified versions.
              It's a hassle, but I'm sure there is a way. Maybe if you hide the old cores and then spawn the new cores on top and then replace all references to the old cores, like in the gametype, in the team AI and in the powernode links...

              Comment


                #8
                I've also been mulling over whether to do a mod like this, and one of the conclusions I'd arrived at was that, for Deathmatch maps, explicitly choosing locations for the conduits per map would be the only real best way to make it work. To that end, what I was planning was something along these lines:

                (1) Create a PerObjectConfig data class to store data objects containing relevant values:
                Code:
                class GreedData extends Object PerObjectConfig(GreedData);
                
                struct ConduitLocationData {
                    var vector Red;
                    var vector Blue;
                };
                var array<ConduitLocationData> ConduitLocations;
                
                struct WeaponLockerData {
                    var vector Location;
                    var array<class<Weapon> > Weapons;
                };
                var array<WeaponLockerData> WeaponLockers;
                (2) Fill a corresponding UTGreedData.ini file with entries for each data object, using WorldInfo.Name as the data object's name so that each map has a corresponding data object:
                Code:
                [DM-Sentinel GreedData]
                ConduitLocations=(Red=(X=0.0,Y=0.0,Z=0.0),Blue=(X=0.0,Y=0.0,Z=0.0))
                WeaponLockers=(Location=(X=0.0,Y=0.0,Z=0.0),Weapons=(UTGame.UTWeap_RocketLauncher,UTGame.UTWeap_LinkGun,<etc.>))
                WeaponLockers=(Location=(X=0.0,Y=0.0,Z=0.0),Weapons=(UTGame.UTWeap_FlakCannon,UTGame.UTWeap_ShockRifle,<etc.>))
                
                [DM-Deck GreedData]
                <etc.>
                (3) Finally, in the usual event functions of the mutator, use the GetPerObjectNames or whatever function to fetch the list of names of objects stored in the .ini, try to find one that matches string(WorldInfo.Name), and run the necessary code to spawn the conduits in the specified locations, spawn and fill lockers, etc. If using a ConduitLocations array as shown above, you might try randomly selecting pairings of red/blue conduit locations if several are provided.

                (4) Additionally, as a fallback, include some hard-coded GreedData objects in the mutator's defaultproperties for the set of stock DM maps, in case the .ini file is missing or no data is contained in it for a certain map ... and failing that, as a final fallback use some general logical method akin to what you implemented as far as replacing powerup bases with conduits.


                So there, that was my neat-o elegant solution to what sounds like the same problem, and I think with something like this you could pretty much have full control over where best to place conduits and whatever else you might want to include to make any DM map play well in Greed. Moreover it'd give server admins the same level of control should they think of other arrangements that might work too.

                Anyway, as usual great idea ... and for your interest, there's my two cents ... if any of that sounds good or sparks any further ideas, go for it.

                Comment


                  #9
                  That would certainly be an elegant solution. Also fair bit more work than I was planning to invest.

                  Reminds me of UT2004's Gem Feeder custom gametype, which had a special "editor mode" in which you could run around the maps and pick spots to place certain objectives. The result would then be saved to a config file. I had some great fun with that.


                  A few small issue with simply supplying locations for the conduits...
                  1. Conduits need a position consisting of a Location and a Rotation. The rotation is not essential but helps the conduit base fit in with its surroundings.
                  2. The best spots are usually those where the powerups are. As an alternative to providing a position, perhaps a "replace this thingy" could be supplied instead.
                  Also, rather than placing weapon lockers in DM maps, which would undo some of the DM gameplay where you collect weapons, perhaps you could start with the nearest X weapons. Optionally with reduced ammo counts so that you would not spawn defenseless but would still be motivated to search for more.

                  Comment


                    #10
                    An editor mode would definitely be a nice bit of polish, that's a good idea.

                    Originally posted by Xyx View Post
                    A few small issue with simply supplying locations for the conduits...
                    1. Conduits need a position consisting of a Location and a Rotation. The rotation is not essential but helps the conduit base fit in with its surroundings.
                    2. The best spots are usually those where the powerups are. As an alternative to providing a position, perhaps a "replace this thingy" could be supplied instead.
                    sure, those are good points. "ConduitLocations" and "WeaponLockers" were just examples of properties to use for the sake of illustrating the configurable design; of course anything could be added there.

                    Also, rather than placing weapon lockers in DM maps, which would undo some of the DM gameplay where you collect weapons, perhaps you could start with the nearest X weapons. Optionally with reduced ammo counts so that you would not spawn defenseless but would still be motivated to search for more.
                    Actually what I was thinking, briefly, was that for DM maps the best way to approximate CTF/Greed-style symmetry would be to stick lockers near the conduit or whatever, and fill them with the weapons furthest from that location; this way each team would have relatively equitable access to the entire set of weapons, as opposed to, e.g. depending on how the map and conduit locations happen to be set up, one team always spawning close to rockets/flak/shock while the other has only link/stinger/sniper nearby.

                    I'd imagine finding suitable conduit locations would be challenging enough just in terms of geometry, let alone in terms of weapon distribution, so something like that at least might allow a bit more freedom in choosing balanced placements.

                    Comment


                      #11
                      Perhaps a modified greed mode where you only have one conduit replacing the powerup nearest to the centre of the map, hopefully 0,0,0 in most. So it scores based on who jumped into conduit not just by which conduit, could take longer though....

                      Comment


                        #12
                        King 'o the Hill style, eh?

                        Comment

                        Working...
                        X