Ant (0.02)

This forum is currently in read-only mode.
0 favourites
From the Asset Store
AI for enemies in style of a well known blue robot guy.
  • I had a few problems when I started making an rts game with ants. I more or less copied the example file that comes with construct, but when I duplicate the ant, I get problems with selecting multiple ones like -

    -Some not moving

    -Some not having a selection box appear around them

    -Bouncing off each other to get to the objective because they are solid to prevent them overlapping (is there an alternative to this?)

    -The selection box won't dissapear until you click again if it touches the edge of the layout

    Also, how would I go about uploading a .cap file if you needed to see it?

  • I seem to have a fuzzy recollection of encountering similar problems when I was doodling with the RTS example, but I can't recall how exactly I coped... Maybe if you upload the file I'll take a look and try to solve it? You can use a site like filefront or mediafire or something, then post the link here.

    As for the bouncing part, unfortunately I haven't been able to come up with a decent solution myself. Making them solid seems to screw around with their pathfinding when they're on the move, so as far as I can tell the default system seems to be the best. But if anyone else can has some good suggestions I'm all ears

  • Here ya go

  • http://dl.dropbox.com/u/20122742/Top%20Down%20RTS.cap

    using physics in conjunction with rts movement. Suppose you could just use a custom movement with the rts also.

    its a alternate way to prevent overlap. and it has a more organic feel.

    -left click to move green

    -right click to move tan

    no idea about the selection, I never had a problem with it before..

  • As far as I see the selection thing just needs a "For Each Ant" in the conditions of the event which controls selection. Some of the ants not moving seems to be caused by pathfinding problems because they're trying to find a way around each other but it's taking too long or they can't, so making them not solid would fix this, but then you also need to deal with the overlap.

    Bartosh, that's interesting, you've definitely given me some ideas to play around with. Cheers

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This:

    + System: Start of layout
    -> Ant: Avoid moving over Ant [/code:hkep746c]
    An this:
    [code:hkep746c]+ MouseKeyboard: On Left mouse button Clicked
    + SelectionBox: [negated] Is dragging selection box
    + Ant: Value 'Is Selected?' Equal to 1
    -> Ant: Move to (mousex+clamp(normalrandom(0,60),0,60), mousey+clamp(normalrandom(0,60),0,60))[/code:hkep746c]
    
    Will solve the dancing, if you remove the "solid" attribute, but they will bunch up a bit.
    There's also a formation cap.
    [url]http://www.scirra.com/forum/viewtopic.php?f=8&t=4839[/url]
    Probably not best for ants tho.
  • Thanks guys for the quick and helpful responses. I will have a look at them and see how I go, and if I have any other problems I'll post them in this thread.

    Oh, and are there any tuturials you might recommend for making a menu bar that pops up, say, when you click on an ant nest? It would need to show:

    -# of resources (food)

    # of forming/stored ants for different types

    -click to make warrior ant (-3 resource)

    -click to make worker ant (-1 resource)

    Or something like that. I'm sure if I looked I could find something, but do you guys have any recommendations that would get me what I need? Jeez I must sound so lazy...

  • http://www.mediafire.com/?oesa8q3sp89x3yi

    ^Newest Update (0.01?)^

    I added a hill and am working on keeping ants inside it and spawning them etc. so far I've only added a private variable for the number of ants inside, but a lot more is still to be added.

    Press 'c' to create ants at hill.

    Hold space to zoom in

    WASD to move the camera

  • I love the concept of your game keep it up.

  • Thanks, but after a little research I found it is hardly original, but that's ok. One of the spins I want to put on it is to have a layer underneath that has a top-down system of tunnels that you can dig and lead to other anthills to make suprise attacks and stuff.

    Anyway, Questions:

    -How would I make the selected ants 'patroll' an area? By this I mean you click in two different spot and then they go from one to the other continuosly until interupted by enemies or something

    -How could I make the ants spawn randomly around the anthills so they don't bunch up on top of each other?

    -How could I make it so that the radius around the mouse is increased for how many ants there are, so they don't have to overlap. eg. ->50 ants selected, set mousey mousex to 100 and 100 (normally 60, 60) or something like that. Possibly another solution would be to implement the formation idea somehow?

  • In Sim Ant you could dig next to rival nests and dig through to launch surprise attacks. Play that game if you haven't, it's really fun.

  • http://www.mediafire.com/download.php?2je09bbwu572hs1

    V0.02

    Updates:

    Added exit hole

    Added a variable so when more than 5 ants are selected the area they go to is bigger

    Began HUD

    New problems:

    # of ants selected text only goes up to 9 then dissapears

    # of ants in hill has a similar problem, somewhere around 100

  • bump

  • Why is no one helping anymore?

  • -How would I make the selected ants 'patroll' an area? By this I mean you click in two different spot and then they go from one to the other continuosly until interupted by enemies or something

    -How could I make the ants spawn randomly around the anthills so they don't bunch up on top of each other?

    1 - in RTS tab, there is "Add waypoint at position". I'd have an event with

    on mouse click - get mouse position - add it to ant's waypoint1

    on second click - get mouse position - add it to ant's waypoint2

    than if an ant:

    get to waypoint1 - send him to waypoint2

    get to waypoint2 - send him to waypoint1

    2 - I've made a similar example here

    Don't mind that Czech text inside. Basically, there is an checker which checks if there is a free space to create an object. Turn off first 2 actions in the 1 Event to see it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)