CPC Retrodev 2017: Basket Cases
5206 hits

eXTReMe Tracker


Carátula dibujada por un servidor
Cover art drawn by yours truly

En este artículo hablaré sobre "Basket Cases", mi tercer juego para el concurso anual CPC RetroDev (más exactamente la edición de 2017), de los problemas que surgieron durante su desarrollo y de las soluciones que hube de concebir a posteriori.
–– In this article I'll speak about "Basket Cases", my third game for the yearly contest CPC RetroDev (more exactly the 2017 edition), the problems that arose during its development and the solutions that I had to devise later.



Varios juegos deportivos para CPC: "Hockey", "Fernando Martín Basket Master", "Drazen Petrovic Basket" y "Golden Basket"
Several sports games for CPC: "Hockey", "Fernando Martín Basket Master", "Drazen Petrovic Basket" and "Golden Basket"

Fue a raíz de una conversación hace tres meses que surgió la idea de hacer un videojuego de baloncesto. ¿Por qué? Hay varios motivos, pero destaca el histórico: el baloncesto es un deporte relativamente mal representado en el videojuego europeo, en parte por la dictadura del fútbol, en parte por el escaso nivel técnico de la mayoría de los juegos deportivos. En el mejor de los casos, eran muy limitados; en el peor, eran lentos y tediosos, y no tenían el menor respeto a las reglas de juego. Por tanto parecía un buen desafío: un juego de baloncesto rápido y divertido. ¿Sería factible?
–– It was because of a conversation held three months ago that the idea of making a basketball videogame came to be. Why? There are multiple reasons, but the historical one stands out: basketball is a relatively poorly featured sport in European videogames, partly because of the dictatorship of football, partly because of the low technical level of most sport games. In the best cases, they were very limited; in the worst, they were slow and tedious, and didn't respect the game rules in the least. Thus it seemed a good challenge: a fast and fun basketball videogame. Would it be feasible?


"Frogalot" (2015) y "Hire Hare" (2016), ambos ganadores de los segundos premios y los áccesits al avance técnico
"Frogalot" (2015) and "Hire Hare" (2016), both winners of the second prizes and best technical advancement awards

El listón estaba bastante alto. Había presentado "Frogalot" en 2015 y "Hire Hare" en 2016; ambos fueron bien recibidos en las pasadas ediciones de CPC RetroDev y ambos ganaron los mismos premios: segunda posición en la categoría principal y áccesit al avance técnico en el primer caso por el scroll cilíndrico, en el segundo por la tercera dimensión isométrica. Estos juegos no habrían sido posibles sin rutinas gráficas solventes y algoritmos destinados a aprovechar mejor la memoria y la potencia (ambas muy limitadas) del Amstrad CPC 464, el ordenador en el que estos juegos debían funcionar.
–– The stakes were quite high. I had showcased "Frogalot" en 2015 y "Hire Hare" en 2016; both were well received in the past editions of CPC RetroDev and both won the same awards: second prize in the main category and best technical advancement award, in the first case because of the cylindrical scroll, in the second one because of the isometric 3D. These games wouldn't have been feasible without performing graphic routines and algorithms aimed at getting the most off the memory and the power(both very limited) of the Amstrad CPC 464, the computer where these games had to run.


Dos buenos ejemplos: "International Basketball" (1983 Andrew Spencer) y "Arch Rivals" (1989 Midway)
Two good references: "International Basketball" (1983 Andrew Spencer) and "Arch Rivals" (1989 Midway)

Hay muchas formas de concebir un videojuego de baloncesto, pero en general las perspectivas parcialmente tridimensionales son las más corrientes. Proporcionan una buena vista de la cancha a la vez que destacan la verticalidad del juego: los saltos y los balones aéreos son parte fundamental del baloncesto. Dos ejemplos ilustres son "International Basketball" en el Commodore 64 y "Arch Rivals" en las recreativas, ambos superiores en muchos aspectos a "Fernando Martín Basket Master", que era el mejor de los cuatro títulos nombrados anteriormente.
–– There are many approaches to a basketball videogame, but generally speaking, partially tridimensional displays are the most usual. They provide a good sight of the court and they make the game's verticality stand out: jumps and airborne balls are core parts of basketball. Two noteworthy examples are "International Basketball" on the Commodore 64 and "Arch Rivals" on arcade machines, both superior in many aspects to "Fernando Martín Basket Master", the best title among the four games previously named.



