Main Page
From pyxelation
Welcome to the Pyxelation Wiki!
Pyxelation.com is a game engine based on Python and Pygame. Use Pyxelation to create multiplayer games: RPGs, arcade-style, board games. Non-programmers can create drag-and-drop games. Built-in IDE (called the Pyxelator) makes game creation a snap (experienced Python programmers can use their own IDE). The most up-to-date version of this project is called Pygridz.
Contents |
Pyxelation Fundamentals
The fundamental data structures of Pyxelation are as follows, from simplest to most complex. The vertical slash (|) means "or". The brace brackets {} denote repetition, or "contains one or more of what's between the brace brackets."
- Wlist: { Widget | Wlist }
- Element: Shape | Widget | Wlist
- Cycle: { Element | Elist }
- Elist: { Element | Elist | Cycle }
- Vector: Elist
- Vlist: { Vector | Vlist }
- Cell: Vlist | Row
- Row: { Cell }
- Grid: { Row }
- Zone: Grid | Row | Cell
- Level: { Zone | Vlist }
- Pane: { Zone | Vlist }
- Window: { Pane }
- User: { Window }
A widget is a standard object that the user can interact with, such as a button, check box, radio button, combo box, or label. A shape can be a line, rectangle, circle, polygon, or a bitmap. All child objects of a cycle have a positive FrameCount property (duration in no. of frames). A vector is an object (moving or stationary), a player character, or a non-player character (a character not controlled by a human player). The order in which objects in a given list are painted is in the same order as the list itself (left to right).
Sample Game Framework
Pyxelation includes multiple game frameworks, or user interfaces (the game designer should be able to modify one of the existing game frameworks, or create an entirely new game framework). The simplest game framework is meant for creating board games (no animation). What follows is a somewhat more complex game framework, which supports 2D animation. The screen is divided into 3 panes: Overhead (left), Front (top-right), Settings/Objects (bottom-right).
The overhead view shows the boundaries of the zone currently occupied by the user (boundaries of other zones may appear as well, but those zones appear empty to the user). The front view shows the wall faced by the user (below the wall is part of the floor between the user and the wall). The user is always located in the center of the overhead view. When the user moves, in any direction, the boundaries of the current zone (as well as the objects contained in that zone) scroll in the opposite direction to the direction in which the user is moving.
The Settings / Objects pane can be in one of two states: Settings (a control panel of the user's current state), or Objects (a group of zero or more objects the user is carrying). Right-clicking in this pane toggles between the 2 states.
Drag Action:
- Overhead: move towards cursor
- Front: drag object to Objects pane
- Objects: drag object to Front pane
Object Commands:
- Click: set current object
- Double-click: perform default action
- Right-click: display popup menu of actions
- Enter: perform default action of current object
- Space bar: same as Enter
In the overhead view, dragging (holding the mouse button down) causes the user to move in the direction of the mouse cursor relative to the center of this pane, at a speed proportional to the distance between the mouse cursor and the center of this pane. The user can change the size of each pane by dragging the pane borders.
Events
Most events are detected by the low-level game engine code, and transmitted to the Python game script. Each event consists of one of the following event types, some event-specific data, the User ID of the user who generated the event, and the object connected with the event (an element, vector, cell, etc.). Collision events contain 2 objects (vectors, or a vector and a border), and are not necessarily associated with a specific user. All non-collision events (except the Paint event) are uploaded to the server (in the form of an XML file) and downloaded by all the other users located in the same zone as the user who generated the event.
- Mouse Up/Down
- Key Up/Down
- User Velocity Change
- Zone Enter/Exit
- Mouse Move In/Out
- Collision: Vector/Vector
- Collision: Vector/Border
- Download Bitmap
- Paint Object
Event Handlers
If the game designer is a programmer, the event handler is written in Python. Otherwise, the game designer uses the Event Handler Wizard. This wizard generates one line of Python code at a time. Each line can be an assignment statement, a method call, or some other type of statement. A block of code can be guarded by an if-statement, which requires the user to invoke the Boolean Expression Builder (while-statements are built in a similar fashion). For-statements are somewhat more complex.
Vector Classes/Events
Every vector belongs to a certain class (there may be more than one vector class). Every time a new vector is created, the constructor for its vector class is called. The constructor consists of a block of code, just like an event handler. If a vector is in motion, collision events may be generated whenever that vector collides with another vector or with a zone/cell boundary.
Game Components Summary
A complete game consists of one or more levels. Each level consists of one or more zones/cells, and cells can be organized in rows and grids. Cells may contain one or more vectors, and each vector consists of one or more elements (elements can be grouped together in elists). Each element consists of a shape (which may be a bitmap) or a widget. The user interface defaults to the sample game framework described above. The game logic is controlled by event handlers and vector class constructors. Those event handlers and constructors consist of Python code, which can be constructed by non-programmers using the Event Handler Wizard. Simple drag-and-drop board games can be put together without even using the Event Handler Wizard. That's Pyxelation in a nutshell.
Pyxelation Development
Pyxelation.com makes money mainly from advertising (for more info, click on Business Model). For a list of Pyxelation development tasks, click on Roadmap.
