Skip to content

Gieneq/LochPythonRPG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lochpython game

Lets say to be RPG game. Project ispired by Zelda in Python.

Devlog

Project in development. Recent state:

Recent state

Todo

  • TSX, TMX file support
  • Field of view with clipping
  • TSM extra properties (place ontop, stack shift, can be moved, etc.)
  • Better animation signal distribution, TSX interval/duration usage
  • Lighting, light sources
  • TMX groups usege as elevations
  • Staircase implementation
  • Ingame objects placement and interactions

Collison detection introduction

Steps:

  1. select nearby objects (thin yellow border in the image),
  2. evaluate collision separately in x and y and merge results (thick yellow border in the image),

Rectangles drawn using separate debbuging renderer.

Collision detection example

Delegation over inheritance - game objects system

Huge update and refactoring of entire code.

Game object is introduced. It stores dictionary of properties, and list of 3 types of methods introduced by those properties:

  • input - feeding data to next stage,
  • update - evaluating data and interaction with other properties,
  • render - passing results to separate rendering classes.

Properties derive from 3 types of Abstract properties which introduce previously mentioned methods:

  • InputProperty with abstract method input,
  • UpdateProperty with abstract method update,
  • RenderProperty with abstract method render.

Using multiple inheritance of Python each property can have any of above methods.

Properties can be used to create objects with any mix of functionalities, some of those are:

  • SpriteProperty - applying texture to object,
  • AnimationProperty - generic animation driving neighbouring SpriteProperty,
  • MovingProperty - used to move objects with speed and direction,
  • MovementAnimationProperty - specific type of animation used in moving of entities requiring MovingProperty.

World Loader introduction

Data exported as .csv from Tiled can be loaded. It is then split amoung 3 layers:

  • floor,
  • details,
  • entities (or objects).

This separation helps in sorting.

Introduced list of obstacles interacting with CollisionProperty used to help evaluate collision detection.

Invisible borders

Invisible borders (or limits) are used to prevent player from escaping the world. Those can be removed making e.g. walkable water.

Invisible borders

Scaling world surface

Game is meant to be pixel-art. 20x40px for character is more than enough. Global scale option - world is rendered to scaled down surface and then scaled up to fill entire window. GUI elements are not treated with the scale. Antialiasing if turned off to obtain hard pixeled edge.

So far graphics were only placeholders. Final tilesize is sublimating, probably it will be 32px so some more concrete graphics are needed.

Scaled up world

New graphics and animation fixes

Changes:

  • Added new tilesets.
  • Reworked animation system, now world has its won list of timers. One timer can sontrol water, plants and other similar animations.
  • Added images metadata to make the code more DRY.
  • Player (entities) has idle animation state.

There is need for tiles builder and some reuse of common static properties.

Animated nature and entities

Added another graphics, some of them needs tweaks and changes but it is not important.

Tiled was used to prepare map. There is need to create height layers and stack floor details.

Animated nature and shore

TSX, TMX fileformat (28.10.2022)

Changes:

  • Supported TSX, TMS fileformats with additional properties.
  • Added multiple hitboxes with spanning hitbox for optimization.

Multiple hitboxes

Changes:

  • Added global timers and global controllers for animations.

Timers are executing lists of handler functions. Controllers are driven by timers and are used to keep track of frames so that all tiles with the same animation are in sync.

Lighting and daynight cycle (28.10.2022)

Changes:

  • Added lightsources with TSX fileformat support.
  • Added daynight cycle.

Daynight with light sources

About

2D RPG game using Pygame

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages