Skip to content

Latest commit

 

History

History
384 lines (326 loc) · 22.3 KB

README.org

File metadata and controls

384 lines (326 loc) · 22.3 KB

Stuff

  • [ ] SDL_RenderCopy - ep 17 of SDL series, render texture into rectangle, use for squishing stuff into correct scaled tiles?
  • [ ] popup imgui-window?
  • [ ] character starting pos, do something with it?
  • [ ] have an entity spawner, make many NPCs?
  • [ ] animated character movement?
  • [X] use isometric?
  • [ ] game scenes management using state machines. Have a render() method, for different game modes. jrpg, or use a state stack
    • Next Actions:
      • Implement the state machine code in your favorite programming language.
      • Create a MenuMenuState and GameState inheriting from IState.
      • Set the the main menu state as the initial state.
      • Have both states render different images.
      • On pressing a button, have the state change from the main menu to the game state.

FSM, blog post based on the book: http://www.richardssoftware.net/Home/Post/67

DEPTH SORTING: “For properly understanding depth sorting, we must understand that whenever the character’s x- and y-coordinates are less than those of the tree, the tree overlaps the character. Whenever the character’s x- and y-coordinates are greater than that of the tree, the character overlaps the tree.

When they have the same x-coordinate, then we decide based on the y-coordinate alone: whichever has the higher y-coordinate overlaps the other. When they have same y-coordinate then we decide based on the x-coordinate alone: whichever has the higher x-coordinate overlaps the other.

A simplified version of this is to just sequentially draw the levels starting from the farthest tile - that is, tile[0][0] - then draw all the tiles in each row one by one. If a character occupies a tile, we draw the ground tile first and then render the character tile. This will work fine, because the character cannot occupy a wall tile.

Depth sorting must be done every time any tile changes position. For instance, we need to do it whenever characters move. We then update the displayed scene, after performing the depth sort, to reflect the depth changes.”

On Singletons

<impaktor> Am I understanding this right: If I have a singleton class Foo,
           that I initiate in my main(), can I then access it (e.g.
           Foo::DoStuff()) from any implementation file, by #include "Foo.h"?
                                                                        [21:44]
<Gliese852> impaktor: I think yes, but the definition of a static object
            variable should be in Foo.cpp, if I understand  [21:54]
<Gliese852> if you put it in Foo.h, it will go into each object file, and each
            will have its own singleton  [21:55]
<Gliese852> because #include "Foo.h" is nothing more than text substitution
                                                                        [21:56]
<impaktor> But will I not have to declare the singleton class in Foo.h? And
           implement it in Foo.cpp?  [21:58]
<impaktor> I note DynV hasn't posted on the forum since we moved all the posts
           to a sub-forum.  [22:37]
<Gliese852> impaktor: Yes, this is usually done, but it is not necessary.
                                                                        [22:42]
<impaktor> So I don't need to #include Foo? Hmmm... I should do some
           experiments.  [22:44]

<Gliese852> impaktor: you could put both the declaration and the definition in
            Foo.h, but not this time. [22:08:34]
<sturnclaw> impaktor: you still need to include Foo.h, the difference is
            whether you are storing an instance of Foo somewhere and using it
            as `m_foo->DoStuff()` or using the singleton pattern
            `Foo::Get()->DoStuff()` [01:19:27]
<sturnclaw> you can treat Foo as a static class though, where there are no
            non-static member variables or functions, in which case you'd call
            Foo::DoStuff() directly [01:19:57]

On ImGui:

<sturnclaw> you should always do
            if (ImGui::Begin(...)) {
            /* ... */
            }
            ImGui::End()  [08:58]
<sturnclaw> window visibility is stored separately from the call to Begin, and
            while you can submit draw commands even if the window isn't
            visible, they're just silently ignored (but still wasteful)
<sturnclaw> Generally speaking though, the call to Begin takes a boolean to
            update if the window is closed, Begin() returns false if the
            window is collapsed but whether the window is shown at all or not
            is higher-level application code  [08:59]
<impaktor> ImGui::Begin() returns false if the window isn't opened?  [09:00]
<sturnclaw> you most likely should have a top-level �IsDebugWindowOpen bool
            accessible through your debug interface somehow
<sturnclaw> returns false if the window isn't visible
<sturnclaw> the call to Begin mutates the pointer-to-bool passed to it if the
            user clicks the close button, then it's the calling code's
            responsibility to not call ImGui::Begin()  [09:01]
<sturnclaw> you're responsible for not calling ImGui::Begin() if the window is
            "closed"  [09:04]
<sturnclaw> (you're also responsible for not submitting primitives if the
            window signals the contents aren't visible by returning false)
<impaktor> Thanks! I'm not fully understanding (I don't have the code to
           experiment on now), but would the objects that push strings to the
           debug windwow also have to use IsDebugWindowOpen ?  [09:05]

Other good RPGs

Phantasy star IV [Genesis] Chrono Trigger [SNES] Earth Bound [SNES] Final Fantasy III (aka VI) Phantasy star II [Genesis] Final Fantasy 1

Description

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).

Features

  • 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”

Roadmap - My path to glory

Road map.

Getting started

  • [X] Make git repository
  • [X] Draw a SDL window
  • [X] handle keyboard event, ESC and Q
  • [X] handle closing window with clicking “x” (I think this is done, not sure)
  • [X] wait/sleep lopp with fixed FPS to cap CPU usage
  • [X] load an image/sprite
  • [X] Have a dot that I can move around with arrow keys
  • [X] Map can scroll when dot approaches edge of screen

Set up map

  • [X] Load tiles from file.
  • [X] 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)
  • [X] Read in map from a simple file
  • [X] 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:
    • [X] Hook in jsoncpp.
    • [X] Read in maps. Useful: Tiled: json-format and jsoncpp-documentation.
    • [X] Support multiple layers
    • [X] Support multiple tile sets
  • [X] Find some tile set. http://opengameart.org/
  • [X] support collision checks with walls (us “collision” layer)
  • [ ] Trigger tiles: doors switch to indoor map, computer terminal, stairs
  • [ ] zoom camera? / map? (example)
  • [X] show layers, e.g. collision layer, for debugging maps
  • [ ] Animated tiles? E.g. fire, explosion, smoke, water?
  • [ ] Animated (character) sprite movement
  • [X] Support isometric map (wiki), although technically, it is actually dimetric

NPCs

ImGui

  • [X] Support imgui (example using only SDLrender).
  • [X] 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

Follow up goals

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

Integration into Pioneer Space Simulator

At this point, the game could be included into Pioneer:

Before - sanitize code

  • 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

Minimum feature set for inclusion

  • 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”

Show ships in hangar?

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?).

Combat system

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:

Above and beyond

  • 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.

Resources

Useful articles to read, or have read.

RPG / Game Programming

General C++

General Common lisp game programming

https://github.com/lispgames/lispgames.github.io/wiki

Common Lisp + OpenGL

http://nklein.com/2010/06/nehe-tutorials-for-cl-opengl/ http://nklein.com/2010/06/nehe-tutorial-02-drawing-triangles-and-quadrilaterals/ http://nklein.com/2010/06/nehe-tutorial-03-color/ http://nklein.com/2010/06/nehe-tutorial-04-rotation/ http://nklein.com/2010/06/nehe-tutorial-05-solids/ http://nklein.com/2010/06/nehe-tutorial-06-textured-solids/