There were plenty of books, but smaller articles were more common.
When I first started programming in 1983 I had three books: a computer user's reference guide, a BASIC programming reference manual, and a game programming book. Then over the following years my friends and I picked up several more game programming books. In addition to the game programming books having collections of dozens of games, more importantly they included topics on sprites and sprite animation, sound, and other tools needed to make games. With the source you could implement a specific thing, but with the concept you could implement anything. Most of these were written in BASIC, the language was portable enough so you could adapt it, and they were for the common machines like the Commodore 64, the TRS-80, the Apple 2, the TI 99 (which is what I had), the Atari 800, and similar. All had a similar BASIC programming language built in, all supported graphics and sounds, all had optional game controllers or paddles or joysticks, so a game programming book for one could be used on any of them.
In the mid 1980s I was looking through local bookstores for books about game programming. There were plenty of books on game development, but were more about basic how-to guides on those same topics of simple sprites and animation, tonal beeps and note frequencies, line drawing and curve drawing algorithms, and similar. More books than my young budget could afford, but tremendous overlap on what they covered.
Although those early games were simple by today's standard, they were on par with arcade games of the then-recent past, as well as text-based games. You can write one line of text at a time to generate a “ski” style game. Simple sprites can make games like Space Invaders and Asteroids. I made a lot of maze games because maze generation is easy. Snake was simple. Missile command, various tank games, simple driving games. For all the styles of games you could find books and articles describing the basics for all of them.
As the years passed, people started writing articles on BBS, or since you're young, Bulletin Board Systems where people would post and share files before the inter-connected network was widely accessible. Other people would share their notes on Usenet, which was basically a discussion board for the early Internet that was mirrored on various BBS. I spent a lot of time reading those in the early 1990s. The format was usually small articles rather than books.
By 1990 I was using libraries and the inter-library loan system to get all kinds of game programming books and magazines. They were still primitive by todays standards, but they were real examples of complete source code for small games. Lots of niche magazines existed where anyone who could write a game in <20 pages of printed text (usually 4 columns wide) could get it published and shared. People talked about how they solved the problems, how they created mechanics, and anyone who wanted could type the code on their own box and adapt it to their own ideas.
We used hardware references like Ralf Brown's Interrupt List that listed all the hardware functions on the PC. There were more proper journals and magazines like Dr Dobb's Journal (DDJ) that had roots in in sharing video game programming that included a bunch of people writing about game-oriented content. For example, author of a set of books “Zen of Assembly Language” Michael Abrash, who wrote about a bunch of techniques for high performance in graphics from his days working on pac-man clones, maze games, space invader clones, and similar. He wrote for DDJ while working at Microsoft on early grahpics code for Windows 3.1, as he transitioned to id software to work on games like Quake and wrote all kinds of articles about how to get high performance. He wasn't the only game-specific writer but he was (and remains) high profile. Lots of game developers had articles on algorithms and techniques published in DDJ.
By the early 1990s people had compiled a bunch of high profile articles in what was called the PC Game Programmer's Encyclopedia (PCGPE), you can still find expanded collections of the articles online. This still wasn't really a book, but a series of articles on how to do things. I remember struggling through the XMS article and the first time I was able to use memory beyond the 640KB limit (also called the A20 line). There were also growing collections of books on the math and algorithms that were focused on game development specifically, rather than having to draw from mathematics books and general computer science textbooks.
For game design, books and articles tended to have tiny nuggets about design and game mechanics sprinkled in. Usually it was of the form “we struggled with this feature, here's a description of how we solved the problem, and here is some source code.” Think more like a technical research paper.
By the end of the 1990s and early 2000, there were ever growing collections based on the same format of PCGPE. Books like the Game Programming Gems series were published, and just like the Game Programmer's Encyclopedia were a collection of small game-focused articles compiled into a larger book.
And by the early 2000s there were websites like gamedev.net (hehe) with an ever-expanding collection mostly in article format. You can still browse over a thousand articles, tutorials, and guides on the archive of this site from that era.