Skip to content

Allow users to set up more than one Laptop Gun sentry#446

Draft
blaiz wants to merge 1 commit intofgsfdsfgs:portfrom
blaiz:multiple-sentry-guns
Draft

Allow users to set up more than one Laptop Gun sentry#446
blaiz wants to merge 1 commit intofgsfdsfgs:portfrom
blaiz:multiple-sentry-guns

Conversation

@blaiz
Copy link
Copy Markdown

@blaiz blaiz commented May 20, 2024

Here's a draft PR to allows users to set up up to 1000 sentry guns instead of just one. This can be fun in multiplayer, where you can have a level covered with sentries everywhere.

This is a draft PR just to gauge interest. If this is something we'd want, this would likely need to be a setting somewhere, or potentially a cheat. I'm not sure how that would work since the game allocates memory for a certain number of sentries, so I don't know how to make that dynamic yet but I can spend a bit of time and figure that out if there's interest.

As it currently is, this game works well most of the time but the game does crash sometimes.

Screenshot 2023-11-20 002111

Screenshot 2023-11-24 185652

struct autogunobj *g_ThrownLaptops = NULL;
struct beam *g_ThrownLaptopBeams = NULL;
s32 g_MaxThrownLaptops = 0;
s32 g_MaxThrownLaptopsPerPlayer = 1000;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Each user can now set up up to 1000 sentry guns

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1000 is insane though I admit

setupLoadModeldef(modelnum);
modeldef = g_ModelStates[modelnum].modeldef;
laptop = &g_ThrownLaptops[index];
s32 laptopIndex = index * g_MaxThrownLaptopsPerPlayer;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is when the user sets up a new sentry. All sentries are stored in one big array, so now that each player can have multiple, let's multiply the player index with the number of sentries per player to find the start of the searching space. Then let's iterate over the space allocated for that user until we find a free space to store that new sentry gun in memory.

@FrostKnight
Copy link
Copy Markdown

To be honest, I think 10 is more than sufficient. :P

@blaiz
Copy link
Copy Markdown
Author

blaiz commented Oct 2, 2024

You haven't met my kid 😀
Unfortunately I think this change makes the game crash randomly every once in a while.

@FrostKnight
Copy link
Copy Markdown

You haven't met my kid 😀 Unfortunately I think this change makes the game crash randomly every once in a while.

I still feel like there should be a limiter option for this lol.

@FrostKnight
Copy link
Copy Markdown

Someone tell me when this is added to a new stable, this has my interest. :)

@FrostKnight
Copy link
Copy Markdown

FrostKnight commented May 9, 2025

I'm sorry to say, I don't think this will ever be added to stable because it has a huge potential for instability and crashes, unless someone wants to take the time to debug it properly. In the meantime you can clone the repo, then cherry-pick this commit in a new branch and build that to use it.

Would that remain true if it was limited to anything under 4? The number of laptops being limited to say, only 3?

How many laptops could you have the limit be at and still have crashes but very rare like the stable.

20? 10? less than 10? Curious

@blaiz
Copy link
Copy Markdown
Author

blaiz commented May 10, 2025

That's a good question. It would require enough testing to convince the maintainer that it can be merged into the port branch. In the meantime I'd recommend building your own copy of the game. Let me know if you need help doing that.

@FrostKnight
Copy link
Copy Markdown

FrostKnight commented May 10, 2025

That's a good question. It would require enough testing to convince the maintainer that it can be merged into the port branch. In the meantime I'd recommend building your own copy of the game. Let me know if you need help doing that.

Your build is too far back, its like 300 commits behind.

Also, I think 1000 is a bit nuts personally. That is asking for crashes lol.

I am not into 1000, maybe like at most 10?

Just sayin... I think trying for a lower number than 11 like 10 or less, would make it less crash prone. Just a guess but 1000 sounds too damn crazy.

Actually, make it 5 and an optional experimental setting that can be turned on in advanced with a "could be buggy" warning next to it

@blaiz
Copy link
Copy Markdown
Author

blaiz commented May 10, 2025

What I mean is you can clone the current repo here locally, create a new branch, git cherry-pick 13a415a from my repo, tweak it to be 10 instead of 1000 and you're good to go. And yes 1000 is crazy, 10 is more reasonable. There's probably a way to put this behind a setting in the Extended menu, even potentially make it dynamic and controllable in the UI or something but I don't have the expertise nor the time to do that at the moment. Maybe someday.

@FrostKnight
Copy link
Copy Markdown

What I mean is you can clone the current repo here locally, create a new branch, git cherry-pick 13a415a from my repo, tweak it to be 10 instead of 1000 and you're good to go. And yes 1000 is crazy, 10 is more reasonable. There's probably a way to put this behind a setting in the Extended menu, even potentially make it dynamic and controllable in the UI or something but I don't have the expertise nor the time to do that at the moment. Maybe someday.

Recommendation for commands to run?

Just asking, because I don't know how I would do this.

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