This is my playground for implementing a 2D RPG like SDL based game which aims to be a proof of concept for "waling on base" in the game Pioneer Space Simulator.
I imagine, you can control your whole crew, for x-com/laser squad style of turn based combat, when doing missions or boarding and fighting control over a ship that has been disabled with an EMP missile.
Graphics should ideally be at least similar to syndicate, or Jagged Alliance 2 (although, in syndicate, movement was independent of tile grid, something I don't plan to do here, for simplicity sake).
- Load Orthogonal maps from tiled, support:
- multiple tilesets
- multiple layers. Any tile in a layer called
collisions
will be used for collision detection. - Support (single) object layer, if named
GameObjects
, and each object has a unique name, e.g.- "start"
- "bar"
Road map.
- Make git repository
- Draw a SDL window
- handle keyboard event, ESC and Q
- handle closing window with clicking "x" (I think this is done, not sure)
- wait/sleep lopp with fixed FPS to cap CPU usage
- load an image/sprite
- Have a dot that I can move around with arrow keys
- Map can scroll when dot approaches edge of screen
- Load tiles from file.
- Make first map: wall, floor, door, computer terminal, counter
- Line of sight / "Fog of war" in rooms I can not see into / rooms I'm not in (link)
- Read in map from a simple file
- Use third party map making tool. Like Tiled, if so read introduction
and how to implement it here. (Another editor is ogmo covered here.) For
Tiled, save maps in json format (since Pioneer uses json), and implement:
- Hook in jsoncpp.
- Read in maps. Useful: Tiled: json-format and jsoncpp-documentation.
- Support multiple layers
- Support multiple tile sets
- Find some tile set. http://opengameart.org/
- support collision checks with walls (us "collision" layer)
- Trigger tiles: doors switch to indoor map, computer terminal, stairs
- zoom camera? / map? (example)
- show layers, e.g. collision layer, for debugging maps
- Animated tiles? E.g. fire, explosion, smoke, water?
- Animated (character) sprite movement
- Support isometric map (wiki), although technically, it is actually dimetric
- Find placeholder tile sets: opengameart.org kenney.nl assetforge.io
- Might it be interesting to convert existing 3D models to isometric tiles: http://crocotile3d.com?
-
separate out to character class,
-
Separate class for loading sprites, support direction, different sprite sheets, different height/width of src sprites
-
Separate physics updates from frame rate (or modulo ticks)
-
A* pathfinding, or medium article, examples here, here, here, or:
- C++11: https://github.com/daancode/a-star
- C++14: https://github.com/Rikora/A-star
- C++14 & "C++11?": https://www.geeksforgeeks.org/a-search-algorithm/
-
Implement a Finite State Machine system, for AI (Hierarchical FSM seems useful e.g. have one for ranged combat, one for close combat, etc.)
-
Imgui debug window listing NPCs, can select in table, get detailed view e.g. of state
-
Can search an NPCs name/ID tag, and mark/change color of character sprite
-
Support collision check between characters tutorial
-
mouse integration
- click sets destination for player
- click NPC, to give action (e.g. show name & stats, for now)
- Support imgui (example using only SDLrender).
- Basic debug print outs
- print coordinates of clicked tile?
- bouncing into computer terminal - BBS
- bouncing into NPC:
- fight / deliver package / ask
- bartender: ask advice
- fixers: illegal mission
Longer term goals, rough outline.
- Create maps of different stations
- Station has a bar, with chairs, tables, bar-counter, bartender
- Station has a police "station"/terminal
- Station has a BBS terminal
- Station has a commodity terminal
- Player has a wrist "Pip-boy" computer, for "Pioneer F3 Info view"?
- Player/NPC has an inventory? Mechanics for dropping/picking up items?
- Manually prompt to set player stats when starting new game. Strength, dexterity, speed, rifle skill, blade skill, gun skill, throw skill, looks
At this point, the game could be included into Pioneer:
- Rename variables and class names to have consistent naming standard.
- Rename files
- Fix project structure,
contrib/
,src/
,data
- Run valgrind to find any memory leaks
- Run clang-format to format code
-
When player lands on a station, the "walk on base" game takes over
-
The player is placed in the main lobby, behind is a closed door to the ship hangar. Ships are not shown (that is for later).
-
One, or maybe two different station maps. (Could also have faction logo on floor tiles in the entrance of the lobby)
-
NPCs walk around, walking up to them opens chat dialogue. They could all be dismissive (for now).
-
Player has to access computer terminals on the station to open BBS-screen, commodity market, ship market, ship equipment shop, and police.
-
DeliverPackage now requires player not only to land at the right base, but also find the right person to deliver the package to. Walk up to person and engage in conversation.
-
Assassination missions are moved from BBS list, to be accessible through conversation with special shady people in the Bar. (Until person-to-person combat is implemented, the assassination itself is unchanged, i.e. must target the ship)
-
Black market (both the real, and the police/fake) moved from BBS to NPC(s) sitting in the bar.
-
Advice module moved to be conversations with the Bartender, e.g.
-
"You look like a rookie. You want a word of advice, make sure never to travel into uninhabited systems with too little fuel to jump back out"
-
"I've seen your kind before. You're looking hungry for adventure, kid, but I'd be surprised if you're still alive come the end of the year"
-
This would be the main place in the game where the player would get a sense of scale of different ships!
This isn't crucial, but would, after combat is implemented, allow disabling enemy ships in space, with special energy weapons, dock with them, board them, and engage in hand-to-hand combat, to then loot their cargo/crew.
-
Maps have a hangar, and each ship has a multi-tile set representation that are tiled together to one full ship.
-
Each ship has an internal "map", with cockpit, hall/entrance, cargo bay (filled with crates depending on state of cargo hold), and personal crew cabins, (and (room for?) passenger cabins?).
-
Player enters/leaves ship by walking up to the cockpit chair inside the ship. Leaves ship by walking up to the door of the ship (/ and/or cargo loading bay?).
When engaging in combat, game switches over to turn based. Combat could be similar to X-com, or some GURPS based system. Key here, is the ability to control several characters, making out your crew.
-
Combat:
- Choose your weapon, & action (stab/slash/punch)
- Choose enemy body part, from a list, or ideally a silhouette image
- Attack is carried out, uses up action points / time units
- NPCs make their move
-
Health system, overall health + specific body part health, bleeding to death, poison, drugs?
- Hospital/treatment facility/doctor/medi-kit
-
Personal equipment shop to facilitate combat: knifes, pistols, rifle, sniper rifle, medi-kit, body armour, helmet, night vision, grenade (smoke & explosive), timed charge, stun-rod, maze
-
Patrolling NPC-police on base, enforcing law, attacking you if they see you attack someone (i.e. need a line-of-sight-calculation). If they disable you, what then? Initially only Thuderdome outcome: two men enter, one man leaves.
-
Note to self: read:
- Balancing Turn-Based RPGs
- How to Build a JRPG: A Primer for Game Developers "The combat flow is controlled using a state machine with two states; one state to tick the actions and another state to execute the top action when the time comes. "
-
NPC / player can drink beer in bar, and get drunk, introducing noise to the path finding algorithm?
-
Passengers or crew can attack you on your ship, switching pioneer to the "walk on base" state (but technically "walk on ship").
-
Can player use more subtle ways of affecting game world than grenades and projectile weapons? Like putting poison in someones drink in the bar? Setting bomb with delayed timer, and leaving (similar to X-Com UFO/TFTD)?
-
Can player use his crew as a tactical combat team on the ground? Would player have full control of them during combat, or they fight independent of you, by targeting your enemies? Could you assign targets to them, and crew would fight them? How would they behave in a cloud of smoke, with zero view?
-
What can be done to make bases on different locations look different, or have their own "feel"? Do procedural generated bases, randomly generated zelda maps, or wave function collapse.
-
Cut scene system? If we have nice graphics/art to display, for immersion. E.g. for quests.
-
Very far out suggestion: Some bases/bars could have arcade machines, with mini-games. Pong/pac-man/card-game?/frogger (Doom!). Tie these into the story: leaving secret messages to others through what you type in the high score list? I.e. you would have to play the game (well enough) to get into high score list (or unplug arcade machine to reset it)? This is more like an adventure game elements thingy.
-
Have an embedded interactive fiction engine? Could be used when going on quest into the city / bad lands.
Useful articles to read, or have read.
-
Game Programming Patterns - Robert Nystrom (free web book)
-
Amit’s Game Programming Information (many links)
-
Programming Game AI by Example - Mat Buckland
-
How to Make an RPG (Book) - Dan Schuller
-
How to Build a JRPG: A Primer for Game Developers - Good primer on game states
-
Isometric maps & art
- Creating Isometric Worlds: A Primer for Game Developers - Very useful
- Creating Isometric Worlds: A Primer for Game Developers, Continued - Isometric scrolling
- Quick Tip: Cheap 'n' Easy Isometric Levels - on depth sorting
- The Complete Guide to Isometric Pixel Art - drawing basic objects, colouring, lighting, texturing
-
Pathfinding
- How to Speed Up A* Pathfinding With the Jump Point Search Algorithm - If need faster path finding
- Understanding Goal-Based Vector Field Pathfinding - For alternative path finding?
- Pathfinding 1: Map Representation and Preprocessing
- cplusplus
- cppreference.com
- Learn C++
- ClangBuildAnalyzer - Play with this, to learn how to reduce compile time (even if not needed):
- Mike Shah tutorials: design pattern, SDL2, openGL, C++, Modern C++