Game Programming Patterns by Robert Nystrom. В книге рассматриваются различные шаблоны проектирования, применительно к геймдеву. Это не что-то новое, а просто удобная подборка с примерами и доступным описанием. Крайне рекомендую к прочтению, читается и воспринимается книга легко.
Краткий список шаблонов, которые рассмотрены в книге: Command, Flyweight, Observer, Prototype, Singleton, State, Component, Event Queue и прочее.
На английском языке книга доступна в разных форматах на сайте автора. Есть и исходники, и переводы на русский язык.
Английская версия (оригинал) в различных форматах, включая бумажный вариант
Worms Zone – a game about worms, or slither.io on steroids
At first, I didn’t even think of making a game. I just wanted to try implementing smooth worm movement – where the segments don’t follow the exact path given by the player, but behave more naturally. Yes, it’s a bit more complex and requires more calculations, but the movement looks much nicer and more interesting. My first tests were done in a Java-like language using Processing. After about an hour, I had a working prototype – a project on GitHub.
Watching the worms eat “apples” in my prototype, I decided to move forward with developing a full-fledged game.
I first rewrote the worm movement algorithm in C++ and then began refining it. The most important part was to pass the “coiling test” – when a player curls the worm into the smallest possible loop. Most games of this kind fail here: the worm’s tail stops moving, and only the head and a few segments follow, which looks awful.
Once I had an algorithm that passed the coiling test, I ran into a new issue: long worms had many “invisible” segments hidden behind others on the screen. Time to refine the algorithm – the tail still follows the head, but the number of visible and calculated segments decreases. When the worm moves straight again, the segment count returns to normal.
Then came the small details: when boosting, the worm should lose mass, becoming shorter and thinner. When moving normally and eating goodies, the worm should grow in both length and width. These details turned out trickier than they seemed at first – always a nuance, and here there were many 🙂
Game development and gameplay evolution
Worm bots were added to the arena, and their AI gradually improved. The first versions of the AI were, frankly, terrible. Now the bots are much smarter – and sometimes even cheeky.
I experimented with the interface. Unfortunately, I’m no designer or artist, so the result is what it is.
Gradually, support for different platforms was added – iOS, Apple TV, Android, Android TV, Web, Linux, Facebook Instant Games, OK, VK, and more. Since development was done on macOS, that was the first platform the game worked on.
I implemented multiple control schemes – mouse, remote control, gamepad, keyboard.
Gameplay evolved with new power-ups: a temporary worm extender; a radar showing other worms on the map; and a 5x multiplier for rapid growth and score boosts.
Balancing gameplay is still ongoing. I haven’t yet found the ideal parameters for arena size and maximum worm count; worm growth and weight loss rates; and the cost of skins and customization.
Over time, the game accumulated various features. Skins with textures were added, and I wrote a simple Photoshop plugin to make textured skins easier to create. It was very basic – it automated only a small part of the process, so some steps still had to be done manually.
A few technical details
All sprites (UI, skin elements, effects, power-ups) are stored as separate files. During the resource build stage, atlases and descriptions are generated – all done via the console. Yes, I love the console. The atlas packer, of course, is my own.
I also wrote a simple shader implementing a “circular indicator” to show remaining power-up time. I based it on one of my older shaders available on ShaderToy. Nothing fancy – it could have been done without it.
The game supports multiple languages: English, Russian, French, Spanish, Vietnamese. Adding a new language is no problem — you just need to order a translation. The game uses the free Google Noto TTF font, which contains glyphs for many languages, and the required character atlas is generated at runtime.
I worked on the engine and game code while at Synesis. Graphics, music, animations, and all other non-programming aspects were handled by other talented specialists.
I can’t go into full detail about the development process or the internal structure of the engine and game. Both the game and the engine – as well as the toolchain needed to build the game – were written in C++.
The development process itself was similar to most casual games: we chose the game concept, the artist/designer created sketches, and we approved them together. Animators and integrators then got involved, while I focused on writing the game code and, when necessary, refining the engine. Everything was then combined into a single project, resulting in a game for iOS and Android.
Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.