blubber-server-0.0.1: The blubber server, serves blubber clients.

Copyright(c) plaimi 2015
LicenseAGPL-3
Maintainerblubber@plaimi.net
Safe HaskellNone
LanguageHaskell2010

Blubber.Server.ViewPort

Description

 

Synopsis

Documentation

data ViewPort Source

A ViewPort is the part of the World that a client is privy to.

Constructors

MkViewPort 

Fields

viewPos :: Vector

The absolute position of the ViewPort

viewWidth :: Double

The width of the ViewPort.

viewHeight :: Double

The height of the ViewPort.

visiblePlayers :: Map String Entity

The visible PlayerBlobs in the ViewPort.

visibleNeutrals :: [Entity]

The visible NeutralBlobs in the ViewPort.

Instances

Eq ViewPort 
Show ViewPort 
Generic ViewPort 
Serialize ViewPort

ViewPort uses a Serialize instance to encode its data.

type Rep ViewPort 

mkViewPort :: World -> String -> ViewPort Source

Make a ViewPort for the passed in client's Entity. If they don't have an Entity, then we'll just give them the entire World via worldViewPort. The ViewPort also includes the mass of the player's own Entity.

getVisiblePlayers :: Map String Entity -> Vector -> Double -> Map String Entity Source

Figure out which PlayerBlobs are visible to a client, based on their position and radius.

getVisibles :: Set Entity -> Vector -> Double -> Set Entity Source

Figure out which NeutralBlobs are visible to a client, based on their position and radius.

worldViewPort :: World -> ViewPort Source

Make a ViewPort of essentieally the whole World and all its Entitys.