c# – Speed Up Flow Field Algorithm?

I am slowly creating a flow field pathfinding solution for Unity3D. I’m trying to follow Elijah Emerson’s description, which appears in the book ‘Game AI Pro’ (volume 1). In this question I ask about the Coordinates object which I use here. I have subsequently cached some variables.

In my tests, the stop watch has recorded times for each part of the flow field generation, for example:

FlowField calculations complete 1.0664ms
    path request complete 0.1309ms
    reset complete 0.014ms
    goal allocation complete 0.1427ms
    integration fields complete 0.4417ms
    flow fields complete 0.3318ms 

Integration and flow passes are the slowest parts, and I wonder is there anything I can do to speed them up some more?

I’ve followed some more advice from the aforementioned book, such as saving node neighbours on initialisation, instead of trying to find them at run time. That has helped. I also used James McCaffrey’s priority queue with an internal binary heap. Getting rid of lists, and list comparisons (flagging a boolean property instead works wonders), and replacing them with priority queues seems the biggest gain by far.

I realise it may be trying to squeeze blood from a stone at this point (having dropped calculation time from 100ms to 1.1ms), but I’m eager for any ideas which can help.

Integration Pass:

public void IntegrationPass(PriorityQueue<Coordinates> openList)
{
    while (openList.Count > 0)
    {
        Coordinates theseCoordinates = openList.Dequeue();

        // Update Integration value.  
        //foreach (Coordinates neighbour in FindNeighbours(theseCoordinates, true, true))
        foreach (Coordinates neighbour in IntegrationPassNeighbours(theseCoordinates.sectorX, theseCoordinates.sectorY))
        {
            if (neighbour.Flag)
            {
                continue;
            }

            byte cost = neighbour.Cost.Value;
            int oldIntegration = neighbour.Integration.Value + cost;
            int newIntegration = theseCoordinates.Integration.Value + cost;

            if (neighbour.IsWalkable && newIntegration < oldIntegration)
            {
                neighbour.Integration.Value = newIntegration;
                neighbour.SetFlag(true);
                openList.Enqueue(neighbour, newIntegration);
            }
        }
    }
}

Flow Pass:

public void FlowPass()
{
    foreach (Coordinates node in CoordinatesField)
    {
        if (node.IsBlocked)
        {
            continue;
        }

        int bestValue = ushort.MaxValue;
        Coordinates bestNode = Coordinates.zero;

        //foreach (Coordinates neighbour in FindNeighbours(node, false, false))
        foreach (Coordinates neighbour in FlowPassNeighbours(node.sectorX, node.sectorY))
        {
            int neighbourValue = neighbour.Integration.Value;

            if (neighbourValue < bestValue)
            {
                bestValue = neighbourValue;
                bestNode = neighbour;
            }
        }

        if (!bestNode.Equals(Coordinates.zero))
        {
            int comparisonX = bestNode.worldX - node.worldX;
            int comparisonY = bestNode.worldY - node.worldY;

            // North
            if (comparisonX == 1 && comparisonY == 0)
            {
                node.Flow.Value = 0;
            }
            // North East
            else if (comparisonX == 1 && comparisonY == -1)
            {
                node.Flow.Value = 1;
            }
            // East
            else if (comparisonX == 0 && comparisonY == -1)
            {
                node.Flow.Value = 2;
            }
            // South East
            else if (comparisonX == -1 && comparisonY == -1)
            {
                node.Flow.Value = 3;
            }
            // South
            else if (comparisonX == -1 && comparisonY == 0)
            {
                node.Flow.Value = 4;
            }
            // South West
            else if (comparisonX == -1 && comparisonY == 1)
            {
                node.Flow.Value = 5;
            }
            // West
            else if (comparisonX == 0 && comparisonY == 1)
            {
                node.Flow.Value = 6;
            }
            // North West
            else if (comparisonX == 1 && comparisonY == 1)
            {
                node.Flow.Value = 7;
            }

        }
    }
}

Well-Balanced DEDICATED SERVERS in Thailand, Super Fast Speed, Great Uptime! | Proxies-free

Thaihosting.asia is an IT service company and has since 1995 dealt with the Internet, operation and development. Our product areas include commercial web hosting, server hosting, domain registration, shopping systems, payment solutions, content management systems and IT outsourcing. Thaihosting.asia have always, and will always be known for service, quality and stability. It is our mission to provide quality services at reasonable prices, as well as provide our customers with a personal and unique service. We will not just be an anonymous supplier, but a professional partner.

