Hard-coded FTL Modding

Discuss and distribute tools and methods for modding. Moderator - Grognak
BFrizzleFoShizzle
Posts: 17
Joined: Sun Jul 19, 2015 3:43 am

Re: Hard-coded FTL Modding

Postby BFrizzleFoShizzle » Sat Apr 29, 2017 3:53 am

I can pretty much do all the assembly/reverse engeering myself, since I have heaps of experience with that. I'm also more than happy to teach people how to disassemble/reverse engineer the game if they want to help with that.

How far along is Overdrive? Writing this scriptable API for FTL would definitely take an order of magnitude less time than re-writing the entire game engine from scratch. That, and it doesn't need to be feature-complete to be useful to modders. Even with basic hooks for ships, units, weapons and events (most of which I've already partially implemented) modders would have an immensely more flexible way of interacting with the game. I totally agree though, if Overdrive is already very far along, it would make more sense to work on that.

The easiest and most useful thing for people to help me with is writing and testing wrapper classes for the game's structs in memory. Writing and testing these is reasonably simple, but somewhat time consuming. Wrapper classes need to be created to properly expose the game's structures to scripters, and to stop bad things happening when objects are accessed when they don't exist in memory.
An example of this problem is with the player ship. The player ship isn't created until you leave the hangar. This means without a runtime-checking wrapper class, if a modder tried to get the player ship health before the player ship is created, you would get a segfault, instantly crashing the game. By creating a wrapper object, you can check if a player ship currently exists before accessing the player ship pointer, and throw a nice human-readable exception that modders' scripts can handle. An example of what this looks like is the ShipWrapper and UtilityManagerWrapper classes here.
John Luke Pack Hard
Posts: 112
Joined: Thu Nov 15, 2012 8:45 am

Re: Hard-coded FTL Modding

Postby John Luke Pack Hard » Sat Apr 29, 2017 4:00 pm

BFrizzleFoShizzle wrote:How far along is Overdrive? Writing this scriptable API for FTL would definitely take an order of magnitude less time than re-writing the entire game engine from scratch. That, and it doesn't need to be feature-complete to be useful to modders. Even with basic hooks for ships, units, weapons and events (most of which I've already partially implemented) modders would have an immensely more flexible way of interacting with the game. I totally agree though, if Overdrive is already very far along, it would make more sense to work on that.


Overdrive is in its beginning stages. We're almost finished with the customization menu, just contacted the professional artist to work on the background assets so we can implement the ship select screen and the 27 layout selection buttons. In addition, I just implemented the hull UI and have yet to implement the combat system, which is a complex multi-part system that comprises of the weapons system, the targeting interface, and the projectile particle system.

If you intend for the assembly mod to override Overdrive, let me pose this question, how many features do you intend to include in your mod? We have plans to allow for unlimited ships without requiring players to replace ships in their ship selection array, in addition to allowing up to 27 layouts per ship. In addition, how easy would it be for you to implement additional augmentations into your system? I did investigation and there is a method via java Reflections and .cmd files to allow modders capable of java programming to inject their own custom-made augmentations into overdrive. I suspect it would be a slow and painful process to do so via assembly.

In addition, I plan to add additional features that aren't included in base Faster than Light. I'll reveal one right now. Timer-based campaigns (i.e. difficulty that scales and events that change based on how much time you spend on events and combat). All in all, I don't plan on stopping work on Overdrive.
BFrizzleFoShizzle
Posts: 17
Joined: Sun Jul 19, 2015 3:43 am

Re: Hard-coded FTL Modding

Postby BFrizzleFoShizzle » Sat Apr 29, 2017 10:03 pm

