wip: state server side; websocket

This commit is contained in:
Swrup 2022-12-11 18:58:56 +01:00
parent 549aa39e09
commit 91cff202f6
11 changed files with 169 additions and 44 deletions

27
src/map.ml Normal file
View file

@ -0,0 +1,27 @@
type dir =
| Left
| Right
| Down
| Up
type background =
| Grass
| Water
| Black
type t = background array array
let width = 1000
let height = 1000
let player_pos = ref (20, 3)
let player_dir = ref Down
let init () =
Array.init width (fun _x ->
Array.init height (fun _y ->
if Random.int 1000 <= 42 then Water else Grass ) )
let get_tile_kind ~x ~y map = try map.(x).(y) with Invalid_argument _ -> Black