Operation: Clonebay

Discuss and distribute tools and methods for modding. Moderator - Grognak
preflex
Posts: 20
Joined: Sun Mar 01, 2015 2:19 pm

Operation: Clonebay

Postby preflex » Mon Mar 16, 2015 1:25 am

OPERATION: CLONEBAY

Clonebay is a re-write of FTL in python. The front-end i/o and the backend game logic are implemented separately, for easy porting. The backend uses no imports other than stock Python stuff, and the included xmltodict library. The front-end uses pygame but it should be easy to port it to something like Kivy, or really anything that can use python, such as Blender Game Engine, python-ogre, etc. Go nuts!

Planned Features:
1. Extended platform support
2. Easy modding
3. Python scripting
4. Clonebay Gamepack
5. Customizable UI layouts
6. Console (Text-only) Mode
7. Enhancements

1. Extended platform support:

One of the goals of Operation: Clonebay is to be able to play FTL on devices that you cannot already play FTL on, most notably, slower Linux ARM systems that have screen resolutions lower than 1280x720 or 4x3 aspect ratios.

I can test on and plan to eventually get around to supporting following OS/Hardware configurations (in order of priority):
Kubuntu 14.10 AMD64 (I write it on this)
Raspbian Jeissie armhf on Raspberry Pi model B (512 megabytes of RAM)
Arch Linux on HP Touchpad (tenderloin) (1024x768 res)
Maemo5 (Fremantle) on Nokia N900 (800x480 res!) (Some packages outdated)
Android 4.x on HP Touchpad

(Notice that Android is at the end of the list)

If it also works on your computer, that's nice. But please don't bother me with Windows-specific or MacOS-specific bugs, unless you also have a fix. I don't use those platforms, or have them available to test and fix bugs. Eventually, I'll look into packaging for mainstream desktop operating systems, but for now they are a really low priority to me. Anyhow, you should be good on any OS that has Python 3.4 and Pygame compiled for 3.4. Eventually, I plan to backport it to python 3.x (I just need to not use pathlib) and maybe even 2.7

2. Easy Modding
While I plan to support .ftl mod files, this new engine gives us the opportunity to do something better.
Example:
In official FTL, for a modder to add a new player ship, they have to replace an existing one.
Clonebay, however has no such restriction. New ships can just be added to the pool, if the mod is converted to the new gamepack format.

I will provide more complete documentation of this as the project evolves. I am interested in feedback. What features would mod authors like to see supported?

3. Python Scripting (Oh yeah, baby)
The plan is for any element, such as a weapon or event, to optionally add a python script.
I'll be working on the API once I've finished more of the backend logic.
The full power of python is in your hands. wield it responsibly.

4. Clonebay Gamepack

This is where I will need a lot of help from you, the awesome badasses of the FTL modding community.
The Clonebay gamepack is a standalone, redistributable gamepack that will allow you to play the game without using any of Subset's copyrighted material.

In the short term, the goal is just to whip up something minimally-playable, so modders can test against the absence of vanilla FTL.
In the long term, we have the opportunity to build a community-curated, high-quality, ever-expanding universe to die in, over and over again, until we die IRL.

Captain's edition might make a good base for this, if we can remove the FTL dependencies.

This will be at https://github.com/Preflex/Clonebay_Gamepack
This portion of development should probably get its own thread.

5. Customizable layouts

FTL (desktop) really only supports 1280x720. I want to be able to support arbitrary aspect ratios and resolutions. The UI layout will be declared in xml. This ui_layout.xml (and its associated image files) can be incorporated into a gamepack, or distributed separately.

6. Console (Text-only) mode

It is what it sounds like. Play FTL in your favorite terminal emulator!

7. Enhancements

Better crew.
Configurable:
Wimpy mode (Flee when below 1/5 hp)
Smart pathfinding. (Avoid damage)
Waypoints

Auto-jump for FTL drive.

View whole sector map outside of exit beacons.

Better stats:
Complete 'Captain's Log' history for every jump of every ship you ever play.

Events will be able to play sounds, display images, and even play video.

AND MORE!

PROBLEMS, ISSUES, RIDDLES:


I have manually edited every single xml file in order to get this to run. But some of my edits suck. I've removed too many comments, and potentially some data that may cause problems. I have patches that you can use, but I should really re-do all of them. If I was smart, I would probably solve problem no. 1 first.