I actually released a mod 2 years ago removing player ship limits (http://subsetgames.com/forum/viewtopic.php?t=27852), so that's already done. I haven't looked at augmentations yet, but I'm sure it wouldn't be too hard to add an interface for them.

The whole point of this is that modders will not be working in assembly. The modders will be using ChaiScript, which is extremely similar to JavaScript. I build the interface between their code and the game (which is the C++/assembly part), and moders simply use the high-level hooks and interfaces I expose to them.
Here's an example of what a modders' script may look like. This script works right now with the code in the repo. This script draws the player ships current health on the screen, and says whether the player is in the hangar (ship selection screen).The "addDrawHook" actually modifies the assembler of the game, so that the "hook" function is called after FTL has finished drawing elements to the screen, but before the screen is displayed. This allows the script to draw UI elements on top of FTL.

As far as features - I haven't really planned that far. The things that I consider high priority are:
1. Full control over modifying weapons (C++ interface partially done, ChaiScript yet to be implemented)
2. Hooks for damage/weapon fire (i.e script event gets fired on shield/hull/unit hit/miss)
3. Hooks for in-game events (script gets triggered on in-game event)
4. Full control over ship (already implemented health/shield/power)
5. control over units (already implemented position, health, pathfinding)
This definitely isn't an exhaustive list of things I want, just the things I think are most valuable. I'm more than happy to change my priorities based on what the modding community wants, but this seems like a good start. I honestly think I can build an interface that is close to being as powerful as a full re-write, in several orders of magnitude less time. I could probably do a release with all of those features in under a month with a little help ( I only have so much spare time!). And again, I can do all the assembly stuff for this project, I just need some regular programmers to help speed up the creation and testing of the C++ to ChaiScript interfaces.

Adding timer interfaces would be extremely simple, that would take on the order of tens of minutes for me to add to the API as it is now. I've also got some simple APIs set up for drawing rectangles and text to the screen, as well as hooks for mouse + keyboard input. So, you can already add new UI elements to the screen with that.

I definitely don't intend for my API to override overdrive, but if all people want is an ultra-powerful ultra-flexible modding interface, my project will give a similar amount of flexibility for far, far less work.
John Luke Pack Hard
Posts: 112
Joined: Thu Nov 15, 2012 8:45 am

Re: Hard-coded FTL Modding

Postby John Luke Pack Hard » Mon May 01, 2017 4:19 pm

BFrizzleFoShizzle wrote:I definitely don't intend for my API to override overdrive, but if all people want is an ultra-powerful ultra-flexible modding interface, my project will give a similar amount of flexibility for far, far less work.


I can already see the end of this argument. The end result of us developing both products would either forment a split in the modding community, or an adoption of one product over the other, depending on multiple factors, so I guess the only real way to resolve the elephant in the thread, which is the underlying dispute, which I will address directly, is to simply develop both of our products and see which one the community prefers.

Given what you've said before, I see I have a month to develop the first stage of Overdrive. I'll answer your challenge. That's roughly how much free time I have before my summer classes start.
User avatar
NarnKar
Posts: 778
Joined: Thu Jun 19, 2014 4:24 pm

Re: Hard-coded FTL Modding

Postby NarnKar » Mon May 15, 2017 7:46 pm

Is this project still open? I'd like to contribute, if possible. I'd also like to check if this project is within legal grounds, as John Luke Pack Hard's Overdrive thread got shuttered by copyright.
User avatar
elijahdb
Posts: 303
Joined: Wed Dec 30, 2015 2:31 pm

Re: Hard-coded FTL Modding

Postby elijahdb » Mon May 15, 2017 9:43 pm

NarnKar wrote:Is this project still open? I'd like to contribute, if possible. I'd also like to check if this project is within legal grounds, as John Luke Pack Hard's Overdrive thread got shuttered by copyright.

I don't think it is. Last time Northern_Warrior was online was March 16th, two months ago. Unless he's been hiding away tinkering with FTL, I doubt this is still going.
I've created Type C Hulls for the enemy Mantis, Slug, Rock, and Zoltan ships, and anyone can use these for a mod.
Check out the details here.
BFrizzleFoShizzle
Posts: 17
Joined: Sun Jul 19, 2015 3:43 am

Re: Hard-coded FTL Modding

Postby BFrizzleFoShizzle » Tue May 23, 2017 10:08 am

@Narn and anyone else
My project is still going ahead. I put it on hold for the past couple of weeks to see how overdrive would work out, since JLPH seemed pretty passionate about his project, but that seems to have come to an end.
My project should be legal/not violating IP. If anyone wants me to give a speel on the legal/copyright/IP mumbo-jumbo, I can do that, but I'd prefer to skip if possible :P
CapnCrinklepants
Posts: 2
Joined: Thu May 25, 2017 5:17 pm

Re: Hard-coded FTL Modding

Postby CapnCrinklepants » Thu May 25, 2017 5:59 pm

I'm fairly certain you're in the clear BFrizzle, as you don't distribute any IP, nor so obviously recreate it. It's all freshly your own; the user has to implement the mod on their own which means they have to already own the game for it to work.

I've got a question regarding your mod though. To be vague about specifics, I have an idea where a random event will give the player an amount of scrap. That amount of scrap is to be determined through an HTTP request. I unfortunately don't know a ton about C++, and I know even less about ChaiScript. Is an HTTP request something that is possible through ChaiScript or something that would have to be built into the API's DLL? I get the feeling it would have to be something added into the API.

EDIT: This post is (more or less obviously) addressed to BFrizzle; as JLPH's project has been shut down and Northern Warrior is MIA
BFrizzleFoShizzle
Posts: 17
Joined: Sun Jul 19, 2015 3:43 am

Re: Hard-coded FTL Modding

Postby BFrizzleFoShizzle » Fri May 26, 2017 5:53 am

@CapnCrinklepants
ChaiScript doesn't have anything built-in for HTTP requests. I also don't plan on adding them to my mod. I'm trying to keep modders' scripts as sandboxed as possible, so that modders cannot create "malicious" mods.
If you wanted to use HTTP requests in your mod, you'd be free to download the FTLAPI source, add HTTP requests to that, then distribute that with your mod, but for security reasons, I don't want that in the core release.
CapnCrinklepants
Posts: 2
Joined: Thu May 25, 2017 5:17 pm

Re: Hard-coded FTL Modding

Postby CapnCrinklepants » Fri May 26, 2017 2:10 pm

Hey that is perfectly 10,000% reasonable. Thank you for the information! I have a friend that plays FTL a couple times a week and I am going to make a mod for chat/cheer interaction more or less.