Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Mallmadness #32

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

[WIP] Mallmadness #32

wants to merge 6 commits into from

Conversation

dracc
Copy link
Owner

@dracc dracc commented Feb 5, 2019

I'm not proud of the current state of this.

  • Names are bad
  • Spawn points are too few
  • Classes are not diverse enough
  • Kill on exit not yet implemented
  • We still want high-ping-kill
  • No upgrade-pickups (m60/sniper/whatever) placed yet
  • Health (Model ID 366)/Armor (Model ID 368) pickups could be nice

This should be heavily refactored - main.nut should probably be a part of the game mode script. Thus this affects base/freestyle.nut too.

weaponModelIDs <- [293, 259, 260, 261, 262, 263, 264, 265, 266, 267,
268, 269, 270, 291, 271, 272, 273, 274, 275, 277,
278, 279, 281, 282, 283, 284, 280, 276, 285, 286,
287, 288, 289, 290];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these should not be in a strict numerical order. Other scripts lazily defined modelID as weaponID + 258 which resulted in the wrong pickup models.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave this comment in the code, not just on GitHub

weaponPickupAmmo <- [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 3, 3, 3, 3, 2, 10, 8, 8,
12, 12, 30, 30, 30, 30, 30, 30, 14, 12,
4, 50, 60, 60];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be balanced.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need this. If anything, it should probably be a factor for GetAmmoAtSlot. but for now 1.0 is fine.

We hopefully only have to balance the ammo that we initially spawn + maybe the overall amount of ammo that's on the server.

Vector(373.796, 1244.51, 25.6426),
Vector(356.106, 1111.4, 25.3876),
Vector(414.485, 1138.62, 22.7296),
Vector(431.755, 1078.82, 19.0915)];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add moar!

AddClass(3, RGB(100,149,237), 66, Vector(-421.729, -485.533, 11.0655), 0,
8,1, 20,15, 23,90);
AddClass(4, RGB(100,149,237), 37, Vector(-421.729, -485.533, 11.0655), 0,
9,1, 19,20, 22,90);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I said moar!