It would be nice to have a tool to unpack and patch the data files to build the FTL gamepack, but it does not need to be integrated into the game. If you know a good way to make this not painful for Windows/Mac users, I could use your help. (Vhati? Anyone?) I prefer to stick to python, but I'm not opposed to a java unpacker/patcher tool (since you don't have to run it on the same system where you actually play the game). It doesn't seem like it would be an enormous amount of work to modify one of the existing unpackers to do this.

3. Seriously, be careful with those scripts. They are not sandboxed. Giant alien pythons are no joke!

CURRENT STATUS:
I've been working on this for a while. There's a lot done, but there's still a long, long, way to go. It seems that many other people have tried to do something like this, and given up. What can I say? I'm dumb enough to try, and maybe I'm smart enough to pull it off. This is my first dev project outside of school, and my first reasonably-large project in Python, which I haven't used in years. It took me a while to wrap my head around this, and gain a good understanding of how FTL actually works. Progress has been continual, and moving along at a good rate. I don't feel like I'm hitting any brick walls, and I think I mostly understand and have a plan for everything I need to do.

So far, Clonebay is able to read, parse, and sort all of the game's data and resource files.
Clonebay can generate sectors, and map appropriate events to a valid number of beacons as defined by the sector data. The events have choices and ships, as defined by the event. At the moment, sectors do not have exit beacons. I also need to do pathfinding to make sure every beacon is potentially accessible from the start.
At the moment, the sector map is a straight line, not the nice tree structure in FTL.


ROADMAP: (NOTE: Prospective release names are subject to change, as is everything else)
I would like to do weekly point releases until 0.5, but that sounds like a pretty grueling schedule, and may be unrealistic. Certainly, there's stuff I'm forgetting about, too.

0.0.3: "Spindly Flagellum" (Current Release)
Initial gamepack support.
Main menu mostly works.
View ship_base and ship_floor in hangar.
Piloting icon identifies room 0
Title theme plays.

0.1: "Puny Human" (VERY SOON!)
Main Menu fully working.
Display ships, doors, rooms, systems correctly.
Start new game. Select ship from hangar.
Jump from beacon to beacon
Display events, choices, and enemy ships
Properly crossfade between explore and battle tracks.
Complete beacon maps

0.2: "Deep Space Whine"
Display crew.
Fire weapons. (With appropriate sounds)
Fully process events
Initial scripting support
Complete sector maps
Better patch set

