Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   is making an rts in alice 2 possible? (http://www.alice.org/community/showthread.php?t=11095)

oll 04-05-2015 12:51 PM

is making an rts in alice 2 possible?
 
im kind of new to the whole programming thing, but alice has been fairly simple so far. i've been pondering, however, how i would go about making an rts style game in alice (like starcraft, c&c). i attempted to make one, but ran into a really confusing issue.

there doesn't seem to be a way for alice to store the mouse's location on the fly, unless im just looking at this incorrectly. i can get alice to track the mouses location (i used this to create an edge panning sort of deal), but im lost as to how i could store it when i want to, say, move a unit to the location of where i clicked. is there any way to do this? it's absolutely essential for an rts in this style, and without it things crumble and fall over.

also is it possible for alice to use right mouse in the events pane for controls? it only seems to use left mouse.

RavenOfCode 04-05-2015 01:01 PM

My only suggestion on how to do this is use a grid of invisible squares and store the square clicked on.

I did this before on a RPG, but i got that annoying error when loading and i gave up.

For the squares arty made an object pack and there is a 25/25 grid in there.

Hope this helps and if you have any questions please ask.

oll 04-05-2015 01:09 PM

that's really disappointing that i have to do that :(

there has to be some way to get alice to do this, because it clearly has no issue keeping track of the mouses location.

MrMoke 04-05-2015 04:53 PM

Could be Simple
 
1) In the events pane, you can add a "when mouse is clicked on something" event. It will say "do nothing"
2) Create a new method, and add an object parameter.
3) Go back to the event, and replace "do nothing" with the name of your method and then add "What was clicked" as the parameter.
4) You now have a method that can be programmed to do whatever you want anytime an object is clicked by Using customized lists and arrays.

Happy Programming;)

RavenOfCode 04-06-2015 08:07 AM

[QUOTE=oll;55912]that's really disappointing that i have to do that :(

there has to be some way to get alice to do this, because it clearly has no issue keeping track of the mouses location.[/QUOTE]

What do you mean track of the mouses location?

oll 04-06-2015 10:54 AM

there was a function that kept track of the cursors distance from the top and left edge (i think, i don't have alice on me currently), and having it constantly print out the function resulted in something similar to (x,y) coords

RavenOfCode 04-06-2015 01:26 PM

That could be possible, use the x,y cords then move the objects to those cords.

Good idea, and i think it is possible, ill see if i can make that.

fourbros 04-06-2015 01:35 PM

I don't want to sound like Mr. Negativity, but making an RTS sounds almost impossible. It's taking me a long time to make a simple, bare-bones sports game. I couldn't fathom creating something like Starcraft.

But hey, if you are able to, then I'll eat my words :)

RavenOfCode 04-06-2015 01:39 PM

2 Attachment(s)
Ok, i fooled around with this for a few mins, and heres what i came up with,
and it worked for me so far.

It might need some tweaking depending on the height of the camera.

EDIT: added a better working version, much more accurate

RavenOfCode 04-06-2015 01:56 PM

[QUOTE=fourbros;55926]I don't want to sound like Mr. Negativity, but making an RTS sounds almost impossible. It's taking me a long time to make a simple, bare-bones sports game. I couldn't fathom creating something like Starcraft.

But hey, if you are able to, then I'll eat my words :)[/QUOTE]

I find sports games the hardest... i guess everyone has whats hard for them.

oll 04-07-2015 03:22 PM

i took a look at it, and it's all readable to me until the actual movement, why do you have it move forwards a distance of y cord/9.5 meters? what's the 9.5? same with the x cord, where did you get the 9.3? sorry if these are silly questions, but i don't see where you got these numbers, and what significance they have.

RavenOfCode 04-07-2015 04:27 PM

[QUOTE=oll;55937]i took a look at it, and it's all readable to me until the actual movement, why do you have it move forwards a distance of y cord/9.5 meters? what's the 9.5? same with the x cord, where did you get the 9.3? sorry if these are silly questions, but i don't see where you got these numbers, and what significance they have.[/QUOTE]

Thats fine, the point is i have to move the target to the x and y cords, because of the orientation of 0,0, it requires you move it back and left (i think), and the reason we divide it is because we are dealing with pixels which are very small,
and the screens width, at the ground, is only say 50 meters across. So we divide it by a number to account for the size of the screen in meters at ground level, 9.5 and 9.3 are just numbers that worked nothing special about them.

Is this to confusing? I tried to make it as simple as i could, but if it is ill try to make it simpler.

Also does it work exactly? It does on mine im just wondering if different screen sizes work differently.

Best,
RavenOfCode

MrMoke 04-07-2015 06:58 PM

Hmmm--
 
I assume from your conversation that you haven't tried the suggestion that I made. It should only take a few minutes.

FWIW- Alice is a [COLOR="Black"][B][U]3D[/U][/B][/COLOR] programming environment, so the distance from the top or left side of the run pane is, for the most part, irrelevant. Each object has a unique set of properties including x, y, and z coordinates that can change at any time.

RavenOfCode 04-07-2015 09:27 PM

[QUOTE=MrMoke;55944]I assume from your conversation that you haven't tried the suggestion that I made. It should only take a few minutes.
[/QUOTE]

That was the point of the squares in a grid, as clicking on the ground will bring it to the center of the ground every time no matter where you click.

MrMoke 04-08-2015 01:22 PM

Not if the clicked method affects only those objects from a selected list or array. Assuming that the target objects can move around, a grid of cubes might not work because they would cover the other objects and prohibit access.

BTW- When you start your demo world, move the mouse to the bottom right corner of the display until the pointer changes, click and drag, to make it bigger, and test.

Your ball never goes to the exact position of the mouse click on my machine. There are times where invisible objects are necessary, but I'm not sure this is one of them.

RavenOfCode 04-08-2015 02:36 PM

[QUOTE=MrMoke;55948]Not if the clicked method affects only those objects from a selected list. Assuming that the target objects can move around, a grid of cubes might not work.

BTW- When you start your demo world, move the mouse to the bottom right corner of the display until the pointer changes, click and drag, to make it bigger, and test.

Your ball never goes to the exact position of the mouse click on my machine. There are times where invisible objects are necessary, but I'm not sure this is one of them.[/QUOTE]

Oh shoot! Thats a big issue, I did that and it never worked right... maybe I should add a way to set the window to the correct size...

Thanks for pointing that out.

Do you know any script to make it set the window a certain size?

MrMoke 04-08-2015 03:24 PM

Nope
 
Changing it on your machine won't change it on all others.

RavenOfCode 04-08-2015 05:27 PM

[QUOTE=MrMoke;55951]Changing it on your machine won't change it on all others.[/QUOTE]

Ok, but is there any script to do that?

MrMoke 04-08-2015 06:58 PM

No

azgrimm 06-23-2015 09:47 PM

You could probably make a game similar to final fantasy tactics using a grid of cube objects placed on the map.

Your biggest issue with making a starcraft type rts is that Alice doesn't seem to have a way of selecting multiple units i.e. mouse drag, so you would have to move troops 1 at a time.

CodeMan 06-24-2015 07:30 AM

[QUOTE=azgrimm;56458]You could probably make a game similar to final fantasy tactics using a grid of cube objects placed on the map.

Your biggest issue with making a starcraft type rts is that Alice doesn't seem to have a way of selecting multiple units i.e. mouse drag, so you would have to move troops 1 at a time.[/QUOTE]

We found a way around that 'grid of cubes' issue. It just requires a preset window size.


All times are GMT -5. The time now is 01:13 AM.

Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.