diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..de3b340 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM barichello/godot-ci:3.3 + +RUN useradd -ms /bin/bash node + +WORKDIR /ghosted + +RUN mkdir -v -p ~/.local/share/godot/templates +RUN mkdir -v -p build/web ~/.local/share/godot/templates + + +ADD . . +# RUN chown -R node:node /ghosted +RUN godot -v --export "HTML5" ./build/web/index.html + +COPY scores.json /ghosted/build/web/scores.json +WORKDIR /ghosted/build/web + +CMD ["python", "-m", "SimpleHTTPServer", "7777"] + diff --git a/Dockerfile.fedora b/Dockerfile.fedora new file mode 100644 index 0000000..e8425bd --- /dev/null +++ b/Dockerfile.fedora @@ -0,0 +1,23 @@ +FROM fedora:33 + +WORKDIR /root + +RUN dnf -y upgrade --setopt=install_weak_deps=False && \ + dnf -y install --setopt=install_weak_deps=False \ + bash bzip2 curl git make nano patch pkgconfig python-unversioned-command python3-pip unzip which xz && \ + pip install scons==4.1.0 + +RUN dnf install -y scons pkgconfig libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel \ + libXi-devel mesa-libGL-devel mesa-libGLU-devel alsa-lib-devel pulseaudio-libs-devel \ + libudev-devel yasm gcc-c++ libstdc++-static xorg-x11-apps + + +WORKDIR /ghosted + +ADD . . + +# RUN scons -f /root/SConstruct -j8 platform=server tools=no target=release +RUN scons -f /root/Sconstruct platform=x11 tools=no target=release_debug bits=64 + +CMD ["/ghosted/ghosted.x86_64"] + diff --git a/Main.gd b/Main.gd index 466e80f..c8da8a2 100644 --- a/Main.gd +++ b/Main.gd @@ -51,20 +51,27 @@ func new_round(): func save_score(score): if $HUD/PlayerList/LocalPlayer.text != "": var file = File.new() +# var file = $HTTPRequest.request("localhost:7777/scores.json") if score > get_player_high_score($HUD/PlayerList/LocalPlayer.text): - file.open("scores.json", File.WRITE) + file.open("./scores.json", File.WRITE) highScores[$HUD/PlayerList/LocalPlayer.text] = score file.store_string(JSON.print(highScores)) file.close() func load_scores(): - var file = File.new() - if file.file_exists("scores.json"): - file.open("scores.json", File.READ) - var json_records = JSON.parse(file.get_as_text()) - file.close() + var file + var request = $HTTPRequest.request("localhost:7777/scores.json") + if request == OK: + var json_records = JSON.parse(request.get_as_text()) return json_records.result + else: + file = File.new() + if file.file_exists("./scores.json"): + file.open("./scores.json", File.READ) + var json_records = JSON.parse(file.get_as_text()) + file.close() + return json_records.result func get_player_high_score(name): diff --git a/Main.tscn b/Main.tscn index 5f8c2c5..c441813 100644 --- a/Main.tscn +++ b/Main.tscn @@ -138,6 +138,8 @@ position = Vector2( 4363.53, 1302.94 ) [node name="HellSpawn3" parent="." instance=ExtResource( 8 )] position = Vector2( 1030.77, 1210.74 ) +[node name="HTTPRequest" type="HTTPRequest" parent="."] + [connection signal="bonus_points" from="Player" to="." method="_on_Player_bonus_points"] [connection signal="hit" from="Player" to="." method="game_over"] [connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"] diff --git a/deploy/deployment.yaml b/deploy/deployment.yaml new file mode 100644 index 0000000..88d45e6 --- /dev/null +++ b/deploy/deployment.yaml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ghosted +spec: + replicas: 1 + selector: + matchLabels: + app: ghosted + template: + metadata: + labels: + app: ghosted + spec: + containers: + - name: ghosted + image: quay.io/bholifie/ghosted:latest + ports: + - containerPort: 7777 + resources: + requests: + memory: "500Mi" + cpu: "500m" + limits: + memory: "2Gi" + cpu: "2" + +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: ghosted + name: ghosted-service +spec: + ports: + - name: 7777-tcp + port: 7777 + protocol: TCP + targetPort: 7777 + selector: + app: ghosted + sessionAffinity: None + type: ClusterIP diff --git a/export_presets.cfg b/export_presets.cfg index c4159dc..8955529 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -7,7 +7,8 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="exported/creep/index.html" +export_path="build/web/index.html" +patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" @@ -27,12 +28,12 @@ html/experimental_virtual_keyboard=false name="Linux/X11" platform="Linux/X11" -runnable=true +runnable=false custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="" +export_path="./ghosted.x86_64" script_export_mode=1 script_encryption_key="" @@ -41,7 +42,7 @@ script_encryption_key="" custom_template/debug="" custom_template/release="" binary_format/64_bits=true -binary_format/embed_pck=false +binary_format/embed_pck=true texture_format/bptc=false texture_format/s3tc=true texture_format/etc=false