public void render(Map map) {

        if (updateSenses) {
            long startTime = System.currentTimeMillis();
            playerSenses = map.getPlayerSenses();
            long endTime = System.currentTimeMillis();
            Log.print("Shadowcasting time: " + (endTime - startTime));
            updateSenses = false;
        }
//        HashMap<Integer, Tile> tileHashMap = map.getTileMap();
//        ArrayList<Actor> actors = map.getActors();
//        HashMap<Integer, Actor> actorHashMap = map.getActorHash();
        HashMap<Integer, Tile> tileHashMap = playerSenses.getTiles();
        HashMap<Integer, Actor> actorHashMap = playerSenses.getActors();
        HashMap<Integer, ArrayList<Entity>> entities = playerSenses.getEntities();


        Point top_left = new Point(playerpos.getX() - tilesx, playerpos.getY() - tilesy);

        //image.draw((float) ((x - top_left.x) * ppt), (float) ((y - top_left.y) * ppt), scale)
        for (int x = top_left.getX(); x <= playerpos.getX() + tilesx; x++) {
            for (int y = top_left.getY(); y <= playerpos.getY() + tilesy; y++) {
                if (map.inBounds(x, y)) {  //TODO Make a better system for drawing in bounds only
                    //Tiles
                    Tile tile = tileHashMap.get(map.genKey(x, y));
                    if (tile != null) {
                        Image image = environment.getSprite(tile.getSpriteID());
                        image.draw((float) ((x - top_left.getX()) * ppt), (float) ((y - top_left.getY()) * ppt), scale);
                    }
                    //Entities
                    ArrayList<Entity> ents = entities.get(map.genKey(x, y));
                    if (ents != null && ents.size() > 0) {
                        Entity entity = ents.get(0);
                        Image image = environment.getSprite(entity.getSpriteID());
                        image.draw((float) ((x - top_left.getX()) * ppt), (float) ((y - top_left.getY()) * ppt), scale);

                    }
                    //Actors
                    Actor actor = actorHashMap.get(map.genKey(x, y));
                    if (actor != null) {
                        Image image = actor_sprites.getSprite(actor.getSpriteID());
                        image.draw((float) ((x - top_left.getX()) * ppt), (float) ((y - top_left.getY()) * ppt), scale);
                    }
                }

            }
        }

        Image player = actor_sprites.getSprite(ActorSprite.player);

        player.draw((float) ((playerpos.getX() - top_left.getX()) * ppt), (float) ((playerpos.getY() - top_left.getY()) * ppt), scale);
        messageBox.render();
    }