Zandronum Chat on our Discord Server Get the latest version: 3.2.1
Source Code

View Revisions: Issue #848 All Revisions ] Back to Issue ]
Summary 0000848: Customizable Random Powerups
Revision 2012-05-14 21:19 by Dusk
Description Branch here:
'https://bitbucket.org/CrimsonDusk/notebola/changesets/tip/branch(%22randompowerup%22) [^]'

Basically I went and revamped the random powerup code, allowing customization in the process. You can now define your own random spawners with any list of effects you like.

The random powerup now reads the dropitem list as a list of possible candidates. The numeric argument (generally means probability) means what bits the effect has. You may be aware that a random powerup's args[0] is actually a filter, these "probabilities" are bit numbers that are checked against the filter.

A_RandomPowerupFrame now advances a "cursor" to the next entry to the dropitem list and attempts to set it as the selected effect of the powerup. If the selection fails, it skips the frame it was attached to. If selection of ALL entries on the list are detected to fail, the powerup turns into an <!> exclamation mark of doom to prevent infinite loops. This failsafing wasn't present - if you for instance spawned a random powerup with args[0] of 16 (timefreezer only) and went to multiplayer mode, Skulltag would crash like this.

There's a couple of problems though. The aforementioned time freezer only ever is considered if the game is in offline mode. It's forbidden in even emulated multiplayer mode. What do? I was thinking about limiting the time freezer to cooperative with a way to turn this exception off somehow.

Also, I'm not sure did I adjust ARandomPowerup::Serialize properly. I'm completely unfamiliar with the Serialize method and just went with the assumption that it excepts the arc variable to be streamed pointers to the member variables.

Another one is that when you pick the powerup, the sound that's played is always the default item pickup sound... even though the random powerup only ever gives spheres. Should it cause the sound of the pickup it ultimately gives to the player?

And one last problem: what if the pickup is supposed to fail? See attached example wad with RandomRune, you can pick up two of the same rune types.

Aside from these problems, I'm pretty glad how this turned out so far. :)
Revision 2012-05-14 21:19 by Dusk
Description Branch here:
'https://bitbucket.org/CrimsonDusk/notebola/changesets/tip/branch(%22randompowerup%22) [^]'

Basically I went and revamped the random powerup code, allowing customization in the process. You can now define your own random spawners with any list of effects you like.

The random powerup now reads the dropitem list as a list of possible candidates. The numeric argument (generally means probability) means what bits the effect has. You may be aware that a random powerup's args[0] is actually a filter, these "probabilities" are bit numbers that are checked against the filter.

A_RandomPowerupFrame now advances a "cursor" to the next entry to the dropitem list and attempts to set it as the selected effect of the powerup. If the selection fails, it skips the frame it was attached to. If selection of ALL entries on the list are detected to fail, the powerup turns into an <!> exclamation mark of doom to prevent infinite loops. This failsafing wasn't present - if you for instance spawned a random powerup with args[0] of 16 (timefreezer only) and went to multiplayer mode, Skulltag would crash like this.

There's a couple of problems though. The aforementioned time freezer only ever is considered if the game is in offline mode. It's forbidden in even emulated multiplayer mode. What do? I was thinking about limiting the time freezer to cooperative with a way to turn this exception off somehow.

Also, I'm not sure did I adjust ARandomPowerup::Serialize properly. I'm completely unfamiliar with the Serialize method and just went with the assumption that it excepts the arc variable to be streamed pointers to the member variables.

Another one is that when you pick the powerup, the sound that's played is always the default item pickup sound... even though the random powerup only ever gives spheres. Should it cause the sound of the pickup it ultimately gives to the player?

And one lat problem: what if the pickup is supposed to fail? See attached example wad with RandomRune, you can pick up two of the same rune types.

Aside from these problems, I'm pretty glad how this turned out so far. :)






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2025 MantisBT Team
Powered by Mantis Bugtracker