.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   GrogBot (http://forums.bots-united.com/forumdisplay.php?f=54)
-   -   1.1 and 2.0 Progress (http://forums.bots-united.com/showthread.php?t=2667)

Akz 18-09-2004 21:02

1.1 and 2.0 Progress
 
Arr!

Had nothing else to do, so I decided to tell you about my evil plans. 8D

GrogBot 1.1
EDIT: Has been released and can be downloaded from the filebase.

GrogBot 2.0

"The next generation of grogbot" :P
  • A longer scale project than the first one was. The bot will be written from scratch, and it will not be based on any of the bot templates/sources available.
  • It will be an open-source project.
  • I'm mostly doing it because the code in the first GrogBot was *erm...* sort of badly designed, and the bot will also be more "mine" than the original, which was based on the HPB bot 3.0 source.
The first GrogBot 2.0 spawned into the game. Sitting there, doing nothing. WOW!
http://koti.mbnet.fi/grogbot/crossfire0000.jpg

Tell me what you think. Suggestions are always welcome. ;)

AzShadow 18-09-2004 21:07

Re: 1.1 and 2.0 Progress
 
I don't really understand the features in 1.1 but they're probably good. :D

Still waiting for 2.0 which allows to do so many good things...

Pierre-Marie Baty 19-09-2004 16:57

Re: 1.1 and 2.0 Progress
 
good luck ! =)

Ailean 20-09-2004 17:03

Re: 1.1 and 2.0 Progress
 
You're in the pvk2 team, so could you, eh :o , ... sneak a bot in the core? :D Or at least try to make one that's *tightly* integrated with pvk2?

yes, yes, I know the hl2 sdk isn't released yet, but asking doesn't hurt :D

And, I haven't paid attention to it yet, but some people told me all those grogbots speedhack ...

Akz 20-09-2004 18:16

Re: 1.1 and 2.0 Progress
 
Quote:

Originally Posted by Ailean
You're in the pvk2 team, so could you, eh :o , ... sneak a bot in the core? :D Or at least try to make one that's *tightly* integrated with pvk2?

It's very possible that I'm going to make a bot for PVK2 too, but I've been thinking about releasing it as a third-party product. Nothing has been decided though. ;)

Zeta 24-09-2004 02:41

Re: 1.1 and 2.0 Progress
 
I like the feature to command the bots :D and er what's a booty Tag mode?

Akz 24-09-2004 18:00

Re: 1.1 and 2.0 Progress
 
pvk_temple for example. There's one treasure chest in the map placed somewhere. The objective is to grab the chest, and hold it to gain points. You get scored every 10 seconds or something while holding the chest.

Akz 26-09-2004 19:29

Re: 1.1 and 2.0 Progress
 
Whoa!

I've been working on the A* pathfinder for GrogBot 2.0 lately. I never thought that I could be able to understand such a big thing as A* is, but when I finally started gathering information about it and writing my own implementation, I began to understand how A* actually works.

I got it working pretty fast, but it was really SLOW at first. Unusable... It took half a minute to calculate a path in a map with ~200 nodes. After some little optimizations, I got it to calculate the path in 1-2 seconds. More faster than before, but still far too slow.

It took me two days to understand what the problem was :|. I was logging every GetItemCount() call to an external file, which slowed it down A LOT. After removing those two little lines of code, it's working a lot better. Sure it isn't the most optimized one, but it works!

Code:

