Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 4 5 [6] 7 8 ... 12

Author Topic: [44.12] Musket-Mod v0.5c: Experimental Wall Breaching  (Read 41368 times)

zaporozhets

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #75 on: August 27, 2018, 06:12:45 am »

I wouldn't be so concerned with overhead if I was you.  If you are doing checks that only happen during combat, then any overhead caused by those checks will be hidden by the massive slowdown caused by combat.  No sane amount of searching through memory is going to compare to the herculean task of writing "The goblin lasher dodges the steel bolt" to hard drive.  Unless you are doing something that iterates through lists multiple times on a constant near tick by tick basis, don't even bother worrying about performance, because your dinky little script's overhead will be lost in the sea of RAM sundering computation cycles that is Dwarf Fortress.

It's a very salient point, I just see that hit of a few frames in arena mode and wonder if there's a lighter way of doing whatever it is I'm trying to do. I'll keep this in mind.
Logged

SpeardwarfErith

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #76 on: August 27, 2018, 08:38:40 am »


It's lovely of you to ask, of course you can! I've been messing about with a lasgun that makes an instant beam of 'laser' and one that has a more simple 'blaster' trail as well, but I'm not happy with the results are so far (fire rate is just to make testing easier):



Your thread seems to indicate you also have a preliminary version of it as well, I'd love to see it. I want to try my hand at the beam-shield interaction.

Wow, I don't know what you are unhappy with. That's impressive, especially the first one. How did you get the beam to work? It can't just be flows spawned on the bullet because it's moving faster than a tile a tick.

To clarify, I don't actually have any real code written (aside from the samdworm prototype), just a bit of pseudocode. I've been forcing myself to do the raws first, because that's the harder part for me and also the more important one for the mod. A beam-shield interaction should be pretty simple, something along the lines of
Code: [Select]
onProjectileHit:
    if projectile.type == beam and projectile.target.isShielded() then
        spawnflow(a fuckton of dragonfire, maybe some smoke, cave in dust, at target.pos and shooter.pos)
    end
end
Logged
The swordsman Smoma Acaltekud: Hello Ago. Life is, in a word, death.
The swordsman Smoma Acaltekud stabs you in the lower body with his iron scimitar, tearing apart the muscle and tearing apart the left kidney!
The iron scimitar has lodged firmly in the wound!

Battle Royale Mode: A DFHack Script

Grimlocke

  • Bay Watcher
  • *kobold noises*
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #77 on: August 27, 2018, 09:24:38 am »

Very impressed after a cursory reading. As a fellow noob to lua, I did not know you could set table keys like that.
I did notice you set multiProjectile.distance_flown to 6 to avoid smoke, I initially did something similar on the blunderbuss before I noticed it seemed to be teleporting the projectiles forward. It's not a problem really unless the target is nearly adjacent.
Making a general purpose projectile script is a brilliant idea.

Ah... I hadn't noticed, but this sure explains the issue of shot projectiles not hitting stuff. Thanks, I'll have to come up with something else for that. I've also manually carried over the firer ID to the multiProjectile since the one in makeProjectile didn't seem to work; shot projectile hit combat reports weren't showing as coming from the player character in adventurer mods.

I've had this issue too and just sidestepped it by giving the weapon a new ammo, the only way I could think of using the same ammo was iterating through the firers inventory on distance_flown == 0, getting projectile.firer.inventory[indx].item.subtype.id and checking against the weapon name (or checking subtype.subtype, but I like strings for readability), but it was for the automusket and I was worried about the overhead and so didn't go any further with it. Hope that works for you.

Hmm yeah, I considered something like that but I had hoped I could circumvent it by using the bow_id. It does seem to correspond to whatever ranged weapon is being used, but I can't figure how to use it. Anyhow, thefriendlyhacker probably had a point, I'll give your idea a try.

