Mrmaxmeier / BombSquad-Community-Mod-Manager

A Mod Manager for BombSquad
The Unlicense
132 stars 129 forks source link

Has anyone figured out how to enable full 3D movement while flying? #67

Open VinMannie opened 5 years ago

VinMannie commented 5 years ago

I'm trying to make a flying Death Match-like mod, however I can't find anywhere how to enable movements other than left/right (used by Happy Thoughts). I'm using the "enableFly=true" method.

If anyone knows what I need to do to enable 360 degree movement please let me know!

rahulraman0108 commented 5 years ago

Well, after reading, I tried to make a way for 360 degree movement in air, I did, you can freely fly in air by pressing the jump button, but it yet have problem that you can not punch, grab, or use bomb in air, I yet working in fixing those. Do you want to see a video recording?

rahulraman0108 commented 5 years ago

Also, you can not change the direction of movement in air, for that you have to land on map then take off again.

rahulraman0108 commented 5 years ago

Hey, yeah I found the solution of the first problem to a bit, now you can punch, bomb or pickup while in air but not if you have pressed jump very recently, I mean that if you are pressing the jump/fly continuously then in between you press any other button, then those will not work, but if you have pressed now the jump/fly button, then after leaving a gap of 0.1 second of time press any other button then those will work.

VinMannie commented 5 years ago

can you send video footage and/or code in the .py script?

rahulraman0108 commented 5 years ago

Here, or personally mail you?

VinMannie commented 5 years ago

here i guess

rahulraman0108 commented 5 years ago

k, wait, starting video upload.

rahulraman0108 commented 5 years ago

Here, I have written some python code, add these lines after 2 lines after importing all necessary modules:

class FlyingSpaz(bs.PlayerSpaz):
    def onJumpPress(self):
        """
        Called to 'press jump' on this spaz;
        used by a player or AI connections.
        """
        if not self.node.exists(): return
        self.node.handleMessage(
            "impulse", self.node.position[0], self.node.position[1], self.node.position[2],
            self.node.moveLeftRight, self.node.position[1] + 30, self.node.moveUpDown,
            5, 5, 0, 0,
            self.node.velocity[0], self.node.position[1] + 30, self.node.velocity[2])

Add this def with this code in your game's class in the script:

def spawnPlayerSpaz(self, player, position=(0, 0, 0), angle=None):
    """
    Create and wire up a bs.PlayerSpaz for the provides bs.Player.
    """
    position = self.getMap().getFFAStartPosition(self.players)
    name = player.getName()
    color = player.color
    highlight = player.highlight

    lightColor = bsUtils.getNormalizedColor(color)
    displayColor = bs.getSafeColor(color, targetIntensity=0.75)

    spaz = FlyingSpaz(color=color,
                      highlight=highlight,
                      character=player.character,
                      player=player)
    player.setActor(spaz)

    spaz.node.name = name
    spaz.node.nameColor = displayColor
    spaz.connectControlsToPlayer()

    self.scoreSet.playerGotNewSpaz(player, spaz)

    # move to the stand position and add a flash of light
    spaz.handleMessage(bs.StandMessage(position, angle if angle is not None else random.uniform(0, 360)))
    t = bs.getGameTime()
    bs.playSound(self._spawnSound, 1, position=spaz.node.position)
    light = bs.newNode('light', attrs={'color': lightColor})
    spaz.node.connectAttr('position', light, 'position')
    bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
    bs.gameTimer(500, light.delete)
    return spaz

This is necessary for overriding the default jump press call and do not add enableFly=True that will stop this code from working because it is jump call.

Video link here

TheMikirog commented 5 years ago

The point is, the original enableFly method restricts you in two axis by default, probably to make gameplay easier and more intuitive.

Not only it's difficult to fly in 3D space, but BombSquad has some issues with depth perception, since it doesn't use real lighting. You could hold the analog down and fly, but the game would not lift you up, but push you in the direction in midair. That's at least how it works in Happy Thoughts.

If you want to reintroduce that in 3D space, it requires a total overhaul and adjusting the level design accordingly, so that flying in 3D isn't infuriating to play against, making almost obsolete and making precise landing really hard.

I still maintain my "think before adding" mentality.

rahulraman0108 commented 5 years ago

Hey, @TheMikirog thank you for your review, it inspired me to change the code and try again, now, in the code, whenever someone press jump he is yet pussed up to maintain them in mid-air, but this time the movement of spaz do not depend on the velocity before take off, it depends on the direction the controller is giving, that means you will be pushed upwards, for not falling and also in the direction which you want, also, you can land down without getting hurt from doing some practice.

I will add the code and video once the video gets uploaded.

TheMikirog commented 5 years ago

@I-Am-The-Great What you said is possibly the best thing you could do in this situation. However almost any map in the game wouldn't benefit with you having the ability to fly. Most of them are either flat or have one more floor. I'd treat this code more as an experiment/novelty and less like something worthwhile to play.

rahulraman0108 commented 5 years ago

So, @VinMannie and @TheMikirog I present you the code for BS 3D flying spaz version 2 below:

class FlyingSpaz(bs.PlayerSpaz):
    def onJumpPress(self):
        """
        Called to 'press jump' on this spaz;
        used by player or AI connections.
        """
        if not self.node.exists():
            return
        self.node.handleMessage(
            "impulse", self.node.position[0], self.node.position[1], self.node.position[2],
            self.node.moveLeftRight * 10, self.node.position[1] + 35, self.node.moveUpDown * -10,
            5, 5, 0, 0,
            self.node.moveLeftRight * 10, self.node.position[1] + 35, self.node.moveUpDown * -10)

And a video for it could be found here.

HET396 commented 4 years ago

🥺🥺🥺Hi guys, i am new in bs but i know to edit script but pls pls pls tell me how to edit 3d fly powerup in bs pls tell from starting idk anything where to paste python 🥺🥺😭😭

SmooothSoundz commented 4 years ago

You can find 3D Fly Maps and more mods here for version 1.4. I'm not sure if it has been created on version 1.5. But I'm sure it's being worked on.

https://github.com/rahulraman0108/BombSquad-Server

I've added a powerup version of it in my servers. Maybe I can help you create it too. Join my Discord https://discord.gg/P2UkBvY

SimonRiley1001 commented 4 years ago

Pythonistas in action🌟🌟

HET396 commented 4 years ago

Im still not getting 3d fly moment the link which u gave doesn't work.

On Tue, 8 Sep 2020, 11:33 pm SimonRiley1001, notifications@github.com wrote:

Pythonistas in action🌟🌟

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Mrmaxmeier/BombSquad-Community-Mod-Manager/issues/67#issuecomment-689044521, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQZQJFGXE473WV7BTV5QQXDSEZWXHANCNFSM4GX5DRLA .