function onPlayerHealthChange( player, lastHP, newHP ) {
if ( newHP < 1 && alive[player.ID]) {
alive[player.ID] = false;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless this check is made, a whole lot of pickups are created.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the weapons from the player before spawning the pickup, so they can't drop the same weapon twice.

}

function onPlayerHealthChange( player, lastHP, newHP ) {
if ( newHP < 1 && alive[player.ID]) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HP is a float, thus not == 0.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a player has 0.999 health? Could they still be alive?

If so, I'd make this smaller for safety? epsilon = 1e-9; newHP < epsilon or something.

Copy link
Owner Author

@dracc dracc Feb 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, a smaller threshold should be in place.

scripts/base/mallmadness.nut Outdated Show resolved Hide resolved
function onPlayerCommand( player, cmd, text ) {
cmd = cmd.tolower();
if (cmd == "rules") {
Message( "No disturbing other's play. Kids only." );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be updated.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Suggestions welcome!


function onPlayerSpawn( player ) {
local pos = spawns[rand() % spawns.len()];
TeleportPlayer(player, pos, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be in a modules/random-spawn.nut or something

++zOffset;
if (!(zOffset %= 2)) {
++xOffset;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pick a random angle / random radius and spawn them, or even just split the circle into 8 sectors with fixed radius - this would also make it more deterministic where to run to grab weapons.

Something along the lines of:

radius = 1.0; // Alternative: RandFloat(0.1, 1.0)
alpha = player.Angle + i / 8.0 * 2.0 * PI; //Alternative: RandFloat(0.0, 2.0 * PI)
x = pos.x + sin(alpha) * radius;
y = pos.y + cos(alpha) * radius;

}

function onPickupClaimPicked( player, pickup ) {
if ( alive[player.ID] ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the alive array? Can't you check Player.Health > 0?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HP is a float. While burning, you might pick up the lowest hanging pickups in the current (non-wheel) system.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how that can be an issue? Are you saying burning/dead players still have health > 0? If that's the case, then the onPlayerHealthChange should also fail?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Burning people seem to have [0,1[ health for a while, the alive-check was added because more than 50 pickups were added per death.

}
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should possibly be moved to modules/drop-weapons.nut or something

scripts/main.nut Outdated
scripts_load("module/emote.nut")
scripts_load("module/teleporter.nut")
//scripts_load("module/teleporter.nut")
scripts_load("module/spectate.nut")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spectate should be disabled probably. We could have our own spectate mode with different overhead cameras instead.

@JayFoxRox
Copy link
Collaborator

JayFoxRox commented Feb 5, 2019

I wouldn't focus too much on the instant-weapon dropping for now. It just adds a lot of hacks but we might eventually don't even want it. We need to do play-testing to know - my experiences with these modes are 15 years old.

weaponModelIDs <- [293, 259, 260, 261, 262, 263, 264, 265, 266, 267,
268, 269, 270, 291, 271, 272, 273, 274, 275, 277,
278, 279, 281, 282, 283, 284, 280, 276, 285, 286,
287, 288, 289, 290];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetWeaponDataValue(weapon_index, 22) could work?

(Should return a float of the model-id, if my logic is correct)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that one (and 23) but the Molotov cocktail showed up as a missile.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They probably have the file server-side and removed TearGas or something - or you had an off-by-one to begin with? Anyhow, this list will have to stay then (for now).

local xOffset = 0;
local zOffset = 0;
local pos = player.Pos,
x, y, alpha;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style

local pickup = null;
for (local i = 0; i <= 8; ++i) {
if ( player.GetWeaponAtSlot(i) ) {
alpha = i / 8.0 * 2.0 * PI;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add the player angle or a random jitter, otherwise it's painfully obvious that certain weapons always spawn facing north

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this really be a problem though?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will probably lead to ugly pickup distribution (where it looks like parallel rows of weapons), and might also lead to certain weapons always spawning in awkward places (imagine players standing infront of a small wall to shoot, then the same kind of gun might always spawn inside the wall every time). By adding jitter or natural randomness this can be prevented.

@dracc
Copy link
Owner Author

dracc commented Feb 5, 2019

By testing for a few minutes, another issue has shown. Pickups are always gathered. This means you can have 300+ ammo for your Uzi and suddenly you end up with a Tec-9 and 3 rounds. Ideally, client should have to claim the pickup somehow.

@JayFoxRox
Copy link
Collaborator

JayFoxRox commented Feb 7, 2019

  • Ideally, client should have to claim the pickup somehow.

    Just avoid having 2 different weapons for the same class.

  • Rather than killing people outside we should just lock the doors by placing objects (doors or fence) to block the exit.

  • We should add some jitter per-weapon. The triangle of the 3 starting weapons becomes very obvious and looks.. odd, weapons should also be spread a little further.

  • The skins don't represent shoppers currently, and there is not enough variation. I'd suggest replacing it with 9, 10, 11, 15, 16, 26, 30, 31, 32, 33, 34, 42, 44, 45, 48, 50, 55, 71, 72, 139.
    It's what I consider "people you could encounter in mall" - I avoided business people and gang members, or otherwise people associated with a special role.

  • The escalators are broken - when standing on a disappearing step it throws you into the air - we'll have to add a workaround of some sort. Maybe place some stairsteps on our own to block the real stairs. See escalator: Fix escalators in north-point mall #37

  • Move the spawn camera somewhere near the mall to avoid long loading / possibly overlooking the playing area

  • Avoid spawn points in shops unless it's easy to get out of them - I had trouble with the game taking seconds to load to a point where I could see my surroundings to find the exit; generally locations where sprinting forward is an option, are the best locations


function onPlayerSpawn( player ) {
local pos = spawns[rand() % spawns.len()];
TeleportPlayer(player, pos, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a random offset to avoid spawn-killing. Also avoids people possibly getting stuck in each other.

scripts/main.nut Outdated
scripts_load("module/random_spawn.nut")
scripts_load("module/weapon_pickups.nut")
//scripts_load("module/goto.nut")
//scripts_load("module/stunting.nut")
scripts_load("module/skin.nut")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants