mmo-project/fortran/client
zongor abb74e63c5 small fix 2023-10-14 12:09:01 -04:00
..
app small fix 2023-10-14 12:09:01 -04:00
src small fix 2023-10-14 12:09:01 -04:00
README.md add readme's, remove testing prints 2023-10-13 22:55:14 -04:00
build.sh move into fpm package 2023-09-17 15:34:49 -04:00
fpm.toml add json module 2023-10-10 23:49:28 -04:00
install.sh small fix 2023-10-14 12:09:01 -04:00

README.md

fortran mmo-project client

The client uses the same mod_dill library from the tcp-client-server demo

Also the raylib library. I have generated a fortran interface for the functions neccisary for a minimal client. The module is using the new C interop interface implemented in the 2018 spec which makes it fairly easy to create a interface between a C library and Fortran.

One thing to note in here is that Fortran does not actually have unsigned values, so you have to use normal integers and use the -fno-range-check flag to tell the compiler that you know what you are doing. Otherwise the colors would not look correct.

For simplicity I have made it so that the login credentials are passed in through the command line instead of a GUI interface.

Fortran has the ability to use the OOP paradigm so I wanted to show that off here with the player module.

The player is able to store their own name, position, and color. There is an interface to allow the client to sync the camera and send the position to the server.

You can also see the json library shine with this implementation. It made it trivial to process the json array that was built and sent from the server.

The only other thing to note is the weird modulo chunk here:

      time = get_time()
      if (modulo(time, 1.0) .ge. 0.58_c_double) then
         if (player_updated) then
            players = me%move()
         else
            players = me%ping()
         end if
      end if

This is because there is not a good way to asyncronously send a call to the server, so I have this hack which uses the current tick time from raylib and run the update/ping function every 500 milliseconds or so.