4 Projects
dxtr edited this page 2026-10-20 03:57:13 +02:00

Projects

A project is a directory with a project.pyssel, as a Godot project has a project.godot: the project's settings, beside the game's ASDF system, scenes and resources. pyssel/editor starts one, and opens it in the editor, or for your REPL alone:

(asdf:load-system :pyssel/editor)

(pyssel/editor:new-project "~/games/arena/")
;; project.pyssel, arena.asd, package.lisp, main.scene, icon.svg and .gitignore
(pyssel/editor:open-project "~/games/arena/")
;; ASDF finds arena.asd, the game's system is loaded, and the project is
;; this Lisp's.
(defvar *play* (pyssel/play:play))
;; Playing main.scene in this Lisp.
  • Libraries: a game that uses a library beside Pyssel, as cl-astar for A* pathfinding, lists it in its system's :depends-on and in a stiftfile of its own, beside Pyssel, so that it loads where stift sets ASDF up in the game's directory, as stift exec sbcl does. The pyssel program keeps the systems it was built with, and finds others only where your own ASDF configuration points, not through the game's stiftfile, so a game that needs another library does not open in it yet.
  • Paths: in a session with a project, a relative path given to load-resource or save-resource, and so to load-scene and save-scene, is relative to the project's directory, project-directory, so a game names its files the same way in the editor, in a play and exported: (sc:load-scene "levels/one.scene"). Files go on referring to each other relative to themselves.
  • Settings: project-settings, of pyssel/project, is the resource class project.pyssel holds: the project's name; its description, its icon, an SVG file, and its tags, which the editor's project manager shows; the game's system, its main scene, its window's title, size and clear colour, its theme, its autoloads, its input map of actions, its physics rate, the user interface's settings, the game's own, and the colours the editor's File System dock shows its folders in. load-project loads them and save-project saves them, in the file project-file names. A tag is lower case, its words joined by underscores, as 2d_game, shown as "2d Game"; tag-problem says why a string is not one. A session's project is current-project; a play reads the settings afresh, so it plays what was saved, and run-project runs a project's game in the current session as a play does in its own.
  • Autoloads are nodes each run of the game makes afresh and puts under the root before the main scene, where it finds them by their names, as /root/score: a scene, ("score" :scene "autoloads/score.scene"), or a node class, ("music" :class "arena:music-player"). Keep in one what a whole run needs and no scene owns, such as a score kept from level to level.
  • The clear colour, project-clear-color, Godot's grey (0.3 0.3 0.3) by default, is what the game's window is cleared to behind all it draws, and the editor's 2D viewport behind the scene.
  • Embedded popups: project-embed-subwindows, true by default, draws the game's popups and dialogs inside its window, as embedded windows, rather than in windows of their own.
  • Stretching, as Godot's display/window/stretch: project-stretch-mode, :disabled by default, :canvas-items or :viewport, stretches the game's content over its window from its size, project-window-width by project-window-height, as the base size, keeping its shape as project-stretch-aspect says, :keep by default, :ignore, :keep-width, :keep-height or :expand; project-stretch-scale makes it larger besides, and project-stretch-scale-mode, :fractional by default or :integer, stretches it by whole times only. They go on the game's root viewport as its content scale (see 2D Nodes).
  • The theme goes on the game's root viewport, viewport-theme, where its controls look after their own and their ancestors' themes and before the default theme: every screen of the game takes it, and the editor's own controls, in a tree of their own, do not.
  • The text painter, project-text-painter, :raster by default, goes on the game's root viewport too, viewport-text-painter: how its controls draw their text where none of them says otherwise, :sdf or :slug for text that scales.
  • The input map, project-input-map, is the game's actions, as ((:jump (:key :space) (:button :left)) (:pause (:symbol :escape))): a session with the project gives it to the trees made in it, so a play's game tree has it.
  • The user interface's settings, tooltip-delay, tooltip-offset, drag-threshold, spin-repeat-delay, spin-repeat-interval and search-seconds, are each session's own, and a session with a project takes the project's: a game that sets one sets it for its run alone.
  • The game's own settings are a property list in the project's settings, which the game reads with (pj:game-setting :lives 3), 3 if the settings have no :lives.
  • Folder colours, project-folder-colors, are a list of each folder the editor shows in a colour and the colour, a folder-color, one of Godot's nine, :red, :orange, :yellow, :green, :teal, :blue, :purple, :pink and :gray: (("art/" :blue) ("levels/one/" :red)), each folder's path relative to the project's directory and ending with a slash, once. They are kept here, not in .pyssel/, so that everyone working on the project sees them, as Godot keeps them in project.godot.

open-project opens one project at a time, as edit does. What the editor keeps of its own about a project goes in its .pyssel/ directory, which version control leaves out.