Interesting stuff. I'll need have to have more of a mess around with the projectile flags, I have no idea what I'm doing with them. I just copied them in from Roses projectile script and I keep getting a weird bug on the cannon where it only causes light bruising, setting the piercing flag seemed to fix it but now I'm not so sure it did what I thought given what you've said. Maybe I should just make the cannonball use an edge attack. Has anything like that happened to you?

Some blunt objects seem to have that effect, I've set cannonballs to be edged since they pretty much behave that way judging by historic records. Piercing is appropriate for cannonballs too, since they tended to tear through lines with fairly little regard for how many soldiers were in the way.


Edit: Alright, got weapon properties to work. Seems projectile.bow_id is the item.id of the weapon used to fire the projectile, so that let me avoid the issue of not being able to figure out which weapon was used to do the shooting, avoiding cases like 'Urist is holding a machinepistol and a shotgun, his shotgun is now a machineshotgun'.

There is uh... probably a more graceful way to do this, but I couldn't find how to match item.id directly so here's what I ended up with:
Spoiler (click to show/hide)

Also I forgot to mention: That laser gun looks pretty cool, and if you should find a way to remove projectiles after they've hit (to prevent a bunch of 'laser beams' laying on the floor) that'd be pretty useful too.
« Last Edit: August 27, 2018, 11:15:21 am by Grimlocke »
Logged
I make Grimlocke's History & Realism Mods. Its got poleaxes, sturdy joints and bloomeries. Now compatible with DF Revised!

zaporozhets

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #78 on: August 27, 2018, 11:11:24 am »

Wow, I don't know what you are unhappy with. That's impressive, especially the first one. How did you get the beam to work? It can't just be flows spawned on the bullet because it's moving faster than a tile a tick.

To clarify, I don't actually have any real code written (aside from the samdworm prototype), just a bit of pseudocode. I've been forcing myself to do the raws first, because that's the harder part for me and also the more important one for the mod. A beam-shield interaction should be pretty simple, something along the lines of
Code: [Select]
onProjectileHit:
    if projectile.type == beam and projectile.target.isShielded() then
        spawnflow(a fuckton of dragonfire, maybe some smoke, cave in dust, at target.pos and shooter.pos)
    end
end

A bunch of stuff is not great with them.

The beam works by deleting the "energy cartridge" projectile fired, getting the parametric form of the line between the firer and the projectile target (sort of like how the cannon checks a path is viable, but more dynamic (I need to update the cannon with it)), drawing the "laser" gas flow in tile-by-tile along the line whilst checking the tile for passibility and units (though maybe I should let it fire through walls and units), and if a unit is found, spawning a "beam" projectile made of "laser" somewhere close (on the line so as to be hidden by the flow) aimed at the unit.

The problems I have are: when the beam projectile misses it looks stupid flying out of the flow (I've considered firing it top down at the risk of surplus headshots), the broken laser arrows everywhere (could be easily fixed by making them not be destroyable and manually deleting them on impact) and the beam projectile is ineffective (because I'm terrible with raws).

Ah... I hadn't noticed, but this sure explains the issue of shot projectiles not hitting stuff. Thanks, I'll have to come up with something else for that. I've also manually carried over the firer ID to the multiProjectile since the one in makeProjectile didn't seem to work; shot projectile hit combat reports weren't showing as coming from the player character in adventurer mods.

Hmm yeah, I considered something like that but I had hoped I could circumvent it by using the bow_id. It does seem to correspond to whatever ranged weapon is being used, but I can't figure how to use it. Anyhow, thefriendlyhacker probably had a point, I'll give your idea a try.

You could also check to see if the projectile had any fields set differently when fired from the heavy crossbow, then check projectile type and the field and assume the weapon type from that, if you've not already tried.
I don't really play in adventure mode but I'll try and remember to update the blunderbuss with that, thanks for the info.
I'd like to make a way to create items manually without createItem() eventually, I don't like that loading the cannon changes the quality of the trapcomp.
It could just be set back and any announcements about how Urist transmogrified a crude cannonball into a masterwork by loading it into a cannon be somehow suppressed I suppose.

