Skip to content

arocull/Shepherd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shepherd

A small game about a shepherd and his flock of sheep.

Packages and Compiling

This game uses SDL2 and SDL2_Mixer as dependencies. To install these packages on Debian, run $ sudo apt install libsdl2-dev libsdl2-mixer-dev

The game compiles with a Makefile. Run the make file by typing $ make

Once the game is compiled, run it with $ make run

Commands $ make clean, $ make debug, and $ make debug-mem are also available for cleaning the build, debugging, and checking memory management respectively.

Gameplay

Solve ancient puzzles and fend off wolves as you lead your sheep to greener pastures.

Note that this game is a work-in-progress, only providing about 5-15 minutes of gameplay for the time being.

Updates to the game may break saves, and save games may be unstable. To clear an existing save game, either run $ make clean and then $ make, or press "New Game" in the menu upon launching the game.

Controls

There is a tutorial in place that should give you the basic controls and instruct you on how to play.

Press Escape to open the pause menu, and F11 to toggle fullscreen. Menus can be navigated with both WASD and Arrow Keys.

Editing

Level Editing

Level files can be located within Assets > Maps, and are merely comprised of ASCII. The translations of char to tile/entity can be found within Map > map_loading.cpp in the bottom function. The number and letter below the actual map tiles itself are used for level identification and biome. Biomes merely affect the background color, whereas the identification is used in Triggers to tell what level is what.

Below the level identification section is lines that can be used for scrolls. Scrolls are special collectibles that can contain various, meaningful text. The first line after map identification is the name of the scroll. This is what you see when browsing discovered scrolls in the pause menu. The line below the scroll name is the text the scroll contains when read. It extends the remaining length of the file, just note it has a max length of 256 characters (set in config.h) and all the text must be able to fit in the dialogue box at once.

Below scrolls, additional data like puzzles, entities, etc can be placed, but each line must start with a flag. These are harder to work with and may more frequently change--they are mostly intended for save data. However, if you would like to mess with them, you can view them in SaveLoad::LoadObjects.

Triggers and Puzzles

If you want to set up and configure a puzzle, simply edit the function Trigger_SetupPuzzles and add a section for your added level. Note the use of the Puzzle struct, which is a general, easy-to-use interface for creating puzzle conditions. If the level requires a unique set of inputs, you can add conditions in Scripts::PuzzleInput for more specific purposes.

There are also additional functions for unique timings and scenarios, such as Trigger_LevelLoaded (fires upon entering level), Trigger_StaffSwing (fires whenever staff is swung), Trigger_Idled (fires after TicksUntilIdle ticks have passed), Trigger_LevelEvent (when level's event timer reaches zero), and Scripts::OnTile.

Custom Entities

Entities are located in the Entities > Subclasses folder. They all inherit the Entity class as somewhat of an interface, but contain custom functionality, drawing calls, and interactions.

Entities are managed a little messily right now, but may be cleaned up in the future. First, to register an entity, add their name and corresponding ID to the EntityID enum. Make sure to set their ID in their class constructor.

All Entities have their Tick function called, but if you need certain behaviors that interact with other entities, like Fireballs bursting or a custom AI, you will likely have to add it in the main game loop, located in game, at around line 130 at time of writing. If it's an enemy, you may find the AI Manager more useful, letting you write lengthy functions without filling up game.cpp, and providing support for things like swarm targets (or enemyGoal as defined in the manager).

If you want to spawn your enemy using the Level's ASCII tileset, you can edit the GenerateMapFromFile function and specify a specific ASCII character for your Entity. Otherwise, you can spawn them with Triggers.

Don't forget to set up a drawing function--use the other entities as examples. A function does not need to be defined if you are just using a plain image, like the Crate. Images are currently loaded in the Constructor for RenderWindow, deallocated in the Close function, and passed to entities in the DrawEntity function. If you're just drawing with SDL calls, a texture does not need to be provided (so no modification of RenderWindow is needed).

About

A top-down game about a shepherd and his flock of sheep.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published