0.3: "Mean Mister Mantis"
Bad guys shoot back. :(
Various gameplay details, manning systems, skill levels, explosions, etc.
Doors work.
Crew pathfinding.
Minimally playable.
Ship upgrades
Inventory
Augs

0.4: "You Don't Mess With the Zoltan"
support OVERWRITE
Extract advanced edition and treat it as a gamepack.
.ftl mod support
UI layout support
more gameplay details
Fancy launcher
Settings, stats, options, credits menus.
Stores.
Scripting improvements based on feedback

0.5: "Giant Alien Spiders"
FTL gamepack fully playable
Save/Continue
Text Mode

0.6 "Really Just Nude Snails"
Implement tutorial
Minimally playable clonebay gamepack.
UI layout with no dependencies on Subset property.
???Fremantle version

0.7: "Lanius-scented Glade Plug-in"
I start actually caring about Windows and MacOS issues.
Initial Android support.

0.8: "Lonely Vortex Captain" (A long time from now)
Clonebay gamepack actually fun.
More Android nightmares.

0.9: "Keep On Rockin in the Homeworlds"
Pretty much done. Smash bugs. At this point it may make more sense to think of FTL as a retro mod for Clonebay, rather than the other way around.

0.9.9: "Abandoned Sector"
I stop working on this.

1.0: "Crystal Palace" (Never?)
Somebody else forked the project and made it multiplayer

SCREENSHOTS
v0.0.1
Image

v0.0.2
Image

OK. THAT ALL SOUNDS GREAT. BUT HOW DO I RUN IT?

At the moment, It's kind of a pain in the butt. And really, unless you're a mod developer who wants to get a head start on porting his mods to the new gamepack format, which I haven't even documented yet, there's no reason to. Besides, development is happening so rapidly right now, your version is likely to be outdated within hours. For now, I'm assuming you have a good understanding of how FTL's files are structured. The source is messy and is littered with junk from me just figuring out what the hell I'm doing. This should be cleaned-up nicely by v0.1

You will need Python 3.4
https://www.python.org/downloads/release/python-343/
Pygame built to use Python3.
http://pygame.org/download.shtml

You will also need Patch to patch the data files.
A windows version is here: http://gnuwin32.sourceforge.net/packages/patch.htm

Get the source from github.
https://github.com/Preflex/Clonebay

Unpack the data and resource files, and place the contents in the gamepacks/FTL directory. I left empty directories there, so you can see where stuff goes.
Get the data patch from: https://github.com/Preflex/Clonebay_Gamepack (Whoops! I pushed to the wrong repo! it should be here: https://github.com/Preflex/Clonebay_FTL_Importer , but it's not)
Patch the data files.
Then, launch the launcher: python3.4 Launch.py

Oh, that didn't work? Bummer. :(
You're probably missing some dependencies. Most likely, the answer to your problem is to build pygame from source.
See: http://www.pygame.org/wiki/Compilation

Hints:

Ubuntu 14.10:
You should already have python3.4
Build ffmpeg from source. (You don't really need this yet, but you might later)
Ubuntu's python-pygame package is only for python 2. Build Pygame from source for python 3.
As of right now, this doesn't crash on me. If it crashes on you, let me know.

Raspbian Wheezy:
Raspbian only has Python 3.2 You will need to build python3.4 from source (This takes a few hours). :(
Then build pygame from source. You could probably find some way to use raspbian's python3-pygame package, but it didn't work for me. :(
Once I get rid of pathlib, wheezy should be very well supported, with all dependencies already built-in!

Raspbian Jessie:
You should already have python3.4
Build pygame from source because there's no python3-pygame package yet in Raspbian Jessie :(
Works!.

Arch Linux:
python3-pygame is in the AUR. If you're an Archer, you should be able to figure out the rest.

Maemo5:
Be patient. You'll need to wait for a 800x480 layout for it to be playable. Then we can figure out how to play FTL on Fremantle.

Android:
Be substantially more patient. This will require either a backport to python2 (shouldn't be too hard), or a port to kivy. There is no python3-pygame for Android.

Sailfish OS:
Who said anything about Sailfish? I certainly didn't. Send me a Sailfish device, and I'll be happy to get started on that. ;)

Microsoft Windows:
I dunno. I don't have Windows. If you get it working, tell me what you did, and I'll tell everyone else.

Mac OS:
I dunno. I don't have a Mac. See above.


LICENSE and CREDITS
Clonebay software
All my python code is licensed to you under the terms of GPL v3.
http://www.gnu.org/copyleft/gpl.html

Clonebay Gamepack
Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
http://creativecommons.org/licenses/by-nc-sa/3.0/


Includes Xmltodict: Copyright (C) 2012 Martin Blech and individual contributors.
https://github.com/martinblech/xmltodict/

DONATE
This has taken a lot of time and effort, and will continue to take a lot of time and effort for an extended period of time.

So, If you dig this project, Make it rain, baby!
TODO: Add donate info.
Last edited by preflex on Mon Mar 30, 2015 5:13 am, edited 3 times in total.
preflex
Posts: 20
Joined: Sun Mar 01, 2015 2:19 pm

Operation: Clonebay - Gamepack Documentation

Postby preflex » Mon Mar 16, 2015 1:29 am

Operation Clonebay Gamepack Documentation.

TODO
Last edited by preflex on Mon Mar 16, 2015 1:31 am, edited 1 time in total.
preflex
Posts: 20
Joined: Sun Mar 01, 2015 2:19 pm

Operation: Clonebay - Python API Documentation

Postby preflex » Mon Mar 16, 2015 1:31 am

Operation: Clonebay - Python API Documentation
TODO
User avatar
TheFallenAngel359
Posts: 111
Joined: Fri Feb 13, 2015 8:22 pm

Re: Operation: Clonebay

Postby TheFallenAngel359 » Mon Mar 16, 2015 9:36 pm

So it's basically like the "abandoned" FTL: Overdrive, but in Python? Hell yeah, I'm interested. If you need any help or anything, feel free to ask me. I am currently attempting to learn Python, but in the meantime, I can playtest or do some other stuff that doesn't require Python coding skill.
Image
OneShot17
Posts: 35
Joined: Fri Apr 18, 2014 3:54 am

Re: Operation: Clonebay

Postby OneShot17 » Tue Mar 17, 2015 2:56 am

TL;DR
User avatar
NarnKar
Posts: 778
Joined: Thu Jun 19, 2014 4:24 pm

Re: Operation: Clonebay

Postby NarnKar » Tue Mar 17, 2015 5:16 am

""Lanius-scented Glade Plug-in""

Wot?

Aside from that, good luck. I'm curious to see how this one will turn out.
preflex
Posts: 20
Joined: Sun Mar 01, 2015 2:19 pm

Re: Operation: Clonebay

Postby preflex » Tue Mar 17, 2015 6:29 pm

TheFallenAngel359 wrote:So it's basically like the "abandoned" FTL: Overdrive, but in Python? Hell yeah, I'm interested. If you need any help or anything, feel free to ask me. I am currently attempting to learn Python, but in the meantime, I can playtest or do some other stuff that doesn't require Python coding skill.


The projects are similar. I have different goals. My main focus is flexibility. I want to lay bare all the internals for the player to inspect and control, and to ultimately have zero dependence on Subset property, so that players and modders can do whatever the heck they want with it, That's why Python is a fantastic choice. Another important goal is support for exotic hardware. I want this to be able to run, in some form, anywhere Python can run.

Honestly, I don't know Python very well either. There's still a few really ugly things in there that I haven't replaced with proper Python idioms. I've found eclipse+pydev to be really helpful in understanding what I'm doing, and it integrates with github really well via the egit plugin. Also, the documentation at python.org is just great. I've had many CS courses in school, so I know how to program, but honestly, if i had to do this in Java, or something like that, I don't think I'd want to. Python's dict type makes this a piece of cake. "Batteries Included" indeed!

Feel free to check out the code and try to get it running. Let me know how it goes and what OS you're on. If you wanna' hack on it, go right ahead! That's why git is great! I'll be making some sweeping changes though soon, as I start heading toward v0.1.

I haven't been able to write much code the last couple days, as I've been focused on the logistics for this project. I've got a few errands to run this afternoon, and this evening is "Amateur Night for Alcoholics", so I'll be away at social events. Hopefully, I'll be back at it tomorrow morning.

NarnKar wrote:""Lanius-scented Glade Plug-in""

Wot?


;)

OneShot17 wrote:TL;DR

Thank you for your helpful feedback! You're right. I am often too verbose. My initial post in this thread was intended to provide a comprehensive overview of the entire project. I assure you, once this is in a playable state, my announcement in the other "working mods" subforum will be much more concise. :P
WhiteWeasel
Posts: 248
Joined: Sun Apr 13, 2014 4:36 am

Re: Operation: Clonebay

Postby WhiteWeasel » Tue Mar 17, 2015 8:58 pm

Can you make custom races with this?
Image
dalolorn
Posts: 532
Joined: Sun Sep 23, 2012 8:06 am

Re: Operation: Clonebay

Postby dalolorn » Wed Mar 18, 2015 10:04 am

WhiteWeasel wrote:Can you make custom races with this?


I would expect so, yes.
preflex
Posts: 20
Joined: Sun Mar 01, 2015 2:19 pm

Re: Operation: Clonebay

Postby preflex » Wed Mar 18, 2015 6:50 pm

WhiteWeasel wrote:Can you make custom races with this?

That's the plan, but for really fancy ones you'll have to wait for scripting support.

Let's say, for example, you wanted to make a 'Ghost' race. This dude does no damage, and can't repair anything, but he receives no damage, and can walk through walls. Also, if they enter into a room with a non-ghost, that non-ghost will run away. (Unless he's a Zoltan. Zoltans aren't afraid of ghosts)

Then, you could have a 'haunted' augmentation, that makes it so that if your crew dies, and you have no working clonebay, they come back as ghosts (which no longer count against your crew max).

This 'haunted' aug could be rec'd as a quest reward, or something.

That should totally be doable, but it will be a while.

I hope to use this exact scenario as one of the examples for the documentation, when it's ready.