this post was submitted on 05 Mar 2024
12 points (92.9% liked)
Game Development
3471 readers
6 users here now
Welcome to the game development community! This is a place to talk about and post anything related to the field of game development.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I dont know how larger games do it but it mostly depends on what kinds of enemies and what genre of game youre doing.
If you have a lot of enemies that will be spawned and despawned and they are mostly the same you can do an object pool where instead of destroying the object it gets hidden and added to the back of the pool for another enemy to spawn in as in the future by showing it and moving it to the correct spot
In terms of when to spawn it usually (assuming youre doing most genres) you can just spawn it right outside the view of the player when they hit a trigger. In games I usually make enemies are spawned on a timer since it tends to be more arcade like and in that case you usually just spawn them outside the range of the player in a random location around a radius after X amount of time has passed
Can give more specific things if I know the genre
Also downvote is likely someone from the all feed
It's an rpg/soulslike, so I wouldn't likely be spawning randomly all the time. But I do like the idea of spawning in a small radius outside the player view, and the pool idea is good. That could really help with keeping resources down. Only issue I could see with that is distinguishing which pool actors to choose the activate again. I'll have to think about that a little bit since enemies will be different.
It doesn't directly answer you but what you're thinking about is the sort of thing addressed by a book I'm a big fan of, Data Oriented Design. It's addressed briefly in the online version here https://dataorienteddesign.com/dodbook/node6.html#SECTION00620000000000000000