Hello Yal! Very interesting! Does it support 3d models and ability to add some pathfinding for AI? Thanks!
Viewing post in Horror Engine: 8 Souls comments
It's a Game Maker:Studio project file, so it has about as much support for those things as GMS has innately (there's no code for either of those at the moment - the level is a 3D model generated randomly, the enemy just teleports around randomly).
I dug up a bunch of learning resources that could be useful:
- Game Maker's documentation on pathfinding: https://docs.yoyogames.com/source/dadiospice/002_reference/movement%20and%20coll...
- A tutorial on using OBJ models in GameMaker: https://forum.yoyogames.com/index.php?threads/3d-tutorial-importing-obj-models-i...
Dear Yal! Its all nice working but im facing some issue with terraincontrol object, when i click Play button my game freezing for 10 sec :(( I'll try compile with YYC but it didnt help. In the debug screen i saw just
"Pause event has been registered for this frame"
and "Pause event has been unregistered" after that
Please, how can i fix this? Thanks!
gms2 (ide 2.2.4.474, runtime 2.2.4.374)
I looked into how the vertex buffer system works (I try to avoid everything that has a scary name :P) and it seems to not be super difficult to convert the game to use it. Sorry about the delay with the code fixes, it took some time to research it. Based on the example code on the GMS2 manual page on building primitives...
1) Define a vertex format (you'll need position data, texture data, and normal data - you should add them in the same order they're provided as arguments in the d3d_model_vertex/.../ functions)
2) Find the compatibility scripts for the various d3d_model scripts. If you've done any changes to the project, make a backup now, because we'll hack the compatibility scripts.
3) Change d3d_model_create() so it will create a vertex buffer and start a primitive using your custom format:
v_buff = vertex_create_buffer(); vertex_begin(v_buff, global.my_format); return v_buff;
4) Change d3d_model_vertex_normal_texture() so that it will add vertex data. It's important you add this data in the same order you defined the different data in the vertex format.
vertex_position_3d(v_buff, xx, yy, zz); vertex_texcoord(v_buff, tx, ty);
5) Change d3d_model_draw() so it will submit the vertex buffer to the pipeline (using a texture):
var tex = background_get_texture(selected_background); shader_set(shader_prim); vertex_submit(v_buff, pr_trianglelist, tex); shader_reset();6) d3d_model_primitive_begin() now would have no effect, so delete all code in that script.
7) d3d_model_primitive_end() could be emptied, or just use vertex_freeze() to make the vertex buffer read-only (which speeds up drawing it)
Hope this helps! Let me know if there's any problems.