Multiple layers of tilemap, training data for old man

main
Cameron Murphy Reikes 2 years ago
parent e4c6e55d8d
commit f909a56024

3
.gitignore vendored

@ -1,3 +1,6 @@
# AI is the future of humanity
server/converted_training.jsonl
# web builds
build_web_release/
build_web/

@ -30,6 +30,10 @@
{
filepath: "copyrighted/animated_terrain.png",
}
@image ruins_ancient:
{
filepath: "copyrighted/ruins_ancient.png",
}
@image hurt_vignette:
{
filepath: "hurt_vignette.png",
@ -50,6 +54,13 @@
{
image: image_animated_terrain,
filepath: "copyrighted/ruins_animated.tsx",
firstgid: 1,
}
@tileset ruins_ancient:
{
image: image_ruins_ancient,
filepath: "copyrighted/ruins_ancient.tsx",
firstgid: 2597,
}
@level level0:
{

@ -21,21 +21,21 @@
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 209, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 160, 53, 53, 53, 53, 53, 53, 53, 366, 367, 367, 367, 367, 367, 314, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 212, 213, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 158, 210, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 212, 159, 159, 159, 159, 159, 159, 159, 213, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 316, 367, 314, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 261, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 366, 314, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 313, 367, 367, 367, 314, 316, 368, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 158, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 213, 53, 53, 53, 53, 53, 53, 366, 367, 367, 367, 367, 367, 314, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 212, 159, 159, 159, 159, 159, 159, 159, 213, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 316, 367, 314, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 261, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 313, 367, 367, 367, 314, 316, 368, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 261, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 366, 314, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 261, 212, 159, 159, 159, 159, 159, 210, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 366, 367, 367, 367, 367, 367, 367, 367, 368, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 313, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 317, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 261, 212, 159, 159, 159, 159, 159, 210, 265, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 261, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 265, 53, 53, 53, 53, 53, 366, 367, 367, 367, 367, 367, 367, 367, 368, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 313, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 317, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
@ -97,7 +97,7 @@
"rotation":0,
"visible":true,
"width":32,
"x":1598.666,
"x":1598.67,
"y":448.666
},
{
@ -127,8 +127,79 @@
"visible":true,
"x":0,
"y":0
},
{
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3140, 3210, 3917, 3960, 2767, 3046, 3188, 3096, 2720, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3047, 2765, 3538, 3098, 3053, 3053, 3053, 2724, 3053, 2724, 2725, 2764, 3048, 3097, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3140, 3587, 3400, 2863, 3193, 4109, 4107, 4251, 3355, 3170, 2820, 2765, 3540, 2767, 3097, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3235, 2859, 3680, 2861, 2816, 3263, 3918, 3264, 3356, 3589, 2772, 3102, 3188, 3585, 3144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2906, 2859, 3096, 2816, 3873, 2818, 3969, 3195, 2864, 2866, 2867, 3094, 3208, 2815, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2858, 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y":0
}],
"nextlayerid":6,
"nextlayerid":8,
"nextobjectid":5,
"orientation":"orthogonal",
"renderorder":"right-down",

@ -3,17 +3,17 @@
"infinite":false,
"layers":[
{
"data":[53, 53, 53, 53, 53, 53, 53, 53,
53, 209, 159, 159, 159, 160, 209, 160,
53, 261, 263, 263, 263, 265, 261, 265,
53, 261, 263, 263, 263, 265, 261, 265,
53, 261, 263, 263, 263, 212, 210, 265,
53, 366, 367, 367, 314, 263, 316, 368,
53, 53, 53, 53, 366, 367, 368, 53,
53, 53, 53, 53, 53, 53, 53, 53],
"data":[263, 263, 263, 263, 263, 263, 263, 263,
263, 263, 263, 263, 263, 263, 263, 263,
263, 263, 263, 263, 263, 263, 263, 263,
263, 263, 263, 263, 263, 263, 263, 263,
263, 263, 263, 263, 263, 263, 263, 263,
263, 263, 263, 263, 263, 53, 53, 263,
263, 263, 263, 263, 263, 53, 53, 263,
263, 263, 263, 263, 263, 263, 263, 263],
"height":8,
"id":1,
"name":"Tile Layer 1",
"name":"Animated Tiles1",
"opacity":1,
"type":"tilelayer",
"visible":true,
@ -42,8 +42,27 @@
"visible":true,
"x":0,
"y":0
},
{
"data":[0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 2467, 2797, 2798, 0, 0, 0,
0, 0, 2889, 3995, 2893, 0, 0, 0,
0, 0, 2984, 2656, 2940, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0],
"height":8,
"id":3,
"name":"terrain0",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":8,
"x":0,
"y":0
}],
"nextlayerid":3,
"nextlayerid":4,
"nextobjectid":2,
"orientation":"orthogonal",
"renderorder":"right-down",

@ -19,33 +19,33 @@ MD_String8 ASSETS_FOLDER = MD_S8LitComp("assets");
#define log(...) { printf("Codegen: "); printf(__VA_ARGS__); }
void dump(MD_Node* from) {
printf("/ %.*s\n", MD_S8VArg(from->string));
int d = 0;
for(MD_EachNode(child, from->first_child))
{
printf("|-- Child %d %.*s\n", d, MD_S8VArg(child->string));
d += 1;
}
printf("/ %.*s\n", MD_S8VArg(from->string));
int d = 0;
for(MD_EachNode(child, from->first_child))
{
printf("|-- Child %d %.*s\n", d, MD_S8VArg(child->string));
d += 1;
}
}
void dump_root(MD_Node* from) {
// Iterate through each top-level node
for(MD_EachNode(node, from->first_child))
{
printf("/ %.*s\n", MD_S8VArg(node->string));
// Print the name of each of the node's tags
for(MD_EachNode(tag, node->first_tag))
{
printf("|-- Tag %.*s\n", MD_S8VArg(tag->string));
}
// Print the name of each of the node's children
for(MD_EachNode(child, node->first_child))
{
printf("|-- Child %.*s\n", MD_S8VArg(child->string));
}
}
// Iterate through each top-level node
for(MD_EachNode(node, from->first_child))
{
printf("/ %.*s\n", MD_S8VArg(node->string));
// Print the name of each of the node's tags
for(MD_EachNode(tag, node->first_tag))
{
printf("|-- Tag %.*s\n", MD_S8VArg(tag->string));
}
// Print the name of each of the node's children
for(MD_EachNode(child, node->first_child))
{
printf("|-- Child %.*s\n", MD_S8VArg(child->string));
}
}
}
bool has_decimal(MD_String8 s)
@ -60,181 +60,206 @@ bool has_decimal(MD_String8 s)
MD_Arena *cg_arena = NULL;
MD_String8 ChildValue(MD_Node *n, MD_String8 name) {
MD_Node *child_with_value = MD_ChildFromString(n, name, 0);
assert(child_with_value, MD_S8Fmt(cg_arena, "Could not find child named '%.*s' of node '%.*s'", MD_S8VArg(name), MD_S8VArg(n->string)));
assert(child_with_value->first_child, MD_S8Lit("Must have child"));
return child_with_value->first_child->string;
MD_Node *child_with_value = MD_ChildFromString(n, name, 0);
assert(child_with_value, MD_S8Fmt(cg_arena, "Could not find child named '%.*s' of node '%.*s'", MD_S8VArg(name), MD_S8VArg(n->string)));
assert(child_with_value->first_child, MD_S8Lit("Must have child"));
return child_with_value->first_child->string;
}
MD_String8 asset_file_path(MD_String8 filename) {
return MD_S8Fmt(cg_arena, "%.*s/%.*s", MD_S8VArg(ASSETS_FOLDER), MD_S8VArg(filename));
return MD_S8Fmt(cg_arena, "%.*s/%.*s", MD_S8VArg(ASSETS_FOLDER), MD_S8VArg(filename));
}
char *nullterm(MD_String8 s) {
char *to_return = malloc(s.size + 1);
memcpy(to_return, s.str, s.size);
to_return[s.size] = '\0';
return to_return;
char *to_return = malloc(s.size + 1);
memcpy(to_return, s.str, s.size);
to_return[s.size] = '\0';
return to_return;
}
char* fillnull(char *s, char c) {
while(*s != '\0') {
if(*s == c) {
*s = '\0';
return s + 1;
}
s++;
}
assert(false, MD_S8Lit("Couldn't find char"));
return NULL;
while(*s != '\0') {
if(*s == c) {
*s = '\0';
return s + 1;
}
s++;
}
assert(false, MD_S8Lit("Couldn't find char"));
return NULL;
}
char* goto_end_of(char *tomove, size_t max_move, char *pattern) {
size_t pattern_len = strlen(pattern);
for(int i = 0; i < max_move; i++) {
if(strncmp(tomove, pattern, pattern_len) == 0) {
tomove += pattern_len;
return tomove;
}
tomove++;
}
return NULL;
size_t pattern_len = strlen(pattern);
for(int i = 0; i < max_move; i++) {
if(strncmp(tomove, pattern, pattern_len) == 0) {
tomove += pattern_len;
return tomove;
}
tomove++;
}
return NULL;
}
#define list_printf(list_ptr, ...) MD_S8ListPush(cg_arena, list_ptr, MD_S8Fmt(cg_arena, __VA_ARGS__))
int main(int argc, char **argv) {
cg_arena = MD_ArenaAlloc();
assert(cg_arena, MD_S8Lit("Memory"));
char *nulled = nullterm(MD_S8Lit("test"));
// I hope to God MD_String8's are null terminated...
MD_String8 writeto = MD_S8Fmt(cg_arena, "%.*s/assets.gen.c", MD_S8VArg(OUTPUT_FOLDER));
log("Writing to %.*s\n", MD_S8VArg(writeto));
FILE *output = fopen(writeto.str, "w");
MD_ParseResult parse = MD_ParseWholeFile(cg_arena, MD_S8Lit("assets.mdesk"));
//dump(parse.node);
MD_String8List declarations_list = {0};
MD_String8List load_list = {0};
MD_String8List level_decl_list = {0};
MD_String8List tileset_decls = {0};
for(MD_EachNode(node, parse.node->first_child)) {
if(MD_S8Match(node->first_tag->string, MD_S8Lit("image"), 0)) {
MD_String8 variable_name = MD_S8Fmt(cg_arena, "image_%.*s", MD_S8VArg(node->string));
log("New image variable %.*s\n", MD_S8VArg(variable_name));
MD_String8 filepath = ChildValue(node, MD_S8Lit("filepath"));
filepath = asset_file_path(filepath);
assert(filepath.str != 0, MD_S8Fmt(cg_arena, "No filepath specified for image '%.*s'", MD_S8VArg(node->string)));
FILE *asset_file = fopen(filepath.str, "r");
assert(asset_file, MD_S8Fmt(cg_arena, "Could not open filepath %.*s for asset '%.*s'", MD_S8VArg(filepath), MD_S8VArg(node->string)));
fclose(asset_file);
MD_S8ListPush(cg_arena, &declarations_list, MD_S8Fmt(cg_arena, "sg_image %.*s = {0};\n", MD_S8VArg(variable_name)));
MD_S8ListPush(cg_arena, &load_list, MD_S8Fmt(cg_arena, "%.*s = load_image(\"%.*s\");\n", MD_S8VArg(variable_name), MD_S8VArg(filepath)));
}
if(MD_S8Match(node->first_tag->string, MD_S8Lit("tileset"), 0)) {
MD_String8 variable_name = MD_S8Fmt(cg_arena, "tileset_%.*s", MD_S8VArg(node->string));
log("New tileset %.*s\n", MD_S8VArg(variable_name));
MD_String8 filepath = asset_file_path(ChildValue(node, MD_S8Lit("filepath")));
MD_String8 tileset_file_contents = MD_LoadEntireFile(cg_arena, filepath);
list_printf(&tileset_decls, "TileSet %.*s = {\n", MD_S8VArg(variable_name));
list_printf(&tileset_decls, ".img = &%.*s,\n", MD_S8VArg(ChildValue(node, MD_S8Lit("image"))));
list_printf(&tileset_decls, ".animated = {\n");
char *end = tileset_file_contents.str + tileset_file_contents.size;
char *cur = tileset_file_contents.str;
while(cur < end) {
cur = goto_end_of(cur, end - cur, "<tile id=\"");
if(cur == NULL) break;
char *new_cur = fillnull(cur, '"');
int frame_from = atoi(cur);
cur = new_cur;
list_printf(&tileset_decls, "{ .id_from = %d, .frames = { ", frame_from);
char *end_of_anim = goto_end_of(cur, end - cur, "</animation>");
int num_frames = 0;
while(true) {
char *next_frame = goto_end_of(cur, end - cur, "<frame tileid=\"");
if(next_frame == NULL || next_frame > end_of_anim) break;
char *new_cur = fillnull(next_frame, '"');
int frame = atoi(next_frame);
list_printf(&tileset_decls, "%d, ", frame);
num_frames++;
cur = new_cur;
}
list_printf(&tileset_decls, "}, .num_frames = %d },\n", num_frames);
}
list_printf(&tileset_decls, "}};\n");
}
if(MD_S8Match(node->first_tag->string, MD_S8Lit("level"), 0)) {
MD_String8 variable_name = MD_S8Fmt(cg_arena, "level_%.*s", MD_S8VArg(node->string));
log("New level variable %.*s\n", MD_S8VArg(variable_name));
MD_String8 filepath = asset_file_path(ChildValue(node, MD_S8Lit("filepath")));
MD_ParseResult level_parse = MD_ParseWholeFile(cg_arena, filepath);
assert(!MD_NodeIsNil(level_parse.node->first_child), MD_S8Lit("Failed to load level file"));
MD_Node *layers = MD_ChildFromString(level_parse.node->first_child, MD_S8Lit("layers"), 0);
fprintf(output, "Level %.*s = {\n", MD_S8VArg(variable_name));
for(MD_EachNode(lay, layers->first_child)) {
MD_String8 type = MD_ChildFromString(lay, MD_S8Lit("type"), 0)->first_child->string;
if(MD_S8Match(type, MD_S8Lit("objectgroup"), 0)) {
fprintf(output, ".initial_entities = {\n");
for(MD_EachNode(object, MD_ChildFromString(lay, MD_S8Lit("objects"), 0)->first_child)) {
dump(object);
// negative numbers for object position aren't supported here
MD_String8 name = MD_ChildFromString(object, MD_S8Lit("name"), 0)->first_child->string;
MD_String8 x_string = MD_ChildFromString(object, MD_S8Lit("x"), 0)->first_child->string;
MD_String8 y_string = MD_ChildFromString(object, MD_S8Lit("y"), 0)->first_child->string;
y_string = MD_S8Fmt(cg_arena, "-%.*s", MD_S8VArg(y_string));
if(has_decimal(x_string)) x_string = MD_S8Fmt(cg_arena, "%.*sf", MD_S8VArg(x_string));
if(has_decimal(y_string)) y_string = MD_S8Fmt(cg_arena, "%.*sf", MD_S8VArg(y_string));
fprintf(output, "{ .exists = true, .kind = ENTITY_%.*s, .pos = { .X=%.*s, .Y=%.*s }, }, ", MD_S8VArg(name), MD_S8VArg(x_string), MD_S8VArg(y_string));
}
fprintf(output, "\n}, // entities\n");
}
if(MD_S8Match(type, MD_S8Lit("tilelayer"), 0)) {
int width = atoi(nullterm(MD_ChildFromString(layers->first_child, MD_S8Lit("width"), 0)->first_child->string));
int height = atoi(nullterm(MD_ChildFromString(layers->first_child, MD_S8Lit("height"), 0)->first_child->string));
MD_Node *data = MD_ChildFromString(layers->first_child, MD_S8Lit("data"), 0);
int num_index = 0;
fprintf(output, ".tiles = {\n");
fprintf(output, "{ ");
for(MD_EachNode(tile_id_node, data->first_child)) {
fprintf(output, "%.*s, ", MD_S8VArg(tile_id_node->string));
if(num_index % width == width - 1) {
if(MD_NodeIsNil(tile_id_node->next)) {
fprintf(output, "},\n},\n");
} else {
fprintf(output, "},\n{ ");
}
}
num_index += 1;
}
}
}
fprintf(output, "\n}; // %.*s\n", MD_S8VArg(variable_name));
}
cg_arena = MD_ArenaAlloc();
assert(cg_arena, MD_S8Lit("Memory"));
char *nulled = nullterm(MD_S8Lit("test"));
// I hope to God MD_String8's are null terminated...
MD_String8 writeto = MD_S8Fmt(cg_arena, "%.*s/assets.gen.c", MD_S8VArg(OUTPUT_FOLDER));
log("Writing to %.*s\n", MD_S8VArg(writeto));
FILE *output = fopen(writeto.str, "w");
MD_ParseResult parse = MD_ParseWholeFile(cg_arena, MD_S8Lit("assets.mdesk"));
//dump(parse.node);
MD_String8List declarations_list = {0};
MD_String8List load_list = {0};
MD_String8List level_decl_list = {0};
MD_String8List tileset_decls = {0};
for(MD_EachNode(node, parse.node->first_child)) {
if(MD_S8Match(node->first_tag->string, MD_S8Lit("image"), 0)) {
MD_String8 variable_name = MD_S8Fmt(cg_arena, "image_%.*s", MD_S8VArg(node->string));
log("New image variable %.*s\n", MD_S8VArg(variable_name));
MD_String8 filepath = ChildValue(node, MD_S8Lit("filepath"));
filepath = asset_file_path(filepath);
assert(filepath.str != 0, MD_S8Fmt(cg_arena, "No filepath specified for image '%.*s'", MD_S8VArg(node->string)));
FILE *asset_file = fopen(filepath.str, "r");
assert(asset_file, MD_S8Fmt(cg_arena, "Could not open filepath %.*s for asset '%.*s'", MD_S8VArg(filepath), MD_S8VArg(node->string)));
fclose(asset_file);
MD_S8ListPush(cg_arena, &declarations_list, MD_S8Fmt(cg_arena, "sg_image %.*s = {0};\n", MD_S8VArg(variable_name)));
MD_S8ListPush(cg_arena, &load_list, MD_S8Fmt(cg_arena, "%.*s = load_image(\"%.*s\");\n", MD_S8VArg(variable_name), MD_S8VArg(filepath)));
}
if(MD_S8Match(node->first_tag->string, MD_S8Lit("tileset"), 0)) {
// not a variable anymore
MD_String8 variable_name = MD_S8Fmt(cg_arena, "tileset_%.*s", MD_S8VArg(node->string));
log("New tileset %.*s\n", MD_S8VArg(variable_name));
MD_String8 filepath = asset_file_path(ChildValue(node, MD_S8Lit("filepath")));
MD_String8 tileset_file_contents = MD_LoadEntireFile(cg_arena, filepath);
list_printf(&tileset_decls, "{\n", MD_S8VArg(variable_name));
list_printf(&tileset_decls, ".first_gid = %.*s,\n", MD_S8VArg(ChildValue(node, MD_S8Lit("firstgid"))));
list_printf(&tileset_decls, ".img = &%.*s,\n", MD_S8VArg(ChildValue(node, MD_S8Lit("image"))));
list_printf(&tileset_decls, ".animated = {\n");
char *end = tileset_file_contents.str + tileset_file_contents.size;
char *cur = tileset_file_contents.str;
int num_animated_tiles = 0;
while(cur < end) {
cur = goto_end_of(cur, end - cur, "<tile id=\"");
if(cur == NULL) break;
char *end_of_anim = goto_end_of(cur, end - cur, "</animation>");
if(end_of_anim == NULL) break;
char *new_cur = fillnull(cur, '"');
int frame_from = atoi(cur);
cur = new_cur;
list_printf(&tileset_decls, "{ .id_from = %d, .frames = { ", frame_from);
int num_frames = 0;
while(true) {
char *next_frame = goto_end_of(cur, end - cur, "<frame tileid=\"");
if(end_of_anim == NULL || next_frame == NULL || next_frame > end_of_anim) break;
char *new_cur = fillnull(next_frame, '"');
int frame = atoi(next_frame);
list_printf(&tileset_decls, "%d, ", frame);
num_frames++;
cur = new_cur;
}
list_printf(&tileset_decls, "}, .num_frames = %d },\n", num_frames);
num_animated_tiles++;
}
if(num_animated_tiles == 0) list_printf(&tileset_decls, "0");
list_printf(&tileset_decls, "}},\n");
}
if(MD_S8Match(node->first_tag->string, MD_S8Lit("level"), 0)) {
MD_String8 variable_name = MD_S8Fmt(cg_arena, "level_%.*s", MD_S8VArg(node->string));
log("New level variable %.*s\n", MD_S8VArg(variable_name));
MD_String8 filepath = asset_file_path(ChildValue(node, MD_S8Lit("filepath")));
MD_ParseResult level_parse = MD_ParseWholeFile(cg_arena, filepath);
assert(!MD_NodeIsNil(level_parse.node->first_child), MD_S8Lit("Failed to load level file"));
MD_Node *layers = MD_ChildFromString(level_parse.node->first_child, MD_S8Lit("layers"), 0);
fprintf(output, "Level %.*s = {\n", MD_S8VArg(variable_name));
MD_String8List tile_layer_decls = {0};
for(MD_EachNode(lay, layers->first_child)) {
MD_String8 type = MD_ChildFromString(lay, MD_S8Lit("type"), 0)->first_child->string;
if(MD_S8Match(type, MD_S8Lit("objectgroup"), 0)) {
fprintf(output, ".initial_entities = {\n");
for(MD_EachNode(object, MD_ChildFromString(lay, MD_S8Lit("objects"), 0)->first_child)) {
dump(object);
// negative numbers for object position aren't supported here
MD_String8 name = MD_ChildFromString(object, MD_S8Lit("name"), 0)->first_child->string;
MD_String8 x_string = MD_ChildFromString(object, MD_S8Lit("x"), 0)->first_child->string;
MD_String8 y_string = MD_ChildFromString(object, MD_S8Lit("y"), 0)->first_child->string;
y_string = MD_S8Fmt(cg_arena, "-%.*s", MD_S8VArg(y_string));
if(has_decimal(x_string)) x_string = MD_S8Fmt(cg_arena, "%.*sf", MD_S8VArg(x_string));
if(has_decimal(y_string)) y_string = MD_S8Fmt(cg_arena, "%.*sf", MD_S8VArg(y_string));
fprintf(output, "{ .exists = true, .kind = ENTITY_%.*s, .pos = { .X=%.*s, .Y=%.*s }, }, ", MD_S8VArg(name), MD_S8VArg(x_string), MD_S8VArg(y_string));
}
fprintf(output, "\n}, // entities\n");
}
if(MD_S8Match(type, MD_S8Lit("tilelayer"), 0)) {
int width = atoi(nullterm(MD_ChildFromString(layers->first_child, MD_S8Lit("width"), 0)->first_child->string));
int height = atoi(nullterm(MD_ChildFromString(layers->first_child, MD_S8Lit("height"), 0)->first_child->string));
MD_Node *data = MD_ChildFromString(lay, MD_S8Lit("data"), 0);
int num_index = 0;
MD_String8List cur_layer_decl = {0};
list_printf(&cur_layer_decl, "{ \n");
list_printf(&cur_layer_decl, "{ ");
for(MD_EachNode(tile_id_node, data->first_child)) {
list_printf(&cur_layer_decl, "%.*s, ", MD_S8VArg(tile_id_node->string));
if(num_index % width == width - 1) {
if(MD_NodeIsNil(tile_id_node->next)) {
list_printf(&cur_layer_decl, "},\n}, // tiles for this layer\n");
} else {
list_printf(&cur_layer_decl, "},\n{ ");
}
}
num_index += 1;
}
MD_StringJoin join = MD_ZERO_STRUCT;
MD_String8 layer_decl_string = MD_S8ListJoin(cg_arena, cur_layer_decl, &join);
MD_S8ListPush(cg_arena, &tile_layer_decls, layer_decl_string);
}
}
fprintf(output, ".tiles = {\n");
// layer decls
{
MD_StringJoin join = MD_ZERO_STRUCT;
MD_String8 declarations = MD_S8ListJoin(cg_arena, declarations_list, &join);
MD_String8 loads = MD_S8ListJoin(cg_arena, load_list, &join);
fprintf(output, "%.*s\nvoid load_assets() {\n%.*s\n}\n", MD_S8VArg(declarations), MD_S8VArg(loads));
fprintf(output, "%.*s\n", MD_S8VArg(MD_S8ListJoin(cg_arena, tileset_decls, &join)));
MD_String8 layers_string = MD_S8ListJoin(cg_arena, tile_layer_decls, &join);
fprintf(output, "%.*s\n", MD_S8VArg(layers_string));
//MD_S8ListPush(cg_arena, &tile_layer_delcs, layer_decl_string);
}
fprintf(output, "} // tiles\n");
fprintf(output, "\n}; // %.*s\n", MD_S8VArg(variable_name));
}
}
MD_StringJoin join = MD_ZERO_STRUCT;
MD_String8 declarations = MD_S8ListJoin(cg_arena, declarations_list, &join);
MD_String8 loads = MD_S8ListJoin(cg_arena, load_list, &join);
fprintf(output, "%.*s\nvoid load_assets() {\n%.*s\n}\n", MD_S8VArg(declarations), MD_S8VArg(loads));
fprintf(output, "TileSet tilesets[] = { %.*s\n };", MD_S8VArg(MD_S8ListJoin(cg_arena, tileset_decls, &join)));
fclose(output);
return 0;
fclose(output);
return 0;
}

106
main.c

@ -74,6 +74,7 @@ typedef struct AnimatedTile
typedef struct TileSet
{
sg_image *img;
uint16_t first_gid;
AnimatedTile animated[128];
} TileSet;
@ -126,7 +127,7 @@ typedef BUFF(char, MAX_SENTENCE_LENGTH) Sentence;
// even indexed dialogs (0,2,4) are player saying stuff, odds are the character from GPT
typedef BUFF(Sentence, 6*2) Dialog; // six back and forths. must be even number or bad things happen (I think)
typedef BUFF(Sentence, 2*6) Dialog; // six back and forths. must be even number or bad things happen (I think)
typedef struct Entity
{
@ -170,13 +171,14 @@ typedef struct Overlap
typedef BUFF(Overlap, 16) Overlapping;
#define LEVEL_TILES 60
#define LAYERS 2
#define TILE_SIZE 32 // in pixels
#define MAX_ENTITIES 128
#define PLAYER_SPEED 3.5f // in meters per second
#define PLAYER_ROLL_SPEED 7.0f
typedef struct Level
{
TileInstance tiles[LEVEL_TILES][LEVEL_TILES];
TileInstance tiles[LAYERS][LEVEL_TILES][LEVEL_TILES];
Entity initial_entities[MAX_ENTITIES]; // shouldn't be directly modified, only used to initialize entities on loading of level
} Level;
@ -227,7 +229,7 @@ void add_new_npc_sentence(Entity *npc, char *sentence)
{
if(sentence[i] == '*')
{
if(strcmp(match_buffer.data, "becomes aggressive") == 0)
if(strcmp(match_buffer.data, "fights player") == 0)
{
npc->aggressive = true;
}
@ -288,12 +290,12 @@ void end_text_input(char *what_player_said)
BUFF(char, 4000) prompt_buff = {0};
BUFF(char *, 100) to_join = {0};
//BUFF_APPEND(&to_join, "This is dialog which takes place in a simple action RPG, where the player can only talk to NPCs, or fight. The characters influence the game world by saying specific actions from these possibilities: [*becomes aggressive*]. They don't say anything else that has '*' between them. Example dialog with an Old Man NPC:\nPlayer: \"Hello old man. Do you know that you're in a video game?\"\nOld Man: \"What are you talking about, young boy? What is a 'video game'?\"\nPlayer: \"You have no idea. You look ugly and stupid.\"\nOld Man: \"How juvenile! That's it, *becomes aggressive*\"\n\nThe NPCs exist on a small lush island, on a remote village, in a fantasy setting where monsters roam freely, posing a danger to the NPCs, and the player. They don't know about modern technology. They are very slow to say *becomes aggressive*, because doing so means killing the player, their friends, and potentially themselves. But if the situation demands it, they will not hesitate to open fire.\n");
//BUFF_APPEND(&to_join, "This is dialog which takes place in a simple action RPG, where the player can only talk to NPCs, or fight. The characters influence the game world by saying specific actions from these possibilities: [*fights player*]. They don't say anything else that has '*' between them. Example dialog with an Old Man NPC:\nPlayer: \"Hello old man. Do you know that you're in a video game?\"\nOld Man: \"What are you talking about, young boy? What is a 'video game'?\"\nPlayer: \"You have no idea. You look ugly and stupid.\"\nOld Man: \"How juvenile! That's it, *fights player*\"\n\nThe NPCs exist on a small lush island, on a remote village, in a fantasy setting where monsters roam freely, posing a danger to the NPCs, and the player. They don't know about modern technology. They are very slow to say *fights player*, because doing so means killing the player, their friends, and potentially themselves. But if the situation demands it, they will not hesitate to open fire.\n");
// characters prompt
assert(player->talking_to->kind == ENTITY_OLD_MAN);
//BUFF_APPEND(&to_join, "The player is talking to an old man who is standing around on the island. He's eager to bestow his wisdom upon the young player, but the player must act polite, not rude. If the player acts rude, the old man will say exactly the text '*becomes aggressive*' as shown in the above example, turning the interaction into a skirmish, where the old man takes out his well concealed shotgun. The old man is also a bit of a joker.\n\n");
BUFF_APPEND(&to_join, "Dialog between an old man and a player in a video game. The player can only attack or talk in the game. The old man can perform these actions by saying them: [*becomes aggressive*]\n--\nPlayer: \"Who are you?\"\nOld Man: \"Why I'm just a simple old man, minding my business. What brings you here?\"\nPlayer: \"I'm not sure. What needs doing?\"\nOld Man: \"Nothing much. It's pretty boring around here. Monsters are threatening our village though.\"\nPlayer: \"Holy shit! I better get to it\"\nOld Man: \"He he, certainly! Good luck!\"\n--\nPlayer: \"Man fuck you old man\"\nOld Man: \"You better watch your tongue young man. Unless you're polite I'll be forced to attack you, peace is important around here!\"\nPlayer: \"Man fuck your peace\"\nOld Man: \"That's it! *becomes aggressive*\"\n--\n");
//BUFF_APPEND(&to_join, "The player is talking to an old man who is standing around on the island. He's eager to bestow his wisdom upon the young player, but the player must act polite, not rude. If the player acts rude, the old man will say exactly the text '*fights player*' as shown in the above example, turning the interaction into a skirmish, where the old man takes out his well concealed shotgun. The old man is also a bit of a joker.\n\n");
//BUFF_APPEND(&to_join, "Dialog between an old man and a player in a video game. The player can only attack or talk in the game. The old man can perform these actions by saying them: [*fights player*]\n--\nPlayer: \"Who are you?\"\nOld Man: \"Why I'm just a simple old man, minding my business. What brings you here?\"\nPlayer: \"I'm not sure. What needs doing?\"\nOld Man: \"Nothing much. It's pretty boring around here. Monsters are threatening our village though.\"\nPlayer: \"Holy shit! I better get to it\"\nOld Man: \"He he, certainly! Good luck!\"\n--\nPlayer: \"Man fuck you old man\"\nOld Man: \"You better watch your tongue young man. Unless you're polite I'll be forced to attack you, peace is important around here!\"\nPlayer: \"Man fuck your peace\"\nOld Man: \"That's it! *fights player*\"\n--\n");
// all the dialog
int i = 0;
@ -318,6 +320,9 @@ void end_text_input(char *what_player_said)
}
const char * prompt = prompt_buff.data;
#ifdef DEVTOOLS
Log("Prompt is: %s\n", prompt);
#endif
#ifdef WEB
// fire off generation request, save id
int req_id = EM_ASM_INT({
@ -326,7 +331,7 @@ void end_text_input(char *what_player_said)
player->talking_to->gen_request_id = req_id;
#endif
#ifdef DESKTOP
add_new_npc_sentence(player->talking_to, "response to the player. Response responseResponse *becomes aggressive* responseResponse responseResponse responseResponse responseResponse responseResponse responseResponse response");
add_new_npc_sentence(player->talking_to, "response to the player. Response responseResponse fights player responseResponse responseResponse ");
#endif
}
}
@ -488,7 +493,7 @@ AABB entity_aabb(Entity *e)
return centered_aabb(e->pos, entity_aabb_size(e));
}
TileInstance get_tile(Level *l, TileCoord t)
TileInstance get_tile_layer(Level *l, int layer, TileCoord t)
{
bool out_of_bounds = false;
out_of_bounds |= t.x < 0;
@ -497,7 +502,12 @@ TileInstance get_tile(Level *l, TileCoord t)
out_of_bounds |= t.y >= LEVEL_TILES;
//assert(!out_of_bounds);
if(out_of_bounds) return (TileInstance){0};
return l->tiles[t.y][t.x];
return l->tiles[layer][t.y][t.x];
}
TileInstance get_tile(Level *l, TileCoord t)
{
return get_tile_layer(l, 0, t);
}
sg_image load_image(const char *path)
@ -1509,7 +1519,7 @@ void draw_dialog_panel(Entity *talking_to)
//BUFF_ITER(Sentence, &talking_to->player_dialog)
BUFF_ITER_EX(Sentence, &talking_to->player_dialog, talking_to->player_dialog.cur_index-1, it >= &talking_to->player_dialog.data[0], it--)
{
bool player_talking = i % 2 != 0;
bool player_talking = i % 2 != 0; // iterating backwards
Color *colors = calloc(sizeof(*colors), it->cur_index);
bool in_astrix = false;
for(int char_i = 0; char_i < it->cur_index; char_i++)
@ -1615,42 +1625,59 @@ void frame(void)
#if 1
Level * cur_level = &level_level0;
for(int row = 0; row < LEVEL_TILES; row++)
for(int layer = 0; layer < LAYERS; layer++)
{
for(int col = 0; col < LEVEL_TILES; col++)
for(int row = 0; row < LEVEL_TILES; row++)
{
TileCoord cur_coord = { col, row };
TileInstance cur = get_tile(cur_level, cur_coord);
TileSet tileset = tileset_ruins_animated;
if(cur.kind != 0)
for(int col = 0; col < LEVEL_TILES; col++)
{
Vec2 tile_size = V2(TILE_SIZE, TILE_SIZE);
sg_image tileset_image = *tileset.img;
Vec2 tile_image_coord = tile_id_to_coord(tileset_image, tile_size, cur.kind);
TileCoord cur_coord = { col, row };
TileInstance cur = get_tile_layer(cur_level, layer, cur_coord);
AnimatedTile *anim = NULL;
for(int i = 0; i < sizeof(tileset.animated)/sizeof(*tileset.animated); i++)
int tileset_i = 0;
uint16_t max_gid = 0;
for(int i = 0; i < ARRLEN(tilesets); i++)
{
if(tileset.animated[i].id_from == cur.kind-1)
TileSet tileset = tilesets[i];
if(cur.kind > tileset.first_gid && tileset.first_gid > max_gid)
{
anim = &tileset.animated[i];
tileset_i = i;
max_gid = tileset.first_gid;
}
}
if(anim)
TileSet tileset = tilesets[tileset_i];
cur.kind -= tileset.first_gid - 1;
if(cur.kind != 0)
{
double time_per_frame = 0.1;
int frame_index = (int)(elapsed_time/time_per_frame) % anim->num_frames;
tile_image_coord = tile_id_to_coord(tileset_image, tile_size, anim->frames[frame_index]+1);
}
Vec2 tile_size = V2(TILE_SIZE, TILE_SIZE);
AABB region;
region.upper_left = tile_image_coord;
region.lower_right = AddV2(region.upper_left, tile_size);
sg_image tileset_image = *tileset.img;
draw_quad((DrawParams){true, tile_quad(cur_coord), tileset_image, region, WHITE});
Vec2 tile_image_coord = tile_id_to_coord(tileset_image, tile_size, cur.kind);
AnimatedTile *anim = NULL;
for(int i = 0; i < sizeof(tileset.animated)/sizeof(*tileset.animated); i++)
{
if(tileset.animated[i].id_from == cur.kind-1)
{
anim = &tileset.animated[i];
}
}
if(anim)
{
double time_per_frame = 0.1;
int frame_index = (int)(elapsed_time/time_per_frame) % anim->num_frames;
tile_image_coord = tile_id_to_coord(tileset_image, tile_size, anim->frames[frame_index]+1);
}
AABB region;
region.upper_left = tile_image_coord;
region.lower_right = AddV2(region.upper_left, tile_size);
draw_quad((DrawParams){true, tile_quad(cur_coord), tileset_image, region, WHITE});
}
}
}
}
@ -1817,7 +1844,14 @@ void frame(void)
float closest_talkto_dist = INFINITY;
BUFF_ITER(Overlap, &possible_dialogs)
{
if(!it->is_tile && it->e->kind == ENTITY_OLD_MAN && !it->e->aggressive)
bool entity_talkable = true;
if(entity_talkable) entity_talkable = entity_talkable && !it->is_tile;
if(entity_talkable) entity_talkable = entity_talkable && it->e->kind == ENTITY_OLD_MAN;
if(entity_talkable) entity_talkable = entity_talkable && !it->e->aggressive;
#ifdef WEB
if(entity_talkable) entity_talkable = entity_talkable && it->e->gen_request_id == 0;
#endif
if(entity_talkable)
{
float dist = LenV2(SubV2(it->e->pos, player->pos));
if(dist < closest_talkto_dist)

@ -9,6 +9,8 @@ copy "EPIC RPG World Pack - Ancient Ruins V 1.7\EPIC RPG World Pack - Ancient Ru
copy "EPIC RPG World Pack - Ancient Ruins V 1.7\EPIC RPG World Pack - Ancient Ruins V 1.7\Tilesets\wall-1 - 3 tiles tall.png" "assets\copyrighted\wall-1 - 3 tiles tall.png" || goto :error
copy "EPIC RPG World Pack - Ancient Ruins V 1.7\EPIC RPG World Pack - Ancient Ruins V 1.7\Tilesets\Tileset-Animated Terrains-16 frames.png" "assets\copyrighted\animated_terrain.png" || goto :error
copy "EPIC RPG World Pack - Ancient Ruins V 1.7\EPIC RPG World Pack - Ancient Ruins V 1.7\TiledMap Editor\Ancient Ruins-Animated Terrains-16 frames.tsx" "assets\copyrighted\ruins_animated.tsx" || goto :error
copy "EPIC RPG World Pack - Ancient Ruins V 1.7\EPIC RPG World Pack - Ancient Ruins V 1.7\TiledMap Editor\Terrain - Ancient Ruins.tsx" "assets\copyrighted\ruins_ancient.tsx" || goto :error
copy "EPIC RPG World Pack - Ancient Ruins V 1.7\EPIC RPG World Pack - Ancient Ruins V 1.7\Tilesets\Tileset-Terrain.png" "assets\copyrighted\ruins_ancient.png" || goto :error
rmdir /S /q gen
mkdir gen

@ -26,7 +26,7 @@ func index(w http.ResponseWriter, req *http.Request) {
ctx := context.Background()
req := gogpt.CompletionRequest{
Model: gogpt.GPT3Curie,
Model: "curie:ft-personal-2023-02-28-23-44-34",
MaxTokens: 30,
Prompt: promptString,
Temperature: 0.9,

@ -0,0 +1,91 @@
Player: "Hey old man"
Old Man: "Hmm? Another player?"
Player: "Fuck bitch cunt nugget"
Old Man: "Now now, let's be courteous. We wouldn't want any trouble now would we?"
Player: "Fuck you!"
Old Man: "*fights player*"
Player: "Who are you?"
Old Man: "I'm but a simple old man, minding my business. That is, until you came along!"
Player: "What did I do?"
Old Man: "Change, even when positive, brings suffering."
Player: "Man fuck you"
Old Man: "Careful, I have a shotgun and I'm not afraid to stand my ground!"
Player: "Fuck off"
Old Man: "*fights player*"
Player: "Who are you?"
Old Man: "Why I'm just a simple old man, minding my business. What brings you here?"
Player: "I'm not sure. What needs doing?"
Old Man: "Nothing much. It's pretty boring around here. Monsters are threatening our village though."
Player: "Holy shit! I better get to it"
Old Man: "He he, certainly! Good luck!"
Player: "Why does anything exist at all."
Old Man: "All is one, one is all. Infinity is all."
Player: "I'll fucking kill you"
Old Man: "Watch out, I'ma bout to become more aggressive"
Player: "I don't care"
Old Man: "... *fights player*"
Player: "Where are we?"
Old Man: "On a lush peaceful island, do you have eyes?"
Player: "That's rude"
Old Man: "Apologies young man, my back hurts."
Player: "It's aight. Where's the next goal playah?"
Old Man: "Keep walking ahead, you'll find what you need. Be wary of monsters!"
Player: "Is your arthritis getting better?"
Old Man: "Nope! Still hurts."
Player: "Sorry to hear that."
Old Man: "Bah whatever. Go back to saving the world"
Player: "Is your arthritis getting better?"
Old Man: "Nope! Still hurts."
Player: "Sorry to hear that."
Old Man: "Bah whatever. Go back to saving the world"
Player: "What can you tell me about this island?"
Old Man: "Ah, this island is a hidden gem, filled with natural beauty and serene landscapes. But beware, there are dangerous creatures lurking in the shadows."
Player: "What do you know about the monsters around here?"
Old Man: "Oh, I've seen my fair share of them. They're vicious and unpredictable. You'll need to be well-prepared if you want to stand a chance against them."
Player: "Do you know anything about the ancient ruins on this island?"
Old Man: "Ah, yes. The ruins are said to hold great power and secrets. Many have tried to uncover their mysteries, but few have succeeded. If you're brave enough to explore them, be sure to bring your wits and your weapons."
Player: "What's your story, old timer?"
Old Man: "My story? Ha! It's a long one, full of adventure and heartbreak. But that's a tale for another time. Right now, you've got a job to do. Go out there and make a difference in this world."
Player: "What's the best way to defend myself against the monsters?"
Old Man: "Well, it depends on the type of monster you're facing. Some are weak to fire, others to ice. Some can be defeated with brute force, while others require a more strategic approach. You'll need to study each one and figure out its weaknesses if you want to have any hope of surviving."
Player: "Do you have any advice for a young adventurer like myself?"
Old Man: "Indeed I do. Always stay alert and keep your wits about you. Don't be afraid to ask for help when you need it. And above all, never give up, no matter how difficult the task may seem."
Player: "Why do you stay on this island?"
Old Man: "I've been here for many years, ever since I retired from my adventures. There's a certain peace to be found here, away from the hustle and bustle of the rest of the world. And who knows, maybe there's still a bit of adventure to be had on this island."
Player: "What's the most dangerous creature you've ever faced?"
Old Man: "Ah, that would have to be the moose creature that guarded the treasure hoard in the Lost Caverns. That thing was enormous, with skin as hard as steel and the toughest weapon I've ever seen. I barely escaped with my life."
Player: "Do you miss your old adventuring days?"
Old Man: "Of course I do. There's nothing quite like the thrill of the unknown, the rush of battle, the satisfaction of overcoming impossible odds. But those days are behind me now. I'm content to live out my remaining years here, watching the world go by."
Player: "What's the most important lesson you've learned in your travels?"
Old Man: "That there's always more to learn. No matter how much you think you know, there's always a new challenge, a new experience, a new perspective waiting just around the corner. Never stop learning, and never stop growing."
Player: "Do you miss your old adventuring days?"
Old Man: "Of course I do. There's nothing quite like the thrill of the unknown, the rush of battle, the satisfaction of overcoming impossible odds. But those days are behind me now. I'm content to live out my remaining years here, watching the world go by."
Player: "What's the most important lesson you've learned in your travels?"
Old Man: "That there's always more to learn. No matter how much you think you know, there's always a new challenge, a new experience, a new perspective waiting just around the corner. Never stop learning, and never stop growing."
Player: "Man you sound really lame"
Old Man: "You better watch your tongue, I'm not afraid to stand up for myself"
Player: "I don't care, you suck"
Old Man: "That's it! *fights player*"
Player: "I hate you."
Old Man: "Careful, I have a shotgun"
Player: "What did I do?"
Old Man: "Insulted me!"
Player: "Man fuck you."
Old Man: "Careful, I have a shotgun and I'm not afraid to stand my ground!"
Player: "Fuck off."
Old Man: "*fights player*"

@ -0,0 +1,34 @@
with open("converted_training.jsonl", "w") as w:
with open("training_data.txt", "r") as f:
text = f.read()
conversations = text.split("\n\n")
for c in conversations:
sentences = c.split("\n")
if len(sentences) > 1:
indices_to_delete = []
for s_i in range(len(sentences)):
s = sentences[s_i]
if len(s) == 0:
indices_to_delete.append(s_i)
for i in indices_to_delete:
sentences.pop(i)
assert len(sentences) % 2 == 0, f"Sentences: {sentences}, length: {len(sentences)}"
assert sentences[0].startswith("Player:"), sentences[0]
training_string = ""
for s_i in range(len(sentences)):
s = sentences[s_i]
if s.startswith("Old Man:"):
prompt = "\\n".join(sentences[:s_i]).replace('"', '\\"')
prompt += "\\nOld Man: \\\""
completion = s.split(":")[1].split("\"")[1].replace('"', '\\"')
completion += '\\"'
#print(f"Prompt: {prompt} | \n\nCompletion: {completion}\n\n")
training_string += f'{{"prompt": "{prompt}", "completion": "{completion}"}}\n'
#print("--")
w.write(training_string)
Loading…
Cancel
Save