Game Agnostic Chicken Defense (Some assembly required)

Game Agnostic Chicken Defense (Some assembly required)

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

Ok, so there is a repo for it here: https://github.com/Spring-Helper-Projec ... en-Defense

I have abstracted everything that I can (unittextures doesn't play nice with being in subdirectory due to the fact that upspring doesn't seem to care for it).

Ideally, the readme will explain to you how to set it all up. The text files contain copy-pasta snippets that you can use to dump it all into your game. The point here is to make it easy to add, and easy to remove. I've removed pretty much all the BA stuff and I've moved everything that I could to a subdirectory for easy storage.

Some of this might be broken (shouldn't be (tm)), but it would be cool if I could get some people who are more experienced in dealing with chickens to help me get it to the point to where it will work upon implementation.

Those of you with projects... Can you help me out? As it isn't a straight up drop in (implementation shouldn't take more than 5 minutes though), it must be implemented into a game to test. That's a crappy downside, but due to the expansive nature of chickens, it is a necessary one.
User avatar
Karl
Panzerstahl Developer
Posts: 746
Joined: 01 Apr 2010, 21:05

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Karl »

thanks for that looks like it will come in handy. I will be looking into it later.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

The unitdefs are still a hot mess. I'm going to end up spending a lot of time just unfucking them, so yay to that.

I'm going to try to embed it in BA today and see if it works. Ideally if I fix any errors it gives with BA, it should work for anything else.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

There seem to be no more errors in BA, so give it a shot in your own projects and see if it works.

The defs are still a travesty, but it should work(tm) properly.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

[f=-000001] Error: Failed to load: chicken_spawner_defense.lua ([string "LuaRules/Gadgets/chicken_spawner_defense.lu..."]:286: attempt to index field '?' (a nil value))

That is the error I am getting in evo. As you can see here:
https://github.com/Spring-Helper-Projec ... e.lua#L286

It is having issues with the chickendeftypes table that should be available from the config that is loaded at the top of the gadget.

I need to know if any other games are having this issue, but I don't know what games are compatible with spring 103. Is Metal factions 103 capable?

Edit: Yes it is and I was able to get chickens working it it correctly.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

Updated evo's gadget handler (was using one from 101) and the callins list, which fixed the issue that evo had.

Next I'm going to go through and unfuck the defs (and oh my god are they shit).

So you can use this as is with few to 0 issues, but I want to put some more work into making it more user friendly before I'm happy with it.
User avatar
Karl
Panzerstahl Developer
Posts: 746
Joined: 01 Apr 2010, 21:05

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Karl »

Alright, thanks for the effort man.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by raaar »

I haven't tested MF extensively with 103.0 yet, it's on my todo list.

The idea is nice, but apparently you can't really have game-agnostic chicken defense. I guess you could call it "chicken defense package that can be easily customized to fit most games".

Maybe it'd be nice if we could have an "addons" directory within the game package where we could place sdd directory trees for such things like chicken expansions, without its files having to be mixed up with the game files in each of the existing subdirectories. Maybe it's not worth the trouble.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

raaar wrote: Maybe it'd be nice if we could have an "addons" directory within the game package where we could place sdd directory trees for such things like chicken expansions, without its files having to be mixed up with the game files in each of the existing subdirectories. Maybe it's not worth the trouble.
Yes plox
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Silentwings »

You can just make one sdd depend on another via modinfo.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

But the second is outside of the first. We are talking about add-ons that are in addition form that are still inside the structure of the main game. That would be very nice.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Silentwings »

"addition form" means nothing precise to me - there are both mutators and libraries. The situation is that:

If it has lua entry points of its own -> own archive/sdd is needed; using a subdir is not practical and would cause the VFS to go bananas.
If it does not -> you can already create your own addons subdir and call files from within it e.g. https://github.com/SpringCabal/LD35/tree/master/libs.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by gajop »

I'd advise you avoid the name "addons", since it might be confusing as this is what players might install to modify your game.

What you mention sounds a lot like libraries, and even though Silentwings provided a decent example, I suggest you check Chobby, as that's the best example currently.
In particular, it's worth looking at the liblobby library, which has a pretty decent format: https://github.com/Spring-Chobby/Chobby ... s/liblobby . Each library is loaded like this: https://github.com/Spring-Chobby/Chobby ... config.lua , and there is no need to copy any files from the particular library (they're all kept in their own subdir)

The only limitation is that this doesn't currently work with gadgets, and it could use a few more improvements for things that should support luamenu, luaintro and luaui (like chili).
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

Hmm, as often as I've been inside chobby, I don't think I've ever bothered to take note of it's file structure. I'll give it a look.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

Progress report:
Unitdefs significantly cleaner now
Added a check for modoptions... chicken defense must be enabled specifically in modoptions now to work. This keeps the gadget from doing stupid crap when a nullai or other ai is in the match and not a chicken defense ai. This could be cleaner as in we could look for a chicken defense AI and then set it's status to enabled, but this was a simple low-tech solutions so for now it will do the trick.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Game Agnostic Chicken Defense (Some assembly required)

Post by Forboding Angel »

Thanks to hoko for pointing me in the right direction, and sprunk for helping me clean up my ultimately messy solution...

As of an hour ago, chickens now will detect if a chicken ai is present and enable/disable itself accordingly. a modoption is no longer necessary.
Post Reply

Return to “Lua Scripts”