Some blunt objects seem to have that effect, I've set cannonballs to be edged since they pretty much behave that way judging by historic records. Piercing is appropriate for cannonballs too, since they tended to tear through lines with fairly little regard for how many soldiers were in the way.

I'll have to do that too. Could I be very rude and lazy and ask for the values you've given them, that I might just copy them in? I'd of course credit you for the improvements. I'm not too clear on appropriate raw values despite reading the relevant wiki pages a bunch of times.
Logged

scourge728

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #79 on: August 27, 2018, 11:24:15 am »

May I also have access to the laser lua stuff, for an animorphs mod I'm working on?

Grimlocke

  • Bay Watcher
  • *kobold noises*
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #80 on: August 27, 2018, 11:28:38 am »

Heh, I edited my previous post just before you responded, see that for a followup on the weapon properties thing.

Here's what I have for raws right now: https://pastebin.com/NcNidFzE of course, use whatever you like; I don't think anyone here is particularly possessive of their work and would much rather it see use in whatever way. Its really a very pleasant community we've got here.

Anyhow, what makes the cannonballs do hurt is: weight, velocity and a moderate contact area with a large penetration area (the attack token is [ATTACK:EDGED/BLUNT:contact area:penetration depth:blah:blahs:what you blah with:velocity], velocity on ammunition is only used when you use it as a melee weapon). Impact is divided by contact area (though capped by bodysize I think), so lower contact areas generally mean more impact. If you want to make a laser, you may want give the material really high shear values.

Logged
I make Grimlocke's History & Realism Mods. Its got poleaxes, sturdy joints and bloomeries. Now compatible with DF Revised!

Koumakan

  • Bay Watcher
  • Amanojaku
    • View Profile
Re: [44.12] Musket-Mod v0.4g
« Reply #81 on: August 27, 2018, 02:45:48 pm »

Oh my god.
Logged

thefriendlyhacker

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4g
« Reply #82 on: August 27, 2018, 02:53:50 pm »

Oh my god.
It is all pretty cool, isn't it?
Logged
Fallout Equestria Redux - that's right, it's back

zaporozhets

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #83 on: August 27, 2018, 03:11:33 pm »

May I also have access to the laser lua stuff, for an animorphs mod I'm working on?

Yeah, sorry for not posting it before, I was just worried about treading on SpeardwarfErith's toes.
It's nowhere near finished and pretty much a complete mess, just an experiment really.
I've tried to fix it up a little and add some comments for you, but do ask if you're unsure of anything and please let me know where I've made foolish mistakes.

http://dffd.bay12games.com/file.php?id=13983

Here's what I have for raws right now: https://pastebin.com/NcNidFzE of course, use whatever you like; I don't think anyone here is particularly possessive of their work and would much rather it see use in whatever way. Its really a very pleasant community we've got here.

Good find on the bow_id thing, going to try and make use of it. Thanks for the raw stuff too, I appreciate it and your attitude. Everyone does seem really nice.
I'm just used to seeing modders in other communities be the usual selfish artistic types, throwing tantrums and deleting all their stuff and so on.
On that note I hope everyone here who wants it grabs all this stuff before I get into a really bad mood.  ;)

Edit:
I put a thing in the lasgun script that removes the lasers after they've hit, just needs them to be made no_impact_destroy = false. Out of interest did you plan on doing anything in particular with it?
« Last Edit: August 27, 2018, 03:55:59 pm by zaporozhets »
Logged

SpeardwarfErith

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4g
« Reply #84 on: August 27, 2018, 04:45:27 pm »

Thanks for the consideration about the toes, but honestly don't worry about it. I looked over the laser code, it looks good. The functions flow pretty well, the implementation is elegant, and the only part that really bothers me about it is when you copy the entire projectile variable by variable- It seems easier to just change the existing cartridge projectile's type into a laser beam.

idk if I'll actually use your laser, I'm not at that point yet and I'm planning for some complex artificial AI to be involved (the whole mindgame of "do I risk firing in case he has a shield?" and "should I use a shield and risk angering the worms?"). It all depends on how the code is going to end up structuring itself.

