Ant (0.02)

For questions about using Classic.

Post » Wed Feb 09, 2011 9:46 am

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?
B
5
S
1
G
1
Posts: 43
Reputation: 888

Post » Wed Feb 09, 2011 9:20 pm

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 :wink:
B
35
S
15
G
16
Posts: 268
Reputation: 10,711

Post » Wed Feb 09, 2011 9:57 pm

B
5
S
1
G
1
Posts: 43
Reputation: 888

Post » Wed Feb 09, 2011 10:39 pm

[url:1od89xk7]http://dl.dropbox.com/u/20122742/Top%20Down%20RTS.cap[/url:1od89xk7]

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..
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Wed Feb 09, 2011 11:09 pm

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 8)
B
35
S
15
G
16
Posts: 268
Reputation: 10,711

Post » Wed Feb 09, 2011 11:51 pm

This:
[code:hkep746c]+ 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:hkep746c]http://www.scirra.com/forum/viewtopic.php?f=8&t=4839[/url:hkep746c]
Probably not best for ants tho.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Thu Feb 10, 2011 5:57 am

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...
B
5
S
1
G
1
Posts: 43
Reputation: 888

Post » Thu Feb 10, 2011 9:39 am

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
B
5
S
1
G
1
Posts: 43
Reputation: 888

Post » Thu Feb 10, 2011 1:10 pm

I love the concept of your game keep it up.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Fri Feb 11, 2011 5:55 am

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?
B
5
S
1
G
1
Posts: 43
Reputation: 888

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests