Skip to content

Mattiemus/LaneWars

Repository files navigation

LaneWars

Lane Wars is a multiplayer MOBA written using Haskell, Yampa, and SDL. It was written as a undergraduate project for my studies at Nottingham university. While largely a proof of concept it is certainly playable in its current form, and makes for a fairly interesting look into what games developed in Haskell would look like.

Screenshot

#Installation LaneWars includes a cabal build script, to build the server and client run the following from a terminal:

$ cabal configure
$ cabal build

However the client will require the files within /Assets, so remember to copy these to the build path:

$ mkdir dist/build/Client/Assets
$ mkdir dist/build/Client/Assets/Sprites
$ cp Assets/Sprites/*.bmp dist/build/Client/Assets/Sprites

You can then run the server and client

$ ./dist/build/Server/Server
$ ./dist/build/Client/Client

#Connecting to an External Server By default the client will connect to localhost, however this can be changed by modifying Game/Client/Networking.hs searching for the clientNetworkLoop function, changing the following lines:

-- |The client network loop, connects then listens for messages
clientNetworkLoop :: Socket -- ^The client socket
                  -> MVar NetworkInput -- ^The message list MVar
                  -> IO ()   
clientNetworkLoop sock msgs = withSocketsDo $  do   
    address <- inet_addr "  >>>> NEW ADDRESS HERE <<<< "
    res <- try (connect sock (SockAddrInet 5050 address)) :: IO (Either SomeException ())
    case res of
        Left _ -> pushMVar msgs ConnectionFailed
        Right _ -> do
            pushMVar msgs ConnectionSuccess
            clientListenLoop sock msgs

The server will automatically accept requests from any inbound client connection.

#Documentation The source is fully documented, haddock documentation can be built using haddock:

$ cabal configure 
$ cabal haddock --internal

#Areas for Improvement Remember that this is purely a proof of concept, and in no way a complete product. While there are many things that could be improved, the most immediate problems to be solved are:

  • Replacing the programmer art
  • Replacing the TCP networking with UDP
  • Adding more gameplay elements such as jungle monsters
  • Improving the latency introduced by using lerp for object movement

About

A MOBA written using Haskell, Yampa, and SDL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published