This thread has been an amazing goldmine of really dramatic advances in the modding field (especially thefriendlyhacker's think_counter discovery), and I've been thinking more and more of writing a couple advanced modding guides on the wiki, that would describe various lua functions and such, and specifically some useful aspects of the data structure. I don't have time for that right now what with all my other projects, but it's a thought worth considering.

On that note I hope everyone here who wants it grabs all this stuff before I get into a really bad mood.
zaporozhets looses a roaring laughter, fell and terrible!
Musket-Mod has been missing for a week.
zaporozhets has created An Explanation of the Musket-Mod Drama, a mod bone post! It menaces with walls of text and rantings about due credit. He claims it as personal treasure.

Jokes aside, the df community is honestly the best one I've seen yet, and I can prove it. During reddit's circles of trust thing, most circles were composed of closed cliques, while the only requirement to enter the dwarf fortress circle was proof that you play df. We were among the largest circles, twice, before being betrayed by people that I'm pretty sure aren't actual df players. My theory is that it's the learning cliff that scares off most low-quality players, and the ones willing to put in the time to get past it tend to be good people.
Logged
The swordsman Smoma Acaltekud: Hello Ago. Life is, in a word, death.
The swordsman Smoma Acaltekud stabs you in the lower body with his iron scimitar, tearing apart the muscle and tearing apart the left kidney!
The iron scimitar has lodged firmly in the wound!

Battle Royale Mode: A DFHack Script

zaporozhets

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4g
« Reply #85 on: August 27, 2018, 06:01:28 pm »

Thanks for the consideration about the toes, but honestly don't worry about it. I looked over the laser code, it looks good. The functions flow pretty well, the implementation is elegant, and the only part that really bothers me about it is when you copy the entire projectile variable by variable- It seems easier to just change the existing cartridge projectile's type into a laser beam.

idk if I'll actually use your laser, I'm not at that point yet and I'm planning for some complex artificial AI to be involved (the whole mindgame of "do I risk firing in case he has a shield?" and "should I use a shield and risk angering the worms?"). It all depends on how the code is going to end up structuring itself.

I appreciate the praise. You're right about the ammo cloning, I just didn't know about setSubtype() until recently. I don't think it's documented on the DFHack wiki. I'll have to remember it exists for next time I need to do something like that.

Your ideas for Fremen Fortress sound incredible, I can't wait to play it. I sincerely hope you don't use that laser under any circumstances, unless you change it enough to no longer be able to be considered mine, it's bloody useless. I'm looking forward to poring through the scripts as a learning exercise, too.

This thread has been an amazing goldmine of really dramatic advances in the modding field (especially thefriendlyhacker's think_counter discovery), and I've been thinking more and more of writing a couple advanced modding guides on the wiki, that would describe various lua functions and such, and specifically some useful aspects of the data structure. I don't have time for that right now what with all my other projects, but it's a thought worth considering.

It is a lofty and noble idea. DFHack has so many features and functionalities, but people don't seem to be exploiting them to the full.
It seems like there is a way to do everything imaginable without the compromises necessary with raw editing alone, but the built-in modtools are complex to use (for a simpleton like me anyway) and not really adequate for more advanced stuff. A set of tutorials written by someone competent would be great and could bring in a golden age of DF mods.

zaporozhets looses a roaring laughter, fell and terrible!
Musket-Mod has been missing for a week.
zaporozhets has created An Explanation of the Musket-Mod Drama, a mod bone post! It menaces with walls of text and rantings about due credit. He claims it as personal treasure.

Jokes aside, the df community is honestly the best one I've seen yet, and I can prove it. During reddit's circles of trust thing, most circles were composed of closed cliques, while the only requirement to enter the dwarf fortress circle was proof that you play df. We were among the largest circles, twice, before being betrayed by people that I'm pretty sure aren't actual df players. My theory is that it's the learning cliff that scares off most low-quality players, and the ones willing to put in the time to get past it tend to be good people.

That made me laugh a lot, especially the due credit part.
Your theory makes a lot of sense, not to sound judgemental but I've tried explaining Dwarf Fortress to friends who I love dearly, but are by all accounts 'low-quality players' (of phone games and the like), and they just don't seem to grasp the sheer magnitude and unparalleled scope of it or take any interest.
Using a tileset just made it worse, with them fixating on a flashing icon of a horse. ::)
Logged

Grimlocke

  • Bay Watcher
  • *kobold noises*
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #86 on: August 27, 2018, 06:29:15 pm »

Heh I guess it takes a special sort of character to make sense of and enjoy DF, all the more so to also go rooting around in its bowels.

Its endlessly more pleasant than certain other modding communities cough skyrim, minecraft cough, although the audience is also couple orders of magnitude smaller I find it perfectly worthwhile. Not that other modding communities don't have their share of perfectly agreeable folks, its just they also have a share of self-obsessed 'donut steal' sorts and all sorts of generally unpleasant characters. Especially the Minecraft one... that's the community that decided to hide their work behind virus and ad riddled click monetization websites.

That sort of stuff simply would not fly here, and thats pretty cool. Anyhow, back to the subject at hand.

I put a thing in the lasgun script that removes the lasers after they've hit, just needs them to be made no_impact_destroy = false. Out of interest did you plan on doing anything in particular with it?

Thanks, seems to work! I'll be using it mostly just for cleanup of shot projectiles; things get really messy once a couple gunners start shooting at flying targets (@*!#^! keas) which has the shot drop to the floor un-destroyed, regardless of the impact_destroy flag. Same thing if they hit a wall that is above the ground. It would also be weird for bullets to be re-usable without needing more gunpowder so I've just had it delete anything starting with ITEM_AMMO_GUN.

I've also gotten the smoke to work again by hijacking projectile.unk21 to store a 'smokiness' value and having each smoke instance reduce it by 1.

The setSubtype thing I found by rooting around in the data structure XMLs, which I found a pretty useful thing to do overall.

Also +1 for an intermediate level modding guide. Just using the dfhack modtools isn't tremendously complex and you can still do plenty neat stuff with them, but nothing about dfhack docs even made it clear where to put the file for the script commands. Figuring all this out by taking apart other people's mods was (and is) a fun journey but really took a lot longer and would see a lot more people drop out than needed.

Your theory makes a lot of sense, not to sound judgemental but I've tried explaining Dwarf Fortress to friends who I love dearly, but are by all accounts 'low-quality players' (of phone games and the like), and they just don't seem to grasp the sheer magnitude and unparalleled scope of it or take any interest.
Using a tileset just made it worse, with them fixating on a flashing icon of a horse. ::)

