Nice, I don't think I've ever seen a non-grid snake! I've found a little exploit: if you keep circling around in the center taking as much space as you can the spikes will only appear on the sides and you never have to worry about them. Also in this situation the tail remains basically stationary, so that there's no downside to swallow all apples. Nice job anyway!
Viewing post in Hungry Snake jam comments
Yeah, definitely need to fine tune the spawning mechanic. The way it works is that I choose a random spot and then measure the distance of this spot to the player (all segments) and to other objects to avoid overlapping. If there's nothing inside a certain radius then I spawn the object there. Each type of object (thorn, apple) has a radius but I didn't dedicate as much time as I wanted to fine tune them.
Also the gameplay could use more variety. One suggestion I saw on stream (I think ACD stream) was to be able to destroy the thorns somehow and I figured out I could spit the apples instead of swallowing, losing the points but destroying a thorn. It would require a minimum of X apples on your mouth to avoid spamming. I might try that later.
Thank you for playing and for the feedback.
I see, I figured it must be something like that. So you generate random positions until you find a free spot right? I always wondered if there's a better way, because this takes more time as the available space is reduced and the entities you must check increase.
Gameplay definitely needs more variety and your idea about splitting apples sounds very good! Some random suggestions that are just popping into my mind are:
- different map layouts
- special apples
- temporarily disables spikes and allows you to push them out of the way
- classic inversion of movement direction with respect to input
- rotten apple that loses you one or more segments but does not immediately end the game
I tried minimizing the impact of checking for a free spot in some ways.
Every apple or spike is added to a group and on every spawn attempt I go through this list checking the distance squared (to avoid a square root calculation) to the position I want to spawn. If it's bellow a threshold I'll elect a new point and start again.
On each frame that I want to spawn I limit the number of searches. If I reach a limit on that frame I won't spawn a new object, to avoid hanging up the game.
Even then I would probably remove this random factor in future updates and go with your idea of various levels with different map layouts. It would probably have objectives as well.
Good idea about the rotten apples, although I would probably not remove a segment because that's actually a bonus. One effect could be that the snake gets sick, which makes her minimum head size a little larger for some time.
Thanks for your reply and suggestions.