SJA random projects - Page 6

User Tag List

Page 6 of 24 FirstFirst ... 4567816 ... LastLast
Results 51 to 60 of 236
  1. #51
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:
    Updated movement for upcoming 2D unreal tournament:

    There is a few little bugs I need to fix.

  2. #52
    Whicked Sick ~~D4RR3N~~'s Avatar
    Join Date
    Jul 2012
    Location
    Venezuela
    Posts
    1,614
    Country:
    Lol man you obviously know lots and lots more than me I have hard times when tracking collisions (Ofc the IDE I'm working on odesn't have anything implemented so it doesn't really suit my needs)
    Quote Originally Posted by |uK|UNrealshots View Post
    You're playing a game that came out in 1999 in the year 2012 who is the fucking nerd here?
    All of us. Enjoy.

  3. #53
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:
    This will be the basic path nodes for bots, thought it looked like a nice pattern.



    I got a bot to move about the map, just need to stop it going through a loop, easy enough to do though.

  4. #54
    Whicked Sick Higor's Avatar
    Join Date
    Apr 2012
    Location
    Full sail ahead!
    Posts
    3,676
    Country:
    Do some pruning in those paths...
    Let's see...

    Hypothesis:
    - Points A, B, C
    A,B,C are of same type and have no special cost or handling code.
    - [,] is a distance function
    - [>] is a one-way connection
    - TH is a distance threshold (default = 1.25)

    Method:
    - [A>B] exists, [A>C] exists, [B>C] exists.
    - Point B has an outgoing connection to C
    - IF: [A,B] + [B,C] < [A,C] * TH
    >>>> Get rid of [A>C]

    During pathfinding:
    - Add INT variable NavigationTag to node class.
    - Add FLOAT variable BestWeight to node class.
    - Add a 'node' variable BestPrevNode to node class.
    - Global INT variable GNavigationTag.

    * On a pathfinding function :
    -- Do GNavigationTag++
    -- Find nearest node to destination, name it END
    -- Find nearest node to seeker, name it START
    -- Set START->NavigationTag = GNavigationTag
    -- Set START->BestWeight = 0 + SpecialCost (if any)
    -- Iterate on all linked points:
    --- Disregard this node (continue if (LINKED[i]->NavigationTag == GNavigationTag) AND (LINKED[i]->BestWeight < W)
    *** This means this linked path was checked during this pathfinding, and another route was more effective already
    --- Set LINKED[i]->NavigationTag = GNavigationTag
    --- Set LINKED[i]->BestWeight = BestWeight + [this,LINKED[i]] + LINKED[i]->SpecialCost
    *** This means we're setting the linked's point cost to the base node's cost plus distance and extra special cost
    --- Set LINKED[i]->BestPrevNode = this
    --- IF NO MORE LINKED POINTS, GO BACK ONE LEVEL
    **** EXTRA OPTIMIZATION STEP:
    If you already found END, define: LowestEndWeight = LINKED[i]->BestWeight (Linked[i] should be END here)
    In any iterations, if you see that (LINKED[i]->BestWeight > LowestEndWeight) then it means that this path is going away from END and it's no use iterating here.



    Once the iteration ends, you will have checked all of this pathing region and assigned costs to it.
    Then, do this:
    - See if END->NavigationTag == GNavigationTag, if this is true, then the END point was found by our pathfinder, else return NULL (no path)
    - Define local 'node' variable named TEMP
    - Iterate:
    -- TEMP = END
    -- while ( TEMP->BestPrevPath != NULL && TEMP->BestPrevPath != START ) TEMP = TEMP->BestPrevPath;
    ** This will loop backwards from END to START+1, thus finding the best next path to follow.
    ** Sure, you can do route caching like this if you want to save CPU cycles, but this is good enough.

    Advantages:
    - Pruning simplifies network and makes it easy to read, reduces per-path iteration count.
    - Swarming styled pathfinding won't search pathnodes in different regions.
    - The mentioned optimization will make pathfinding to near points way faster.
    ------------------------------------- * -------------------------------------

  5. #55
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:
    I've only done some of what you've suggested so far, it's miles better than the crap I was doing, I doubt I've done it properly though being as stupid as I am .

  6. #56
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:
    This is what I was working on last night btw:

    Code:
    bot = function (name,team,p)
    {
        this.name = name;
        this.team = team;
        this.position = { "x": p.x, "y": p.y };
        this.speed = 2;
        this.target_node = Math.floor(Math.random() * path_nodes.length);
        this.moves = false;
        this.previous = [-1, -2,-3];
        this.reached_target = true;
        this.xunits = 0;
        this.yunits = 0;
        this.path_count = 0;
        this.brandom = false;
    
        this.tick = function()
        {
    
            context.strokeStyle = "white";
            context.lineWidth = 1;
    
            function calc_distance(a, b) {
                var dx = b.position.x - a.position.x;
                var dy = b.position.y - a.position.y;
                var distance = Math.sqrt(dx * dx + dy * dy);
                return distance;
            }
    
            function sort_by_distance(a, b) {
                if (a[1] > b[1]) {
                    return 1;
                } else if (b[1] > a[1]) {
                    return -1;
                } else {
                    return 0;
                }
            }
    
    
            
            if(this.path_count == 5){
                var rand = Math.floor(Math.random() * path_nodes.length);
                this.path_count = 0;
                this.brandom = true;
            } else {
                this.brandom = false;
            }
                var closest = null;
                if (this.reached_target && !this.brandom) {
                    for (var p = 0; p < path_nodes.length; p++) {
    
                        var a = path_nodes[p].position;
                        var dx = a.x - this.position.x;
                        var dy = a.y - this.position.y;
                        var distance = Math.sqrt(dx * dx + dy * dy);
                        if (distance < 200) {
                            if (p != this.previous[0] && p != this.previous[1] && p != this.previous[2]) {
                                this.previous[2] = this.previous[1];
                                this.previous[1] = this.previous[0];
                                this.previous[0] = p;
                                this.target_node = p;
                                this.moves = distance / this.speed;
                                this.xunits = (a.x - this.position.x) / this.moves;
                                this.yunits = (a.y - this.position.y) / this.moves;
                                this.reached_target = false;
                                console.log("FFFFFFFFF");
                                this.path_count++;
                                break;
                                
                            }
                        }
    
    
                    }
                    if (this.reached_target || this.brandom) {
                        console.log("didnt find path node");
                        this.previous[2] = this.previous[1];
                        this.previous[1] = this.previous[0];
                        
                        this.target_node = Math.floor(Math.random() * path_nodes.length);
                        this.previous[0] = this.target_node;
                        this.reached_target = false;
                        this.path_count++;
    
                    }
                }
                this.position.x += this.xunits;
                this.position.y += this.yunits;
                this.moves--;
                if(Math.floor(this.moves) <= 0){
                    this.reached_target = true;
                }
                
            
        }
    }

  7. #57
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:
    Reading a new chapter in my javascript book, so I've started to make another stupid game for my amusement, as well as to get used to the new techniques.

    Here is a teaser:


    I know it's not much yet, but it's going to be one of those odd random games. It might go something like this, shooting the potato with chips, then the potato splits into smaller potatoes, and you have to try and hit as many as you can before all of the remaining ones hit the ground.

  8. #58
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:
    You can test the potato game movement here: Potato game

    I've made it interact with the mouse cursor for a test, I've just learned how to rotate stuff on the canvas without messing up the coordinate system. That is basically what this build is showing.

  9. #59
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:
    It shoots french fires now


    Now I have to make the hit detection for the french fires, to make the potatoes split into two different potatoes.

  10. #60
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Similar Threads

  1. Another random game
    By UT-Sniper-SJA94 in forum Spam Section
    Replies: 79
    Last Post: 06-29-2015, 07:59 PM
  2. Random siege gif.
    By Chamberly in forum Screenshots
    Replies: 8
    Last Post: 01-05-2015, 04:17 AM
  3. Ben10 / Random / random Anime names
    By uenz in forum Reports/Complaints & Appeals
    Replies: 7
    Last Post: 08-30-2014, 02:43 PM
  4. Random bug
    By UT-Sniper-SJA94 in forum Spam Section
    Replies: 7
    Last Post: 03-13-2014, 11:22 AM
  5. Everybody random guy
    By |uK|B|aZe//. in forum Bans
    Replies: 0
    Last Post: 12-23-2011, 10:31 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •