Author Topic: Override Existing XML?  (Read 12071 times)

Offline TheDauthi

  • Newbie Mark II
  • *
  • Posts: 21
Override Existing XML?
« on: June 06, 2016, 09:02:43 pm »
I'd like to override some existing entities, and I'd like to know what the best way of doing it is, preferably without breaking future updates.  Specifically, I'm changing what floor a lot of the items can spawn on - no other characteristics of the items, which is why I'd prefer to override existing.  (I've made some other local updates, but most of them create new items, incredibilities, etc, so they sit just fine side-by-side inside Dauthi_whatever.xml).

So far, I've considered:
  • Modifying the existing files: I think this breaks updates, or, maybe just overwrites the mods on update.  Either is not great.
  • Creating a set of diffs: Better, I can apply them after an update.  Testing that had some errors, but mostly worked.
  • Just using zDauthi_whatever.xml: Works, game complains about duplicate entities.  Makes sense to me, there are duplicate entities.  I'd still rather not have those warnings, so that I can still see serious errors.
  • Using xslt, XML::Merge, (something programmatically): Probably the best option if I don't have anything else.  But I'm lazy, so I thought I'd ask, first.

Is there a simpler option I'm missing?

Offline ptarth

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,166
  • I'm probably joking.
Re: Override Existing XML?
« Reply #1 on: June 06, 2016, 09:28:52 pm »
  • If you change a file, when your game is updated, if it is check for validity, it will be over-written.
  • If you add a copy of an item (copy being defined by entity name), whichever is read in first, is the version that is kept (files are read in, alphabetically, so just append an 'a' in the file that contains what you are changing). However, it will also pop an error warning that there are multiple versions of an entity.
  • Save failures happen whenever an entity is removed from current files, but is present in your save. For example, when I changed the InvaderBoss to Invader, that broke saves. Switching the entity name back to InvaderBoss or making a copy of and naming it InvaderBoss would have fixed that.
  • diff method would work. You'd have to parse xml or ensure that the lines match exactly.
  • duplicate entries. Yep. See first.
  • not familiar enough with xlt.

I really don't worry about the duplicate entry messages, so I just slap my own file in and go from there. It depends on how widely you want to release it, what you want to change, and how much you are bothered by warning messages.

Side note, what changes were you thinking?
Note: This post contains content that is meant to be whimsical. Any belittlement or trivialization of complex issues is only intended to lighten the mood and does not reflect upon the merit of those positions.

Offline TheDauthi

  • Newbie Mark II
  • *
  • Posts: 21
Re: Override Existing XML?
« Reply #2 on: June 06, 2016, 10:55:41 pm »
Yeah, I noted that about entities being removed.  First mod I tried ended up breaking my main save.  Totally makes sense, though.

Normal diff kinda-sorta works, but not well enough for me to rely on.  An XML merge would work better.  Lots of options there.  I might just create a "mods" directory and merge from there, much like Skyrim or its ilk.  Thankfully, there's no binary cooked stuff.  This game is really, really modder-friendly, and pretty well documented, too.

The duplicate entry messages mostly only bother me because I spend all day doing code review, so I'm somewhat OCD about warnings.

For this in particular, I'm just working on allowing most of the items to be spawned on a later floor, playing with do_not_seed_if_x_floors_down.  I've been playing with hulls and making their perks more unique-per-hull, which could have used this, but didn't require it.  Next up is going to be to try to make my own enemy ship: something that has regenerating shields (or high HP, whichever) that strongly pulls player bullets towards itself.  Try to keep it next to other enemies (Your shots hit it instead of them.  I figure this is just what a blaze cannon needs: a way to ensure you can't priority target it.)

Offline Misery

  • Arcen Volunteer
  • Core Member Mark V
  • *****
  • Posts: 4,109
Re: Override Existing XML?
« Reply #3 on: June 06, 2016, 11:00:45 pm »
Your shots hit it instead of them.  I figure this is just what a blaze cannon needs: a way to ensure you can't priority target it.

I just.... what.

You're the first to suggest making the Blaze Cannons MORE dangerous and/or annoying.

Should be careful about giving me ideas like that...

I already intend on adding a new variant of those.  Inferno Cannons.  That should be entertaining.

Offline TheDauthi

  • Newbie Mark II
  • *
  • Posts: 21
Re: Override Existing XML?
« Reply #4 on: June 06, 2016, 11:32:30 pm »
Look forward to it.

I think the shield has interesting interactions with a lot of the larger enemies, making them more dangerous without changing their behavior much.  It works better than my first idea: a charger that dealt no damage, but rushed you and repelled your shots.  Make it hard to hit anything else.  Spawn it in groups (don't know how to do that one yet), add some knockback, call it a day.  Playing with repel mechanics on the player made me think it wouldn't work right: too many of the shots wouldn't hit it if it's not right on top of you, and if it's right on top of you, they all would hit.

Offline Misery

  • Arcen Volunteer
  • Core Member Mark V
  • *****
  • Posts: 4,109
Re: Override Existing XML?
« Reply #5 on: June 07, 2016, 12:42:34 am »
Look forward to it.

I think the shield has interesting interactions with a lot of the larger enemies, making them more dangerous without changing their behavior much.  It works better than my first idea: a charger that dealt no damage, but rushed you and repelled your shots.  Make it hard to hit anything else.  Spawn it in groups (don't know how to do that one yet), add some knockback, call it a day.  Playing with repel mechanics on the player made me think it wouldn't work right: too many of the shots wouldn't hit it if it's not right on top of you, and if it's right on top of you, they all would hit.


Ooh, I like this one.

Maybe something like that doesn't need to be just a mod.  I could see this one working as an actual addition to the enemy roster.

Offline ptarth

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,166
  • I'm probably joking.
Re: Override Existing XML?
« Reply #6 on: June 07, 2016, 01:07:34 am »
  • Player and Enemy shots can be repelled differently.
  • An enemy that repels player shots is hard to kill.
  • Shields sometimes just increase enemy health, so make sure the effect does something different to make it worth the cost of having a shield.
  • For multi-spawning enemies look at the Mini-Swarm Leaders GameEntity/CMP_Enemy_Ships.xml
  • grep is really useful for finding bits of code.
  • A text editor that does xml format checking is really helpful.
Note: This post contains content that is meant to be whimsical. Any belittlement or trivialization of complex issues is only intended to lighten the mood and does not reflect upon the merit of those positions.

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Override Existing XML?
« Reply #7 on: June 07, 2016, 03:09:28 am »
IFF you do an enemy that repels player shots, it should probably only have 1 hp.

I recall making reference to sacrifice items (ah, no, it was another Thing) that did gravity effects and someone's response was "shot repelling was the worst idea ever."

Oh, here, it was Misery.

Quote
Having something like a MOBILE gravity well that could appear anywhere?  No.  I guarantee you, that'll lead to unavoidable deaths. 

To be honest, the repulsion/gravity effects should never have been added in the first place.  They've been nothing but trouble from the start.
« Last Edit: June 07, 2016, 03:12:42 am by Draco18s »

Offline Misery

  • Arcen Volunteer
  • Core Member Mark V
  • *****
  • Posts: 4,109
Re: Override Existing XML?
« Reply #8 on: June 07, 2016, 04:13:06 am »
Huh.  You know, I hadn't even noticed the "repel" part of his suggestion there.  All I saw was "huge tanky thing that gets in your way and follows you to be annoying and stop you from hitting Blaze Cannons".

Yes, I do prefer to avoid the repel/attract effects.  They really are problematic enough with the gravity wells.  I had to fix SO many rooms because of those bloody things.  You cannot put anything but the smallest enemies around them, since otherwise they can make stuff undodgable.  Among other issues.

Offline TheDauthi

  • Newbie Mark II
  • *
  • Posts: 21
Re: Override Existing XML?
« Reply #9 on: June 07, 2016, 01:33:35 pm »
Yes, I do prefer to avoid the repel/attract effects.  They really are problematic enough with the gravity wells.  I had to fix SO many rooms because of those bloody things.  You cannot put anything but the smallest enemies around them, since otherwise they can make stuff undodgable.  Among other issues.

Yep. When I was first trying to figure out how it might work, I unlocked MagneticDefense inside Dayton_Powerups.xml, and found it made the player pretty much invincible.  After that, I decided that to scrap the mobile repel enemy I had been considering, and honestly, even using repel for anything.

Attraction, on the other hand, doesn't seem to face the exact same problems, at least when it comes to enemies - there's a reason that MagneticOffense is pretty good.  But attraction has a side effect that I think can be taken advantage of - it's harder to hit anything else.  I don't think it's quite as bad as a normal gravity well, since as an enemy, they're destroyable, and then things get somewhat back to normal.  For the mobile shields, giving them high HP/shields and putting them near things like blaze cannons gives the player a choice to make: do I take the annoying one or the dangerous one out first?  If it's balanced, it's a choice they have to make every single time they see one.

tl;dr: I don't want to screw the player.  I want the player to make bad decisions, and thus, screw themselves.  That's much more fun.

Knockback swarm might still work, I'm not sure.  It seems that the player would just always target them, dodging everything else in the room.

  • Player and Enemy shots can be repelled differently.
Yep.  I thought I saw some edge cases mentioned in the forum somewhere, but they didn't seem applicable.

  • An enemy that repels player shots is hard to kill.
Very much so.  It seems impossible with most weapons at a distance, at least if it works like it does on players.

  • Shields sometimes just increase enemy health, so make sure the effect does something different to make it worth the cost of having a shield.
My thought is that I don't want the enemies to be immediately killed, even by players with high damage.  They are, after all, pulling the bullets to themselves.  They need to be able to survive that.  Shields may well not be the best way to do that; needs testing.

  • For multi-spawning enemies look at the Mini-Swarm Leaders GameEntity/CMP_Enemy_Ships.xml
Thanks.  I didn't even consider the Mini-Swarm Leaders as a jumping-off point.

  • grep is really useful for finding bits of code.
Yep.  I use it in my day-to-day life.  I've also been using git to source control my local changes.

  • A text editor that does xml format checking is really helpful.
Using Sublime.  It doesn't do much for consistently formatting XML, but it does detect malformed tags.  I can always format it later (starlet, tidy)


Maybe something like that doesn't need to be just a mod.  I could see this one working as an actual addition to the enemy roster.
If you see anything interesting, feel free to grab it.  You have a lot more experience with how the system works and can get something working and most especially tweaked and tested much more quickly than I can, who started modding the game this last weekend.  I'm interested in seeing interesting stuff in the game, not about who did what or came up with what.  More importantly, I bit off quite a lot with the new perks, and I really need to do one thing at a time, or I'll keep getting distracted by new shiny toys forever.