Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: EUD ammo system
EUD ammo system
Jun 14 2020, 3:26 pm
By: goobie  

Jun 14 2020, 3:26 pm goobie Post #1



Hi All!

I'm learning EUD's (I know I'm crazy late to the party) and decided as an exercise to try and build an ammo system where enemies may take multiple shots. Since I've not seen any ammo systems that are not of the one-shot-one-kill variety on the forums here I thought I'd share my results. I was able to make it work because bit-masks are super handy for EUD's.

From what I've read on SEN some memory has been tricky to read using EUD's since we access 16 bytes at a time and much of the data is in 4 byte unsigned ints, making certain read logic require several hundred <or> statements that are really clunky in triggers. Examples included ammo systems using the weapon cooldown memory, as movement (spellcasting?) shares those 16 bytes and may be non-zero, as well as reading weapon upgrades. SCMDraft (and presumably SC:R's EUD emulator) now has a bit-mask feature that solves this problem!

Now, the details: the weapon cooldown consists of separate unsigned ints for ground and air weapons, at 0x0059CCFD (x256) and (x65536) respectively (Documentation showed there was also memory for spell cooldown at (*16777216), but a forum post said the issue was with movement data. I did not test this.) Oddly, when I tested a marine and the terran ghost hero units both ground and air cooldown memory was used to countdown the frames before the next shot. They actually seem to hold the same number, though I didn't test this with a memory scanner. The tricky bit was realizing that adding to the air weapon cooldown did not prevent the ghosts/marines from shooting (but adding to the ground weapon cooldown does!), and attempting to read the ground weapon cooldown without a bit-mask was foiled by the non-zero air weapon data.

Anyway, if the air weapon and ground weapon cooldowns are identical for hero ghosts and marines we could probably make the ammo system work without a bit-mask (and perhaps only with units that must stand still to fire/don't cast spells). Instead I masked it with "0x0000FF00" so it only compares with and writes to the four bytes I'm interested in and ignores the rest! (Though perhaps I should perform identical writes to the air weapon cooldown if they are meant to be duplicates? Not doing so didn't break anything obvious.)

Two caveats:
1) If you issue a move command right before a shot it will start the weapon cooldown and use a bullet without doing damage. I'm not sure how to fix this, and am actually kind of OK with the idea of whiffing a shot if you're trying to move.
2) I added some bullets to the minimap but was too lazy to trigger replacements when reloading.

Attachments:
EUD_Ammo_Demo.scx
Hits: 1 Size: 27.62kb



There's got to be something more to life than being really, really, ridiculously good looking...

Jun 15 2020, 11:25 pm Ultraviolet Post #2



First off, well done finding a system that works well for you that tracks shots individually, and welcome to the exciting world of EUDs! I'm looking at your triggers, and while I don't understand very well the intricacies of what you're doing, your system looks fairly elegant with just a few triggers involved.

I'd like to add that I also found a way to do this in EUD Editor 2 a while back using the advanced section of the TriggerEditor that is perhaps a little more noob friendly (uses more common language for these actions). I was making a SC Nazi Zombies recreation for SC, and though I abandoned the project, I think the triggers I came up in the time I was working with it are still useful learning tools. Here's a screenshot of the basics of it for one weapon:



The first trigger that is in Korean simply sets Player 1 as the "Current Player" which is required for certain things within EUD Editor 2 for CurrentPlayer references to work correctly. From there, most of the conditions aren't required for basic shot detection, but were implemented to detect other features of the map that were included in Nazi Zombies. The key points here were that the weapon being used had a cooldown of 20 and I detected whether or not stim had been used because in that case the weapon cooldown would be halved (separate trigger created for that with the same specifications except stim timer was at least 1 and cooldown was detected at 9 in that instance). So when the weapon cooldown was 19 and the stim timer was 0 (or empty), which was shortly after the weapon was fired, then a switch would enable that would play the sound of the weapon firing, gas and magazine dc which both represented what was currently in the magazine would be decremented and ore would increase by 10 because in Nazi Zombies you got 10 ore per shot that hit an enemy. I attached the EUD Editor 2 file if you have any interest in examining it more closely. From my recollection, this system worked flawlessly for shot detection, and was very easy to implement as it was basically point and click trigger creation, similar to working with the basic trigger editor.

Anyhow just wanted to share since you're getting into EUDs, I thought you might appreciate it. Here is a link to EUD Editor 2 if you're interested in installing it and playing around. You will need to obtain a copy of SCBW 1.16.1 to use EUD Editor 2 as the mpqs StarDat.mpq, BrooDat.mpq and patch_rt.mpq are no longer included with SC: Remastered. Nonetheless, maps created with EUD Editor 2 are fully compatible with SC: Remastered.


Edit: Included link to iccup's SCBW download.

Attachments:
SC Nazi Zombies 0.08.e2s
Hits: 0 Size: 41.26kb

Post has been edited 1 time(s), last time on Jun 15 2020, 11:30 pm by Ultraviolet.




Jun 19 2020, 7:09 am goobie Post #3



Thanks! I'm pretty partial to LIT from CecilSunkure, so my plan is to get a handle on EUD's and then build a LIT module for them.



There's got to be something more to life than being really, really, ridiculously good looking...

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:14 am]
jjf28 -- sraw531 wrong meme, https://youtu.be/jZ6nF6JKtRc
[09:39 pm]
sraw531 -- NudeRaider
NudeRaider shouted: dont repress your anger. come to the dark side!
https://www.youtube.com/watch?v=N3Zj-hMEL-k
[06:01 pm]
NudeRaider -- me? never!
[06:01 pm]
lil-Inferno -- u
[05:14 pm]
NudeRaider -- dont repress your anger. come to the dark side!
[04:55 pm]
Dem0n -- no
[04:13 pm]
Wing Zero -- Demon stop taking my box I'm bout to rage
[2020-9-24. : 12:06 am]
lifebot -- join RPG @ US WEST
[2020-9-23. : 7:10 am]
sraw531 -- ungh, looks like im going to have to do a binary count off for death messages, they aren't properly being displayed to everybody :(
[2020-9-23. : 4:22 am]
sraw531 -- maybe I should just test what happens if you teleport(move) the command centers to a location off the map every cycle while they are flying.
Please log in to shout.


Members Online: RdeRenato, Roy