Get a dedicated server in Thailand, hosted in a modern data center in Bangkok. Choose between Intel Core i3 and Xeon processors and get up to 32 GB of RAM – with no monthly traffic limit on your connection. We use the latest generation Supermicro hardware to deliver dedicated servers here in Thailand, which enables us to deliver dedicated servers with excellent performance and reliability. Bandwidth for our Thai servers is provided by a number of different domestic and international ISPs. This means you get a fast and stable connection 24/7. Our Danish and Thai team will help you get your Thai server up and running fast. We provide 24/7 support for all of our dedicated server products. Read more about our Hostingcenter in Bangkok.

Features of our Dedicated Servers in Thailand:

  • Supports all popular operating systems such as CentOS, Ubuntu, Debian and Windows
  • All Thai servers come with IPMI interface for remote management and console access
  • Directly connected to the biggest Thai ISPs for blazing fast national transfers
  • Full Root or Administrator access
  • Support is available 24/7 by chat and e-mail.
  • Gigabit Ethernet support

30-day money back guarantee on all Thai servers!

Server Thai Basic
฿3,900/ mo
Intel Core i3-6100 @ 3.70GHz 2 cores
100 Mbps network
1 TB SATA3 HD
Unlimited Bandwidth
8 GB RAM
Configure

Server Thai Business
฿4,900/ mo
Intel Xeon E3–1240v5 @ 3.50GHz 4 cores
100 Mbps network
2 TB SATA3 HD
Unlimited Bandwidth
16 GB RAM
Configure

Server Thai RAID
฿5,900/ mo
Intel Xeon E3–1240v5 @ 3.50GHz 4 cores
100 Mbps network
2×2 TB SATA3 HD
Unlimited Bandwidth
32 GB RAM
Configure

– Add 1 Extra IP Address for 150 Baht / month
– Upgrade to 1 Gbps shared line for 1,000 Baht / month

Strong hosting services in green data center:

  • Free support, daily backups and effective protection against viruses and spam.
  • We build your server, manage your IT and keeps technology running.

What you see above are the servers we always have in stock. However, should you have any special hardware requirements, you are more than welcome to Contact us. You can also catch us on the live chat (bottom of every page) around the clock. You are never alone if you choose Thaihosting.asia as your partner.

dnd 5e – Can a character dodge/fly if they use up all their speed?

There’s something about the language in the rules for Dodging and Flying that confuses me. In both cases, both can only performed so long as the character’s Speed is not ‘reduced to 0’.

By that logic, if a character with 30 feet speed, were to say use the full 30 feet speed on their turn, would that prevent them from taking the Dodge action?

Likewise, if a creature had, say, a Flying speed of 60 feet, would there character have to fly 55 ft in order to stay aloft or risk falling?

(As a side note, how do attacks like Thunderwave which force movement play into this? If a Thunderwave hits a 30 feet speed character who has only moved 25 feet, would that prevent the character from being able to use Dodge until their next turn?)

Centohost.com DEDICATED SERVERS – 35% off for 3 Months| Great Uptime & Speed! | Proxies-free

Are you interested in High End Dedicated Server Hosting Services?

CentoHost.com is a brand of Globalhost d.o.o. which is one of the leading web hosting companies since 2002. We use the latest Dell server technology in our own data center to ensure that our customers get the best performance out of their websites. Our wide selection of web hosting services will cater to your hosting needs whether you’re making a small, simple website, or a high powered, high traffic website. Our main goal is to provide the best technology available with exceptional customer support. With a large client base comes a diverse range of Web hosting requirements. We have tailored our company around these needs by providing flexible and scalable services.

SPECIAL OFFER: First 3 MONTHS – 35% OFF

Our dedicated servers are located in own data center in Europe – Bosnia and Herzegovina. You will get serial console access with performance servers. Plus you will be able to install and customize applications.

Our Features:

  • Unmetered bandwidth
  • Free DDoS protection
  • IPv6 ready
  • Free setup
  • Free hardware RAID
  • Fast setup
  • Dell PowerEdge servers
  • DDR3 ECC RAM
  • Guaranteed resource
  • Server monitoring
  • Remote reboot
  • Single and Dual CPUs

Take a look at Centohost Entry-level Dedicated Servers:
Get started with a Dedicated Server within your budget – (Unmetered bandwidth + Free DDoS protection + IPv6 ready + Free setup)

