p5.quadrille.js

Open Assessment: Experience with the p5.quadrille.js Library

In my endeavor to develop a chess game, I had the pleasure of delving into the p5.quadrille.js library. This library proved to be a versatile ally in managing the game logic and crafting its visual interface. This report describes my experience with the p5.quadrille.js library, highlighting its role in facilitating the development, its impact on improving my understanding of Object-Oriented and Functional Programming concepts, and how I perceive the library could be improved. This report provides valuable insights into the rationale behind decisions made during the development lifecycle, contributes to the understanding of the library and its possible use cases in software projects, and serves as a reflective exercise to assess the methodology used to build the game and identify areas for improvement.

Usability

Overall, I had a pleasant experience with the library. Its API is simple and easy to learn but also powerful enough to solve complex problems like creating a chess game. The library is used for two modules of the game: Board Representation and User Interface. For the Board module, p5.quadrille.js provides a straightforward way of creating an internal matrix representation of the board. This representation is useful for making and unmaking moves because the rank and file are known and could be used for indexing the matrix to search for the piece performing the move. Managing this matrix is easy with the library because it provides methods to add, read, and remove pieces from the matrix. Also, a feature I like is the pattern search function, which allows searching for specific patterns in the board without needing a complicated looping structure. This is used to search for pieces on the board when indexing is impossible.

In the case of the User interface module, the p5.quadrille.js library plays a pivotal role in drawing the board for the reason that a quadrille perfectly matches the rectangular arrangement of squares on the chessboard. The Move Record, a table that records the moves played so far, is another element that can be easily drawn with a quadrille. By design, the library is focused on providing functionality for creating and displaying computer visual graphics. Therefore, customizing the aspect of the board and other UI elements is an easy task. Furthermore, complex visual effects can be achieved by drawing quadrilles in layers, a feature most image processing software have nowadays.

Also, the library fostered some creative solutions to problems. There was an instance in which I had to search the position of certain pieces on an arbitrary board to determine if castling was allowed for each side. I could easily do this by using the search method, which provides the exact location of a given pattern in the quadrille.

Learning

The usage of the library was also an enriching learning experience.

During the programming courses of my engineering degree, much attention is put into understanding the concepts of the Object-Oriented paradigm.  Other paradigms like functional programming are rarely mentioned even though they are unconsciously used. Although OOP is a valuable tool for solving certain problems, it is surely not a one-size-fits-all solution. Sometimes OOP can lead to building solutions far more complex and inflexible than what functional programming can do. My experience learning JavaScript, which initially is not a class-oriented language, and the p5.quadrille.js library, which is functional-oriented, helped me think out of the OOP box and consider the value that functional programming brings by placing higher importance on functions.

The extensive use of JavaScript objects showed me the potential of key-value pair data structures to store complex information and use it to simplify logic and conditionals, known as table-driven methods.

The library supports the use of bitboards, which is a common technique for implementing board games. For this reason, I decided that the game would heavily rely on the use of bitboards and bit operations. Therefore, I acquired a strong grasp of these concepts and how they can be applied to an algorithm, which will prove beneficial for the development of my future projects.

Much of the p5.quadrille.js graphical capabilities are backed up by the p5.js ecosystem. Learning basic and advanced elements of this ecosystem helped me use the library to its full extent.

Engagement

The visual capabilities of the library make the development process much more fun and exciting. I feel that one of the most common reasons why people feel discouraged when coding is not reaching the point at which you can see your ideas materialized on the screen. Spending hours just looking at code and occasionally some logs in the console might feel like you are not making significant progress because your idea is still in the abstract domain. There is still nothing concrete and physical you can interact with. Personally, as a game developer, there’s nothing better than finally visualizing your game running on the screen with some characters interacting with the environment. The library allowed me to implement the visual and interactive appeal of the product early on in the development, which increased my motivation to finish the project.

Collaboration

The open-source nature of the p5.quadrille.js library contributed immensely to the game development. Multiple individuals have contributed by developing their board games using the library and making their code accessible. Studying these examples carefully provided invaluable insights into how a game like Chess could be made using the library and helped spark some ideas that could solve problems found during development.

Difficulties and suggestions

I did not find serious difficulties using the library. Some of the functionalities I suggest should be implemented in the future are:

  • Provide a straightforward way to create and work with quadrilles that have irregular tiling. Even though you can do this by changing how the tiling display works, the code is not beginner-friendly.

Conclusion

The p5.quadrille.js library proved to be an incredible asset that streamlined the development process and facilitated the implementation of the game’s mechanics and visuals. Also, it greatly contributed to my journey as a game developer. It showed me the value of diverse programming paradigms to achieve better solutions and piqued my interest in exploring new concepts. Also, it invigorated me to continue with the project when I saw the chess game running on the screen. Although my experience with the library was largely frictionless, opportunities for enhancement exist. I recommend to have a focus on enhancing visual graphics capabilities. In video game development, visual effects play a huge role in immersing players in dynamic worlds and enhancing overall gameplay experiences. By further refining its visual rendering capabilities, p5.quadrille.js can solidify its position as a go-to resource for game developers seeking to breathe life into their creations.