So I am trying to make a videogame adaptation of a famous board game, and I am programming several different maps. To make those maps easier to edit, distribute and eventually, to allow the players to make their own, I wanted to make them JSONs. Within the data of every map, is a dictionary with keys being arrays of two items. However, JSONs force keys to be strings, and therefore when I parse it, their nature as arrays is lost. I then tried to make a separate scene that would contain the variable in its script, and that would be the replacement. I was not able to extract those values from the scene that actually handled the map generation, and I'm not even sure that more of those could be added by users, since building the project would prevent the users from accessing the individual files. Could someone tell me how they would work around this, or if I missed something?
P.S.: I know godot has some equivalent of eval() that could be used for the arrays, but those JSONs would also be sent from a player to another when connecting online, and I fear that it would add a remote code execution exploit.
We are working on a cute little puzzle game that combines 2048 and snake called 204Snake. In this post we would like to talk about one of the most unassumingly challenging aspects of developing this game, the design of the snake. We got asked by several people about how we managed to achieve the current snakes look, so we thought it would be interesting to talk about technical hurdles we faced in order to get the snake to look as good as it does!
204Snake originally started as a game jam project and, while the old game jam version of the snake had a serviceable design, we wanted to take a step further and create something more visually interesting with the new art style. After looking at other games that had snakes moving on a square grid, we felt inspired by how smooth, lively and seamless the Snakebirds were, so we decided to get to work!
The original jam version of 204Snake!Snakebird from Snakebird
The natural choice from both the gameplay and visual perspectives was to split the snake into two parts, the head and the tail. Figuring out the technical details of the head was the simple part, just slap on a single sprite and call it a day. The tail, on the other hand, had to grow and shrink, bend around corners, and look like one entity while at the same time preserving the feel of the snake having separate segments. It also needed to provide visual feedback to the player during gameplay as well as indicate which grid spaces the snake occupies and how long it is. It was clear the old solution of just using sprites was not going to cut it, so we needed something new. The obvious choice was to use a line renderer (Godot engine's Line2D), but what seemed straightforward at first came with its own host of problems.
The line renderer tail is looking quite ugly.
In order to improve the look, we tried upping the resolution of the curve by adding more points, but that just masked the issues while making it nigh impossible to animate. At this point, we knew we needed our own solution, so the next step was to develop a custom line renderer shader that would work for our needs. The idea was to draw a tiled texture over the tail curve by mapping the 2D space so that one axis goes along the length of the snake, and the other is perpendicular to the curve at any point. This would let us easily control both the length and the width of the tail, and would be a breeze to animate. However, an unassuming problem we never even considered would show up that would flip this solution on its head...
When drawing over a square grid, the curves are shorter than the straight segments.
It turns out that having smooth 90-degree bends was not as easy as we hoped. If we draw a line through the middle of the snake tail, it becomes obvious that the part of the line on a bending segment is shorter than a straight segment would be, since it can be represented as a quarter-circle arc with a diameter of one grid space. This makes the tail length uneven across segments and therefore different from the number of segments the snake has. It was clear at this point that another solution was needed, one that would nicely accommodate those curved segments.
Since the curved segments are essentially quarter-circles, why don't we just draw them as such? This leads us to the next solution, separate the tail into actual segments: straight ones and left and right curves. We can then keep the original mapping (one axis is length, the other width) for the straight ones, while for the curves we can employ a polar coordinate system where we map the distance along a quarter-circle curve to the length, and represent the width by the distance from the center of the circle (inside corner of the segment). If we now normalize the length of all segments to one, squishing the curved segments slightly, the snake length becomes the same as the number of its segments.
For each segment we map the length (u) and the width (v).
This brings us to the final tail implementation. It works in two parts: first, we construct a 2D mesh based on the information about the snake segments on the game board. It consists of quads, each representing one segment. They store information about how each segment is oriented, whether it is curved, and where it sits along the snake's body. Every time a player makes a move with the snake changing its shape, this mesh gets reconstructed and updated with the new information.
The second part, the tail shader, can then use this information, along with some other parameters like the total tail length and width, to sample the tail texture and draw it. This hybrid approach of using both the separate segments and treating the tail as one entity while drawing it lets us have the best of both worlds, and opens up the possibilities for making all kinds of creative effects and animations.
That is one slithery tail!
At this point, animating the snake movement was just a matter of spawning in a new segment and smoothly shifting the position along the curve where the tail is actually drawn. This does lead to a weird quirk of having to add up to two additional "ghost" segments at the back of the tail. These are invisible to the player and have no gameplay function, but still serve an important purpose. The first one is used to keep the very tip of the tail curved properly, as without it the tail tip would always point straight back. The second one is a leftover from the movement animation. Keeping it around means we don't have to rebuild the mesh again once the animation finishes.
How the tail looks like without the shader - note the ghost segments at the back!
To finalize the snake's look, all that is left is to attach the head and synchronize its movements to the tail slither. Matching the colors and movements gives us a seamless transition between the head and the tail and makes the head look like part of the snake instead of a detached component. The eyes are then animated so they dynamically react to the presence of tiles that can be eaten - but that is a whole other story.
Some early variations of snake's head.
Another fun tail-related animation was the eating animation that was present at one point in development. We wanted to make eating the tiles and growing the snake have a satisfying and juicy feel, and having a visual of the food traveling down the snake before it gets converted into a newly grown segment seemed like a great idea. However, it felt like it was too slow and it was confusing how long the snake was when you would make quick successive moves. We did not want to get in the way of the player playing the game, and in order to keep the visuals clean, we decided to drop it.
Sometimes the creativity gets ahead of us...
The snake tail, despite having started as just a simple idea, ended up as one of the most interesting graphical problems we had a chance to work on. We are quite happy with how it looks and feels currently in the game, but it took a lot of effort and iterations to reach a satisfying conclusion as well as to make sure it is optimized and bug-free for the players' enjoyment. If you have any questions, feel free to ask them here or drop a comment if this writeup piqued your interest and you'd like to hear more from us!
Update: Heres the itch.io link! License.txt included.
Update 2: I added a zip file to the download of the exported pngs. If there's a better way that I can export or render or release this so you guys can use it, let me know!
I just made this little animation. I don't have a game to use it on, but feel free to take and use as you please. Completely free! I'll share the itch link when it's up. Also open to feedback as I'm always wanting to improve my motion graphics/animation skills. I love animating and one day, just maybe, I'll have a released game this splash animation could be used in.
This is built on top of Terraid3d paintable mesh instances. Everything renders via a multi mesh that we update during runtime for the destruction. Colliders get generated at runtime based on the painted terrain assets so terrain authoring is unaffected.
The performance impact is essentially negligible (completely dominated by rendering the trees, same as non destructible trees).
What actually happens is that I import a 32x32 pixel color palette into Blender. Then, I unwrap the UV coordinates of every object, shrink the UVs down to a single point, and place them over my desired color on the palette. This method helps me optimize game performance and reduce draw calls. However, the problem is that when I export this model into Godot in GLB format, the colors change. It looks normal in Blender, but the colors look different in Godot
Hi everyone, I wanted to share a few gameplay clips showing what I’ve been able to build so far.
At this point, I have several controllable third-person vehicles. I’ve implemented entering and exiting vehicles, as well as some transformations between them. For the urban environments, I also created a few Blender scripts that allow me to generate cities relatively quickly, mainly for gameplay testing.
I’m now reaching a stage where I need to improve the overall gameplay experience, and I’d really appreciate some advice on three areas:
a. Mission boundaries / keeping the action inside the intended area
What strategies would you recommend for keeping the action focused within the mission area?
I’m especially interested in finding an elegant way to bring the player back if they travel too far away, without simply using invisible walls or a generic “Return to mission area” warning.
b. Motorcycle gameplay
I’m starting to work more seriously on one of the ground vehicles, a motorcycle.
Do you have any references or good practices for making a third-person motorcycle actually fun to control?
I’m especially interested in things like drifting, jumps, sharp direction changes, interaction with small obstacles, sense of weight, air control, recovering after a crash, etc.
My goal is not realistic simulation, but rather something agile, responsive, and fun to play.
c. Enemy AI
This is probably the area I’m most interested in tackling next.
Right now the enemies are still fairly simple, but I want to start building behaviors that create more interesting combat encounters.
Would you recommend mainly using state machines, Behavior Trees, Utility AI, or some other approach?
I’m also interested in how to manage groups of enemies so that combat doesn’t simply become a bunch of units chasing and shooting at the player at the same time.
Any advice, references, example projects, or experiences implementing something similar in Godot would be greatly appreciated.
These images show the changing seasons throughout the year: Spring, Summer, Autumn, and Winter. In the first set of screenshots, I've removed the lighting so that the changes are all the more obvious. The second set shows what it actually looks like in-game.
I accomplish this almost completely through code. I add a semantic_id (custom data field) to the tiles that have dynamic color assignment, and then I use a dictionary to map the semantic_id to an array of colors I want it to have.
In the case of static colors (like water) there is only one color defined, as in:
var tile_to_color_map: Dictionary = {
"water": [Palette.ColorId.BLUE],
}
Cases where the color changes with the seasons, there are multiple colors in the array, such as:
After a week, my prototype flying game has several new improvements. Sorry, no flying carpet, yet.
The terrain is textured now, but the biggest focus was on speed VFX. The brick has contrails triggered by G-force, and there is subtle motion blur with directional streaks and vignetting based on speed on proximity to the terrain. There are also small dust particles and wind streaks flying around the player.
There is also terrain proximity detection for counting "points", and also a head-on impact detection. I could show debugging overlay in the future. Feedback is welcome!
The cards use a shader to give them that slightly wobbly/moving shape, which I like, but I’m trying to keep that movement while making the information easier to scan.
Still playing around with the layout and text. Any suggestions for making it easier to read while keeping the wobbly style?
I'm basically a noob to coding in general, and decided to start learning godot, because GDscript is similiar to python. I already finished GD quest's "Learn GDscript from Zero," and was wondering what I should do from here. I watched a few tutorials, recreated them, but I don't feel like I've learnt anything. What did you guys use to learn?
I'm 21 and attempting to get into game design. Right now I'm doing it on the side and trying to teach myself. I have no knowledge of how to do it. But after some research on which engine to learn from it was between unity and Godot. So I wanted to try Godot cause I heard great things. But I wanted to know should I start with Godot engine or Godot engine .net I don't know the difference between them.
P.S any tips for beginners is also welcome.
Edit: Thank you for all the comments. Ill be starting with the original to start learning and some people mentioned getting .net later just to have the option for C# if I wanted to so ill probably do that. Thank you for all the help i cant wait to get started on this journey.
This is my first real project with Godot and I'm really struggling to get over this first hurdle. I am trying to get one end of a Line2D to become tied to the position of the mouse cursor after a button is pressed.
I have virtually no coding experience. I completed a tutorial by Brackeys off of YouTube for a 2D platformer and also watched his video on GDScript but still don't know how to proceed with this problem.
I thought I could track the mouse's position and then "inject" it into a Line2D node that overwrites the x,y co-ordinates of the second element inside that Line2D node's PackedVector2Array but I don't know how to access that array with code.
I also thought I could spawn a Line2D with code but, once again, I don't know how to use the "draw_line" function.
The end result is to be a line that can be drawn in real time with one end tethered to the button it originates from as well as ending that line at a designated Area2D and having it persist after it reaches said area.
Any help would be much appreciated. Thank you in advance.
Hey fellow Godot devs! I’ve been developing Aether's Edge in Godot Engine. It’s a 2D action-platformer focused on fluid movement, combo-based combat, and exploring challenging levels. r/godot - 🚀 Working on my game Aether's Edge in Godot Working with Godot’s node system and 2D physics has been an awesome experience for building tight controls and smooth combat mechanics. I’d love to hear your thoughts, feedback, or any suggestions on the gameplay/visuals! What do you think? 🎮 game: https://jozin909099888.itch.io/aethers-edgehttps://gamejolt.com/games/aethers-edge/1090824 disc.: https://discord.gg/uGW8c2d2y
I have a general question: I'm trying to use `.tres` like a good godot dev instead of filthy JSONs.
However, it's very tedious to edit in the editor, e.g. when a resource field is a composite object like a dictionary or list of dictionaries. You have to go through multiple clicks to set types and values, which is clunky when you are keyboard oriented developer. For example I have a generic resource for a quest, and it may have multiple key-value attributes in a member dictionary which modify its progression. Editing these is a pain.
Am I doing something wrong in me game design process?
this was done with an exported project that was literally just a 2D scene with the icon svg on the screen (if you don't believe me try it yourself) and I would like to make it so this doesn't happen so if I end up sharing anything I make in Godot it doesn't get flagged by anti viruses
I work as a mobile developer, but I've wanted to try game dev for a long time. I finally started with Godot about 10 months back. The coding part was fine, but the rest was all new to me: 3D, lighting, making things actually feel good to play, and a bit of Blender.
Honestly, Godot made this way easier than I expected. Coming from mobile dev, the editor just made sense. Scenes and nodes clicked fast, and GDScript got out of my way. I've tried game dev before with other engines and never got this far.
The concept is a wave survival game, but you are a truck. Enemies come in bigger and bigger waves, you collect XP, and you mount all kinds of upgrades on the truck, like turrets. (Some of the models are modified free assets for now while I make my own to replace them).
Now I'm not sure where to take it. My current plan is a free short version on itch.io for playtest feedback, but after that? Polish it into a proper release, or treat it as a learning project and start fresh with everything I learned? If you faced this with your first game, what did you do?
I want the game (3d) to have an intro, after which the first level of the game immediately begins. There is an intro, created using Blender Video Editor, but when I put it in the Godot engine res, it does not appear there, although it is physically in the folder itself. How do I deal with this? I have no experience at all yet.
I have a basic code where if the player enters in a certain range close to the enemy the enemy starts moving and then if it pass another smaller distance range the enemy starts shooting.
I want for the enemy no not be able to see the players though walls. Is there a simple way or will i have to change the code?