Heh I'm sure we've all felt this. I have some friends who are pretty into gaming and even modding too but only one who got anywhere with DF, and he too lost interest after not too long.
Logged
I make Grimlocke's History & Realism Mods. Its got poleaxes, sturdy joints and bloomeries. Now compatible with DF Revised!

Splint

  • Bay Watcher
  • War is a valid form of diplomacy.
    • View Profile
Re: [44.12] Musket-Mod v0.4g
« Reply #87 on: August 27, 2018, 07:20:00 pm »

For once, I might actually need to get a mod that adds guns. Assuming they can kill reliably.

Cause this looks amazing.

Grimlocke

  • Bay Watcher
  • *kobold noises*
    • View Profile
Re: [44.12] Musket-Mod v0.4h
« Reply #88 on: August 28, 2018, 10:37:10 pm »

Some things I was pondering while going over the cannon script: The subtype increment/decrement thing used to rotate it is clever, but its going to cause weirdness if any other mods add a custom building in an alphabetically higher raw file. I'm somewhat stuck on thinking of anything better though, since I can't see to get dfhack to read the damned custom building subtype name. Theres a workaround involving making a separate pair of reactions for the North > West and West > North rotation, but it seems... somewhat ungraceful? I also don't know how it will handle the building subtype changing with reactions still queued, possibly it will keep the old reaction jobs and turn itself into a screw press. It'd be nicer if it could just use the same too jobs and do a check for 'does my subtype name end in '_N' or not'.

