FCT Market Generator is a browser-based utility that compiles user-defined trade rows into a single Lua command for spawning a fully configured market entity in Factorio. It is optimized for fast iteration, high-volume offer generation, and quality-aware balancing workflows used by server admins, scenario builders, and economy nerds.
Important
This project is a zero-backend static app. Open it locally or deploy to any static hosting provider and it works out of the box.
- Features
- Technology Stack
- Technical Notes
- Getting Started
- Testing
- Deployment
- Usage
- Configuration
- Community and Support
- Support the Development
- License
- Contacts
- Lua market command generation: Builds a complete
/cscript that creates a market near player position and registers all generated offers. - Bidirectional trade row model: Each row supports
priceandofferitem data with independent counts and quality settings. - Quality-aware price scaling: Applies configurable multipliers for
normal,uncommon,rare,epic, andlegendarytiers. - Global discount pipeline: Instantly applies percentage discounting across generated offers without touching each row manually.
- Optional row-pair reduction mode: Toggle to hide every second sentence for compact trade construction workflows.
- Searchable item picker with pagination: Includes a large Factorio item dataset and UX that scales to long item catalogs.
- Multilingual UI profiles: Ships with multiple language packs and remembers selected language in
localStorage. - Clipboard-ready output: One-click copy and optional
[code]...[/code]tag wrapping for forum/chat publishing. - Space Age-ready data model: Includes modern Factorio 2.0 and expansion-era entities/components.
Tip
If you build economy presets often, keep your quality percentages and discount strategy stable, then only swap item rows per market theme.
Core runtime and implementation layers:
- HTML5 for layout, forms, and semantic structure.
- CSS3 for responsive styling and interaction states.
- Vanilla JavaScript (ES6+) for state, business logic, i18n switching, filtering, and Lua serialization.
- Factorio Lua command output as integration target (
/cconsole command).
No framework, no bundler, no server runtime. The stack is intentionally lightweight and portable.
.
├── index.html # Main UI shell and static script/profile includes
├── style.css # Layout, controls, modal, and visual styles
├── script.js # Item catalog + generation, filtering, i18n glue, clipboard helpers
├── profiles/ # Language dictionaries (ru, en, uk, kk, cs, nl, sv, de, pl, fr, zh, ja)
├── README.md # Project documentation
├── CONTRIBUTING.md # Contribution workflow and quality gates
├── CODE_OF_CONDUCT.md # Community behavior expectations
└── LICENSE # Apache-2.0 license text
-
Static-first architecture Keeps onboarding friction close to zero and makes deployment trivial (GitHub Pages / Netlify / any CDN).
-
Single-file business logic (
script.js) Centralizes generation logic so contributors can reason about offer serialization quickly. -
Data-driven item selection Item definitions are represented as structured objects (
icon,product,count) to simplify filtering and rendering. -
Human-configurable market balancing Quality percentages and discount are not hardcoded constants; users can tune economy behavior on the fly.
-
Localization through profile scripts Language dictionaries are loaded as separate files, enabling low-risk incremental translation updates.
Note
This is intentionally not over-engineered. The current model prioritizes maintainability for a small contributor surface and fast feature shipping.
You only need:
- A modern browser (
Chrome,Firefox,Edge,Safarirecent versions). git(optional, if you want to clone and contribute).- Optional static server for local development convenience:
python -m http.servernpx serve- VS Code Live Server
# 1) Clone repository
git clone https://github.com/<your-org-or-user>/market-code_generator.git
# 2) Enter project
cd market-code_generator
# 3) Run as plain static app (option A)
# just open index.html in browser
# 4) Run with local static server (option B, recommended)
python3 -m http.server 8080
# then open http://localhost:8080Warning
If you open files via file:// and browser policies block some interactions, run a local server instead.
This repo currently relies on manual validation and sanity checks. Suggested local checks:
# Validate repository has no whitespace/conflict issues
git diff --check
# Quick static smoke-run
python3 -m http.server 8080
# open app, generate code, copy output, switch languages, search item, verify discount mathRecommended validation matrix:
- Verify Lua output starts with
/c local player = game.player .... - Verify non-
normalquality addsquality = "..."fields. - Verify discount changes final counts as expected.
- Verify language switch persists after reload.
- Verify item modal search and pagination behavior.
Because the app is static, deployment is straightforward:
- Push repository to GitHub.
- Enable Pages for branch (
main/master) and root folder. - Use generated URL as production endpoint.
- Connect repository.
- Build command: none.
- Publish directory: repository root.
- Deploy.
Upload index.html, style.css, script.js, and profiles/ directory as static assets.
Caution
Keep profiles/*.js paths intact. Renaming or flattening without updating <script> tags will break localization.
Typical workflow:
1. Set quality multipliers (normal..legendary)
2. Set global discount percentage
3. Define even number of offer rows
4. Pick item + count + quality for price and offer sections
5. Click "Refresh Code"
6. (Optional) wrap output into [code] tags
7. Copy and paste into Factorio console
Example generated command shape:
/c local player = game.player
local surface = player.surface
local market_location = {x = player.position.x, y = player.position.y - 3}
local market = surface.create_entity{name = "market", position = market_location, force = player.force}
local items = {
{price = {{name = "coin", amount = 100}}, offer = {type = "give-item", item = "iron-plate", count = 50}},
{price = {{name = "steel-plate", amount = 10}}, offer = {type = "give-item", item = "coin", count = 200}}
}
for _, item in ipairs(items) do market.add_market_item(item) endThere is no .env requirement right now. Runtime behavior is controlled through UI fields and browser storage.
Primary runtime knobs:
quality-percentagesinput: comma-separated scaling list for quality tiers.discount-percentageinput: global discount (0..100).num-rowsinput: row amount (step=2by default).toggle-second-sentencescheckbox: hide every second row sentence mode.localStoragekey:market_generator_langfor persisted language preference.
If you introduce environment-level config later (CI, hosting, analytics), document it here with default values and security notes.
Project created with the support of the FCTostin community.
- GitHub: OstinUA
- Team page: FCTostin-team
- Contribution process: see
CONTRIBUTING.md.