I wanted to experiment with AI coding assistants, so I decided to rewrite an old project I messed with a few years ago.
Open Fields 2 is a Civil War or Wild West themed RTS focusing on individual characters. Individual character have stats based on tabletop role playing games.
A few years ago, I tried to merge my childhood love of army men with my teenage love of playing tabletop role playing games, and put that all into a computer game. Each unit had stats based on role playing game stats, and I controlled them like an RTS. And the combat rules were much more complicated, because they didn't need to be simple.
Recently, I decided to experiment with AI coding assistants to taking on this project again. I have used ChatGPT in my professional coding to help me, so I started with that. After a particularly frustrating day of trying to get ChatGPT to stop suggesting me code with mismatched braces and regex artifacts, I researched the current state of AI coding assistants and learned about Claude Code. I was impressed with its ability to edit my code through the console, and after working with Claude for a few more days I was even more impressed with how it can plan and iterate through those plans.
So I've continued working on Open Fields 2.
Anyway, all the text that follows below this was generated by Claude Code.
- Individual Unit Control: Select and command individual soldiers with unique stats and abilities
- Realistic Physics: Projectile travel time, weapon velocity, and distance-based accuracy
- Stat-Based Mechanics: Dexterity, Strength, Reflexes, Health, and Coolness affect combat performance
- Skill Progression: Pistol, Rifle, Quickdraw, and Medicine skills influence effectiveness
- Variable Movement Speeds: Crawl, Walk, Jog, and Run with accuracy penalties
- Aiming Techniques: Careful, Normal, and Quick aiming with speed/accuracy tradeoffs
- Real-Time Combat: 60 FPS game loop with scheduled events for realistic timing
- Multiple Weapon Types: Pistols, rifles, and submachine guns with unique characteristics
- Firing Modes: Single shot, burst fire, and automatic firing capabilities
- Ammunition Management: Realistic reload times and ammunition tracking
- Automatic Targeting: Optional AI-assisted target acquisition
- Faction-Based Organization: Characters organized into NONE, Union, Confederacy, and Southern Unionists factions
- Persistent Character Storage: Character data saved to faction files with battle statistics tracking
- Batch Character Creation: Create multiple characters at once with CTRL-C
- Character Deployment: Deploy existing characters from faction files with CTRL-A in formations
- Battle Resolution: Manual victory system (CTRL-SHIFT-V) tracks faction and character outcomes
- Scenario Management: Create new scenarios (CTRL-SHIFT-N) with theme selection and dynamic titles
- Unit Deletion: Remove units from scenarios (DEL key) while preserving character data
- Cross-Session Progression: Character statistics and faction relationships persist across battles
- Java 21 or higher
- Maven 3.6+ for build management
- JavaFX 21.0.2 (handled automatically by Maven)
-
Clone the Repository
git clone <repository-url> cd OF2Prototype01
-
IDE Configuration
- IntelliJ IDEA: Import as Maven project, ensure Project SDK is Java 21
- Eclipse: Import as Existing Maven Project, configure Java 21 JRE
- VS Code: Install Java Extension Pack, ensure JAVA_HOME points to Java 21
-
Build and Run
# Compile the project mvn compile # Run the application mvn javafx:run
- Movement: Right-click empty space to move selected unit
- Combat: Right-click enemy unit to attack
- Selection: Left-click unit to select
- Movement Speed: W/S keys (Crawl, Walk, Jog, Run)
- Aiming Speed: Q/E keys (Careful, Normal, Quick)
- Camera: Arrow keys to pan, +/- to zoom
- Pause: Space bar to pause/resume simulation
- Single-File Design: Core game logic in
src/main/java/OpenFields2.java - Event-Driven System: Scheduled events with priority queue for delayed actions
- Entity Framework: Character, Unit, Weapon, and WeaponState classes
- Rendering System: Custom 2D graphics with zoom/pan camera support
- Scale: 7 pixels = 1 foot for realistic distance calculations
- Movement: Pixel-based positioning with foot-based game logic
- Range Calculation: Euclidean distance for weapon range and accuracy
- JSON Format: Jackson-based serialization for game state persistence
- Character Data: Stats, skills, equipment, and combat preferences
- Scenario Support: Save and load tactical scenarios for testing
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2025 Edward T. Tonai
OpenFields2 demonstrates the potential of AI-assisted game development, combining traditional game design principles with modern AI coding tools to create engaging tactical combat experiences.