La primerísima versión de la cancha de baloncesto y el primer conjunto completo de sprites de los jugadores
The very first version of the basketball court and the first complete set of player sprites

El desarrollo del juego estuvo marcado por la escasez de tiempo. "Frogalot" y "Hire Hare" ya habían sufrido problemas graves al respecto pero todo fue mucho peor esta vez. El primero de todos los gráficos (el decorado) fue dibujado veinte días antes de la fecha de entrega, y el segundo (los sprites de los jugadores), siete días antes del temido 31 de octubre. Era un estado constante de querer y no poder, hasta el extremo de que varias veces me planteé rendirme y abandonar el concurso.
–– The development of the game was beset by the lack of time. "Frogalot" y "Hire Hare" already suffered serious problems on this matter but everything got worse this time. The very first graphic (the background) was drawn twenty days before the deadline, and the second one (the player sprites) seven days before the dreaded October 31st. It was a neverending state of "I want, but I can't", up to the extreme of repeatedly pondering giving up and quitting the contest altogether.


Un conjunto de gráficos casi terminado, con cabezas y cuerpos por separado, y con colores para asignar en tiempo de ejecución
An almost finished set of graphics, featuring separate heads and bodies, and with colour palettes to be set on runtime

La escasez de tiempo se agravó por la otra escasez importante, la memoria. Desde el primer momento estuvo claro que el juego usaría de un doble búfer por hardware (como en "Frogalot") para mover sprites a la mayor velocidad posible, y de propina sin sufrir parpadeo alguno: pero este método exige consumir el doble de memoria de vídeo que la normal. Peor aún, si quería usar la pantalla entera en vez de reducirla, el consumo se elevaba a 32k, la mitad de la memoria entera. Y además había que incluir los mapas de azulejos, uno global con el decorado entero (80x25 azulejos, 2k) y otros dos parciales, uno para cada búfer (40x25). Evidentemente lo primero que hubo que sacrificar fue la variedad de sprites: almacené las cabezas (una para equipo) por separado de los cuerpos (los mismos para todos los jugadores), y los colores se recalcularían cada vez que el juego necesitase mostrar un nuevo equipo; de ahí que cuerpos y cabezas usen colores distintos. Para entonces, a base de crear y destruir gráficos, ya me quedaban solamente cuatro días.
–– The lack of time worsened because of the other major lack, memory. Since the first minute it was a fact that the game would rely on a hardware double buffer (as done in "Frogalot") to move sprites at the highest speed, and as a bonus avoid all jittering: but this method requires spending twice as much video memory as normally. Even worse, if I wanted to use the whole screen instead of shrinking it down, the requirements rose to 32k, half of the whole memory. And besides I had to include the tile maps, a global one with the full background (80x25 tiles, 2k) and two partial ones, one for each buffer (40x25). Obviously the first to take a hit was the sprite variety: I stored the heads (one for each team) apart from the bodies (the same for all players), and the colours would be reassigned on each time the game needed to show a new team; hence the need of heads and bodies to use different colours. By that time, after creating and destroying so many graphics, I only had four days left.


Los dos primeros equipos, con las paletas de color ya asignadas
The first two teams, with the colour palettes already set

Como el tiempo se acababa y la memoria no sobraba, el resto del juego hubo de hacerse a marchas forzadas, sacrificando cosas sobre la marcha a medida que (una y otra vez) me estrellaba contra el límite de la memoria. La posibilidad de hacer que cada cancha fuese de un color distinto fue abandonada porque me costaba medio kilobyte; las canciones (la canción popular americana "Buffalo Gals", una versión de "Pro Snooker Simulator" de David Whittaker para C64 y otra de la segunda mitad de "Phantis" de Fernando Cubedo) debieron ser simplificadas para que ocupasen menos de 2k en total; el texto informativo que debía aparecer durante el menú también fue eliminado; la idea de que los últimos equipos dispusiesen de habilidades especiales tales como la teletransportación se fue igualmente al cajón; incluso algo tan elemental como animar los brazos de los jugadores para botar la pelota tuvo que desaparecer.
–– As time ran out and memory was short, the remainder of the game had to be made against the clock, giving things up on the fly as (again and again) I ran into the memory limit wall. Painting each court in a different colour was abandoned because it ate half a kilobyte; the songs (the folk American song "Buffalo Gals", a cover of David Whittaker's "Pro Snooker Simulator" for the C64 and another of Fernando Cubedo's second half of "Phantis / Game Over II") had to be simplified until they all fit in under 2k; the information that was to be written during the menu was removed too; the idea of giving the last teams special abilities such as teleporting went back to the drawer as well; even something as basic as animating the players' arms to bounce the ball had to go.