void CPathfinder::FindPath( CNode *start, CNode *end )
 {
        m_bSearching = true;
 
        SAFE_DELETE( m_pResult );
        SAFE_DELETE( m_pOpenList );
 
        m_pOpenList = new CList<astar_t>;
 
        // Store the indexes of the start and end nodes
        m_iStartNodeIndex = g_NodeManager.GetNodeIndex( start );
        m_iEndNodeIndex = g_NodeManager.GetNodeIndex( end );
 
        for ( int i = 0; i < g_NodeManager.GetNodeCount(); i++ )
        {
                // Initialize the values.
                m_Nodes[i].open = false;
                m_Nodes[i].closed = false;
 
                m_Nodes[i].f = 0.0;
                m_Nodes[i].cost = 0.0;
                m_Nodes[i].heuristic = 0.0;
                m_Nodes[i].parent = -1;
 
                m_Nodes[i].index = i;
 
                m_Nodes[i].pNode = g_NodeManager.GetNodeByIndex( i );
        }
 
        // Mark the start node as open
        m_Nodes[m_iStartNodeIndex].open = true;
        m_pOpenList->Insert( &m_Nodes[m_iStartNodeIndex] );
 
        Advance();
 }
 
 void CPathfinder::Advance( )
 {
        int i;
 
        if (!m_bSearching)
                return;
 
        int loops = 0;
 
        while ((m_bSearching) && (loops < 100))
        {
                loops++;
 
                float        smallest_f                = -1.0;
                astar_t *pChosen                = NULL;
 
                // Find the node with the smallest f from the open list.
                for ( i = 0; i < m_pOpenList->GetItemCount(); i++ )
                {
                        astar_t *pCurrent = m_pOpenList->Get(i);
 
                        if (!pCurrent)
                                continue;
 
                        if ( (pCurrent->f < smallest_f) || (smallest_f == -1.0) )
                        {
                                smallest_f = pCurrent->f;
                                pChosen = pCurrent;
                        }
                }
 
                if ( !pChosen )
                {
                        m_bSearching = false;
                        return;
                }
 
                // Check if this node is the goal
                if (pChosen->index == m_iEndNodeIndex)
                {
                        // The path has been found!
 
                        astar_t *pCurrNode = pChosen;
 
                        m_pResult = new CList<CNode>;
 
                        while ( pCurrNode )
                        {
                                m_pResult->InsertAtTail( pCurrNode->pNode );
 
                                if ( pCurrNode->parent != -1 )
                                    pCurrNode = &m_Nodes[pCurrNode->parent];
                                else
                                        pCurrNode = NULL;
                        }
 
                        m_bSearching = false;
                        return;
                }
 
                CList<CNode> *pPaths = NULL;
                       
                if (pChosen->pNode)
                        pPaths = pChosen->pNode->GetPaths();
                else
                        continue;
 
                if (!pPaths)
                        continue;
 
                // Mark this node as closed
                pChosen->closed = true;
 
                // Remove from open list
                m_pOpenList->Remove( pChosen );
                pChosen->open = false;
 
                // Loop through the possible successors
                for ( i = 0; i < pPaths->GetItemCount(); i++ )
                {
                        CNode *pNode = pPaths->Get(i);
                        astar_t *pCurr = &m_Nodes[pNode->GetIndex()];
 
                        if (!pNode)
                                continue;
 
                        // If this node is linked to itself for some unknown reason, skip it.
                        if ( pNode == pChosen->pNode )
                                continue;
 
                        // Calculate the new cost.
                        int new_cost = pChosen->cost + g_Util.GetDistanceBetween( pChosen->pNode->GetOrigin(), pNode->GetOrigin() );
 
                        // If this node is not touched yet OR if a better route has been found...
                        if (((!pCurr->closed) && (!pCurr->open)) ||
                            (((pCurr->open) || (pCurr->closed)) && (new_cost < pCurr->cost)))
                        {
                                m_pOpenList->Remove( pCurr );
 
                                pCurr->cost = new_cost;
                            pCurr->heuristic = g_Util.GetDistanceBetween( m_Nodes[m_iEndNodeIndex].pNode->GetOrigin(), pNode->GetOrigin() );
 
                                pCurr->f = pCurr->cost + pCurr->heuristic;
                               
                                pCurr->parent = pChosen->index;
 
                                pCurr->open = true;
                                m_pOpenList->Insert( pCurr );
                        }
                }
        }
 }
 
 CList<CNode>* CPathfinder::GetResult( )
 {
        if (m_bSearching)
        {
                g_Output.Log( LOG_DEV, "CPathfinder::GetResult(): ERROR: Search in progress." );
                return NULL;
        }
 
        return m_pResult;
 }

EDIT: Code tags are back.

Pierre-Marie Baty 27-09-2004 14:30

Re: 1.1 and 2.0 Progress
 
The code tags are broken... I know... this seriously sucks! There's nothing I can do cause Onno hasn't opened any SSH account on the server for me yet!!!

elitejavi 22-10-2004 20:55

Re: 1.1 and 2.0 Progress
 
soo, can you give us a date?
if not, can you tell us the progress of the progress(or you edit the frist post every time you progress:D )

seeya


All times are GMT +2. The time now is 00:48.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.