DELL PowerEdge T20 Server Package
1 x Dual Core Intel Pentium G3220

Speed – 2 x 3.00 GHz
Memory – 8 GB DDR3
Hard Drives – 1 TB (2 x 500 GB SATA3)
Bandwidth – unmetered
PRICE – €59.15/month – ORDER NOW

DELL PowerEdge T20 Server Package
1 x 4 Core Xeon E3-1225v3
Speed – 4 x 3.2 GHz (+HT)
Memory – 8 GB DDR3
Hard Drives – 2 TB (2 x 1 TB SATA3)
Bandwidth – unmetered
PRICE – €64.35/month – ORDER NOW

HP ProLiant DL360e G8 Server Package
1 x 8 Core Xeon E5-2450L
Speed – 6 x 2.0 GHz (+HT)
Memory – 32 GB DDR3
Hard Drives – 2 TB (2 x 1 TB SATA3)
Bandwidth – unmetered
PRICE – €83.85/month – ORDER NOW

You can also check out Centohost Performance Dedicated Servers:
More powerful servers for medium and large projects – (Unmetered bandwidth + Free DDoS protection + IPv6 ready + Free setup)

DELL PowerEdge R610 Server Package – 1
2 x 6 Core Xeon X5650

Speed – 12 x 2.7 GHz (+HT)
Memory – 32 GB DDR3
Hard Drives – 2 TB (2 x 1 TB SATA) SAS Optional
Bandwidth – unmetered
PRICE – €157.95/mo – ORDER NOW

DELL PowerEdge R420 Server Package – 1
2 x 6 Core Xeon E5-2430
Speed – 12 x 2.2 GHz (+HT)
Memory – 32 GB DDR3
Hard Drives – 2 TB (2 x 1 TB SATA) SAS Optional
Bandwidth – unmetered
PRICE – €161.85/mo – ORDER NOW

HP ProLiant DL360e G8 Server Package – 1
2 x 8 Core Xeon E5-2450L
Speed – 16 x 1.8 GHz (+HT)
Memory – 32 GB DDR3
Hard Drives – 2 TB (2 x 1 TB SATA) SAS Optional
Bandwidth – unmetered
PRICE – €168.35/mo – ORDER NOW

DELL PowerEdge R710 Server Package – 1
2 x 6 Core Xeon X5670
Speed – 12 x 2.93 GHz (+HT)
Memory – 32 GB DDR3
Hard Drives – 2 TB (2 x 1 TB SATA) SAS Optional
Bandwidth – unmetered
PRICE – €178.10/mo – ORDER NOW

HP ProLiant DL360e G8 Server Package – 1
2 x 8 Core Xeon E5-2440v2
Speed – 16 x 1.9 GHz (+HT)
Memory – 32 GB DDR3
Hard Drives – 2 TB (2 x 1 TB SATA) SAS Optional
Bandwidth – unmetered
PRICE – €194.35/mo – ORDER NOW

DELL PowerEdge R820 Server Package – 1
4 x 8 Core Xeon E5-4650
Speed – 32 x 2.70 GHz (+HT)
Memory – 64 GB DDR3
Hard Drives – 2 TB (2 x 1 TB SATA) SAS Optional
Bandwidth – unmetered
PRICE – €356.85/mo – ORDER NOW

Included with dedicated server:
Fast Setup (In most cases our servers will be ready in just 4 hours after your order)
IPv4 and IPv6 network (All dedicated servers include both IPv4 and IPv6 network connection and addresses)
Unmtered Traffic (All our dedicated servers come with unmetered data transfer)
No Setup Price (All our dedicated servers are with completely FREE setup, even if you pay monthly)
Free DDoS Protection (All dedicated servers in our offer are protected with advanced DDoS protection system)
Free Hardware RAID (We offer FREE Hardware raid controler with all our Performance Servers)

Legal informations:
Globalhost d.o.o., Kralja Tvrtka 15, 72290, Novi Travnik, Bosna i Hercegovina
ID number: 4236611790005
TAX number: 236611790005
MBS: 51-01-0011-15

Contact informations:
E-mail: (email protected)
Phone (US): +1-702-323-3802
Phone (EU): +43-72-002-2527
Phone (BA): +386-30-795-066
International Number: +883-5100-128-917-94
Fax: +1-702-323-3844

Not sure which plan is best for you?
No problem. Send us a ticket with your questions and we’ll get back to you with a quote. Free of charge.