r/C_Programming • u/laggySteel • 20d ago
Video Let's build JRPG Game in C (Tiled Map Loader/Parser) : ep 02
https://www.youtube.com/watch?v=d12qFvNxswkThis is 2nd video in my Handmade JRPG series.
we start with loading a start.map which is just a text file to understand the basics of loading a tilemap and populate map cells ID's. And later we go with JSON (cJSON library) to load the tiled map JSON as binary to load into bytes character using memory allocation. To finally parse the JSON objects.
[FEEDBACK]: please tell me what I can improve in my video to get more attention span.
[NO AI USED] : This is handwritten code. https://github.com/steelx/sdl3-tutorial
2
u/Protoype 19d ago
Thank you for this! I will follow along with this series! Thanks man!
2
u/laggySteel 19d ago
Haha most welcome. 🎮
2
u/Protoype 19d ago edited 18d ago
Just my two cents:
Looking at `map_init` and `map_number` from `src/tiled_map.c` I think it would be a good idea to initialize `n` with a default value i.e. `double n = 0.0;`; Also I would suggest not mixing types unless absolutely necessary, depending on what you intent to do with the variable keep it all int, or have precision with the double.
In `map_init` `int fallback` then in `map_number` `double fallback` so I would either be explicit and change int to a double to avoid implicit type upgrading, or when initializing `n` typecast to double to should this is intended behavior.
Thank you again! I'm enjoying learning something new with SDL3. Have you had thought about how to you will manage entities, perhaps an Entity Component System (ECS) ?
2
u/laggySteel 19d ago
Thanks. I will cover it in refactoring session. Also check I have released the third video as well
2
5
u/No-Reality6072 20d ago
I love the content, will you make a playlist for it? It would be easier to follow , thanks for the precious work 🙏🏻🙏🏻🙏🏻