La inteligencia artificial en funcionamiento; no pulsé una tecla en toda la partida
The artificial intelligence at work; I didn't touch a key during the whole game

Solamente una cosa estaba clarísima y debía ocupar todo el espacio que necesitase sin concesión ni sacrificio alguno: el juego debía tener una inteligencia artificial capaz de poner en aprietos al jugador. Fue donde invertí casi todo mi empeño durante la etapa de programación y en el que finalmente gasté más tiempo. Y aunque para entonces ya solamente quedaban horas antes de la entrega, no paré de mejorar la IA para que fuese capaz de distinguir entre estrategias de ataque y defensa, y para que cada uno de los jugadores controlados por el ordenador tuviese un objetivo diferente que supiese desempeñar con soltura. Así fue como elaboré una fórmula general que determinaba los comportamientos de los personajes según si su equipo tenía el balón o no. Por un lado, la estrategia de ataque impulsa al jugador principal (que tiene la pelota) a correr hacia la canasta enemiga, o a tirar la pelota (a la canasta o a su compañero, según le parezca más seguro) si los enemigos se le acercan demasiado, y al secundario a ayudarle acercándose a una de las esquinas del campo enemigo para así recibir pases. Por el otro, la estrategia de defensa ordena a un jugador acosar al dueño actual del balón, mientras su compañero huye a proteger la canasta propia, pues el juego permite coger la pelota al vuelo y hacer tapones.
–– Just one thing was perfectly clear and could eat as much room as it needed without any concession or sacrifice: the game had to feature an artificial intelligence able to put the player into trouble. That's where I invested almost all my effort during the programming stage and where I finally spent the most time. And despite the deadline being just few hours away, I continued refining the AI so it could choose between attack and defense strategies, and each player controlled by the computer had a different purpose that he knew how to perform with ease. That's how I devised a general formula that set the characters' behaviors depending on whether their team owned the ball or not. On one hand, the attack strategy pushed the main player (who owns the ball) into running towards the enemy basket, or into throwing the ball (either to the basket or to his teammate, whatever he deemed safer) if the enemies got too close, and the secondary player into helping him by heading to a corner of the enemy field so he could receive passes. On the other hand, the defense strategy tells one player to harass the current owner of the ball, while his partner flees to protect his own basket, as the game allows catching airborne balls and blocking shots.



Imágenes sueltas del juego tal como fue entregado al jurado
Sample screenshots of the game as it was delivered to the jury

Mientras espero al veredicto del jurado, ya estoy corrigiendo algunos errores de los muchos que se colaron. De momento ya he descubierto que las bases de los sprites pueden ser comprimidas sin problema alguno: los casi 4k que ocupan se reducen a menos de 2k con algoritmo triviales como LZSSSE-gc. Esta ganancia de espacio (comparable a la de "Hire Hare" dos días tras la fecha de entrega) debería facilitarme en gran medida remediar los graves problemas causados por la falta de memoria y las prisas del desarrollo, desde los gráficos sacrificados hasta los errores de cálculo (por ejemplo, la IA solamente intenta robar el balón cuando se superpone por completo al poseedor del balón, cuando en realidad no necesita acercarse tanto), con la esperanza de que "Basket Cases" consiga alcanzar el equilibrio entre lo que quise que fuera y lo que estuve reducido a hacer.
–– While I await the jury's verdict, I'm already correcting several bugs among the many that crept in. So far I've already discovered that the sprite bases could be compressed without any inconvenience: the almost 4k that they consume shrink down to less than 2k with trivial algorithms such as LZSSSE-gc. This memory gain (similar to the one from "Hire Hare" two days after the deadline) should greatly ease my task of fixing the serious problems caused by the lack of memory and the rushed development, ranging from the sacrificed graphics to the calculation errors (for example, the AI only tries stealing the ball when it completely overlaps the ball owner, when it actually doesn't need to get as close), with the hope that "Basket Cases" will reach the balance between what I wanted it to be and what I was constraint to do.

César N.G., 4 Oct 2017


[ cpcgamereviews.com | cpc-power.com ]
Download the third version with further changes (255 hits)
Download the second version (bugfixes and improvements) (247 hits)
Download the original version together with its source code (837 hits)
Send a comment
Return to index