I also noticed the blunderbuss-missile spawner doesn't copy over ammunition quality, pelletProjectile.item.quality = projectile.item.quality should cure that.
Logged
I make Grimlocke's History & Realism Mods. Its got poleaxes, sturdy joints and bloomeries. Now compatible with DF Revised!

zaporozhets

  • Bay Watcher
    • View Profile
Re: [44.12] Musket-Mod v0.4f
« Reply #89 on: August 29, 2018, 06:09:14 am »

Thanks, seems to work! I'll be using it mostly just for cleanup of shot projectiles; things get really messy once a couple gunners start shooting at flying targets (@*!#^! keas) which has the shot drop to the floor un-destroyed, regardless of the impact_destroy flag. Same thing if they hit a wall that is above the ground. It would also be weird for bullets to be re-usable without needing more gunpowder so I've just had it delete anything starting with ITEM_AMMO_GUN.

It is weird, I think I'll have to do the same because it's bothering me now that you've mentioned it. ;D

For once, I might actually need to get a mod that adds guns. Assuming they can kill reliably.

I've not found them to be lacking, I've had many battles in the arena with no survivors, but if you try it and you're not happy let me know.

Some things I was pondering while going over the cannon script: The subtype increment/decrement thing used to rotate it is clever, but its going to cause weirdness if any other mods add a custom building in an alphabetically higher raw file. I'm somewhat stuck on thinking of anything better though, since I can't see to get dfhack to read the damned custom building subtype name. Theres a workaround involving making a separate pair of reactions for the North > West and West > North rotation, but it seems... somewhat ungraceful? I also don't know how it will handle the building subtype changing with reactions still queued, possibly it will keep the old reaction jobs and turn itself into a screw press. It'd be nicer if it could just use the same too jobs and do a check for 'does my subtype name end in '_N' or not'.

Don't know if it counts as graceful but the way I would do it would be upon fortress load, iterating through df.global.world.raws.buildings.workshops[] checking .code until it finds CANNON_N, then have the script set the index of that to a variable 'cannonSubtype' used in place of where I've clumsily stuffed a '3' and just changing '6' to 'cannonSubtype + 3'.

Mostly so I could just plug it into what's already there and not have to think too much, but you could easily use workshops[custom_type].code == foo to do a check.
Not sure what you're planning if it doesn't find it though, maybe I'm just not clear on what you intend to do with the check. I'm more excited than I ought to be to find out.

Edit:
Like this:
Code: [Select]
local cannonSubtype

dfhack.onStateChange.cannon = function(state)
if state == SC_WORLD_LOADED then
for indx, building in pairs(df.global.world.raws.buildings.all) do --not sure whether to use .all or .workshops
if building.code == "CANNON_N" then
cannonSubtype = indx
end
end
end
end


I also noticed the blunderbuss-missile spawner doesn't copy over ammunition quality, pelletProjectile.item.quality = projectile.item.quality should cure that.

Ah, I'm an idiot. Thanks for the tip, I'm very lucky to have someone noticing these things, I've put it on my list along with the same-ammo-different-weapon stuff for the automusket. I hope it doesn't spam the announcements too much when a masterwork cartridge is fired.

On a related note (to ammo quality preservation, announcement spams and me being an idiot), I've been thinking of improving the cannon loading with [PRESERVE_REAGENT] rather than cloning everything like a damned fool, but I've not tried it yet as I've been trying to focus on getting chemical weapons back in:


My partner helped me whip up a laboratory with an eroge spritesheet (that slime has done awful, awful things) but I'm a little worried it's too 'busy' for DF.
« Last Edit: August 29, 2018, 09:08:54 am by zaporozhets »
Logged
Pages: 1 ... 4 5 [6] 7 8 ... 12