Gametype: Last Man Standing

Introduce your project and write about your work.

Moderator: PPS-Leaders

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: Gametype: Last Man Standing

Post by x3n » Mon Nov 01, 2010 5:10 pm

looks like I'm in a posting spree, but I just remembered what I did when the game crashed: I added some bots (addbots x), then removed them again (killbots x) - the game crashed because the removed bots are still in the map timeToAct_. you need to erase leaving players from all your maps in LastManStanding::playerLeft(). :)
Fabian 'x3n' Landau, Orxonox developer

The Jo
General DuGalle
Posts: 121
Joined: Mon Mar 01, 2010 7:43 pm

Re: Gametype: Last Man Standing

Post by The Jo » Tue Nov 02, 2010 10:06 pm

About the last commit:
Done:
-all maps are erased correctly
-camper alert message vanish immediately
-respawn delay message counts down
-new players get the minimum of all lives available, but always more than 0.

Next:
-HUD: Shouldn't be very difficult, but I still have to figure out how to do it.
-punishment function which deals damage to the pawn: That suggestion was very helpful for me, since I didn't really understand how the pawn class worked. Although I learned something essential about orxonox, my first implementation caused crashes, so I commented it out.
-wrong placed part in the ring: That bug is weird: Whenever I reload the level the double pillars are located differently. (Or more exact the second pillar doesn't seem to be located always on the same possition.)

P.S: Thanks a lot x3n! Your review had been really helpful.
Fail. Fail again. Fail better.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: Gametype: Last Man Standing

Post by x3n » Wed Nov 03, 2010 1:56 am

cool, I just tested it and the new features seem to work well :)
-HUD: Shouldn't be very difficult, but I still have to figure out how to do it.
You have to create a new overlay element. Have a look at Pong or TeamBaseMatch, both gametypes have a custom HUD element that displays some text (score, players, bases, ...). You can create a new element that inherits from OverlayText and implements a tick() function. In each tick the overlay element checks the number of remaining lives of the player and sets the displayed text accordingly. Have a look at src/modules/overlays/hud/TeamBaseMatchScore.cc as an example.

It's a little tricky to get the players lives though. The hud-element belongs to the player (PlayerInfo) - so in the hud element, you can use something like this:
Pawn* pawn = dynamic_cast<Pawn*>(this->getOwner()->getControllableEntity());
LastManStanding* lms = dynamic_cast<LastManStanding*>(this->getOwner()->getGametype());
int lives = lms->getRemainingLives(pawn);

Note that getRemainingLives() would be a function in LastManStanding and has to be implemented first. You should also add a few if-statements in this code, because all getXYZ() functions and dynamic_casts could potentially return a NULL pointer.

Feel free to ask if something is unclear - or just create the new files for the hud element and do as much as you can, then cry for help :D
-punishment function which deals damage to the pawn: That suggestion was very helpful for me, since I didn't really understand how the pawn class worked. Although I learned something essential about orxonox, my first implementation caused crashes, so I commented it out.
Really? I just commented it in and it works fine for me :coding:
-wrong placed part in the ring: That bug is weird: Whenever I reload the level the double pillars are located differently. (Or more exact the second pillar doesn't seem to be located always on the same possition.)
I had a look at it and there are actually 2 problems:
1) the hole exists because your first for-loop doesn't start with 0. I tested this and it worked for me:

Code: Select all

<?lua
max = 16
for i = 0, max, 1
do
    y = math.sin(i/max*6)*750
    z = math.cos(i/max*6)*750
    ?>
2) The flickering happens because you have a 2nd for-loop that creates 16 nested pillars with different size at the same position :shock:
you can safely remove the second for-loop and set j = 1 or maybe j = math.random() * 0.2 + 0.8 if you want some randomness. ;)
Fabian 'x3n' Landau, Orxonox developer

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests