RTS Game-update template, or make full

Talk about making games.

RTS Game-update template, or make full

Postby jimmynewguy » Sat Jan 23, 2010 4:38 pm

So i've been working on making an RTS game like command and conquer, with 8-direction facing and cool stuff like that. i have a demo-ish sorta thing to see what you guys think on a few things. Should i make an actual game, or just update my old RTS template? The pathfinding is sorta coded of, it'll work better when i get better water tiles to do rounded edges so he doesnt get stuck on everything square. :lol: Post your ideas/comments
EDIT: Added linux

------------------------------CONTROLS----------------------------------------------------------------------------------------------------
~WASD to move the view.
~Mouse to select/deselect and move soldiers

------------------------------SO FAR--------------------------------------------------------------------------------------------------------
~8 direction facing with some pathfinding ability
~tileable "flowing" water

------------------------------TO COME------------------------------------------------------------------------------------------------------~Better pathfinding
~vehicles
~AI
~stuff i havent thought of yet....
Attachments
RTS.zip
LINUX
(768.91 KiB) Downloaded 68 times
Screen.PNG
Screen Shot
RTS.zip
TEST 1
(760.07 KiB) Downloaded 79 times
Last edited by jimmynewguy on Sat Jan 23, 2010 5:03 pm, edited 1 time in total.
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: RTS Game-update template, or make full

Postby Hblade » Sat Jan 23, 2010 4:46 pm

Can you send the GED I have linux :(
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RTS Game-update template, or make full

Postby jimmynewguy » Sat Jan 23, 2010 5:04 pm

I added a linux version :) cuz i know sky will need if it he wants to download too
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: RTS Game-update template, or make full

Postby Hblade » Sat Jan 23, 2010 5:05 pm

ty ^.^
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RTS Game-update template, or make full

Postby Bee-Ant » Fri Feb 12, 2010 1:28 pm

jimmynewguy wrote:I added a linux version :) cuz i know sky will need if it he wants to download too

I use linux too :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: RTS Game-update template, or make full

Postby Hblade » Fri Feb 12, 2010 2:08 pm

Lots of linux users :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RTS Game-update template, or make full

Postby 4erv' » Fri Feb 12, 2010 5:57 pm

Waiting for some AI guys to shoot :D
And make another way to select more than one soldier.. something like this.
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: RTS Game-update template, or make full

Postby DST » Fri Feb 12, 2010 7:32 pm

making a group selection is actually quite easy. I'll outline the basics of it here.

1. all actors have an id in an array, as in units[id][health], etc.

2. When creating a unit, search the array for the first empty slot (keeps the array from growing too large). the search starts at 1 so 0 remains empty.

3. Units have a state that determines their actions(units[id][state]). State 0=just made. state 1=looking for something to do. 2=doing something. 3= returning from doing something 4=moving to user's command.

4. when right-clicking for movement, there is a global move type that's set, either when you clicked on one actor or clicked on several, or none.

5. actors move on moveto commands based on items in the array (units[id][movex], units[id][movey]).

So, here it goes:

On background(or click actor), lmb down, set an xprev and a yprev for the mouse, and initialize the 'draw box' routine.

On lmb up, cycle through all units:
int i;
found=0;
for(i=0; i<maxunits; i++){
selecteds[i]=0; //clear the selected array as we go
if(units[i][myx]<max(xmouse, xprev) && units[i][myx]>min(xmouse, xprev) etc. etc. to check that they are within the box){
selecteds[found]=i; //fill in the selecteds array
found++;
}
}
if(found>0){ //if at least one unit was selected
globalmove=2;
}
where clicking on one ship would create a global move of 1, clicking on nothing doesn't change globalmove, etc.
now you have an array holding the ids of all the selected ships.

then, on the clickactor/background rmb down,
int i; int j;
switch(globalmove){
case 2:
for(i=0; i<found; i++){
j=selecteds[i];
units[j][state]=4; //makes unit stop whatever it was doing and begin moving
units[j][movex]=xmouse;
units[j][movey]=ymouse;
}
}
break;
}

More things: 1. if you move view, you can't use xmouse and ymouse like that, you'll have to subtract view.x and view.y from the coordinates to account for the offset (and same with xprev, yprev).

2. The units[][] array should use defines to match things up with words that make sense, as in '#define health 1', '#define movex 10' or whatever. In this way you can always add new slots to the array and give them names that make sense to you.

3. When you set the units[i][movex] values, you can also add the desired formation in there, just like arranging puzzle pieces or any other 2d array (as i've explained in multiple posts and demos).

4. on an actor>movefinish, we can decide what to do based on the state of the actor. As in, on state 4 move finish, return to state 1, looking for something to do. You can reuse this routine to target an enemy, by just setting the units target to the enemy id, and if you have a sensible targeting routine, they will attack that enemy as soon as they're done moving.

5. by using this id routine on ALL units, you can create a multiplayer game very easily. There is no reason that the cpu units and the player units should act any differently from each other.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: RTS Game-update template, or make full

Postby Bee-Ant » Sat Feb 13, 2010 2:59 am

Is this some kind of selecting multiple actor and make them active?
What are the player atr?only health?
I may use this method

1. Make global vars
int hp[99];
int select[5];
int emptyindex;
int selectindex;

2. Actor-CreateActor :
hp[cloneindex]=100;
emptyindex++;

3. When you click the actor to select it :
select[selectindex]=cloneindex;
selectindex++;

4. When deselect :
select[selectindex-1]=0;
selectindex--;

5. How you control the actor?for instance move up :
Actor-DrawActor :
int i;
for(i=0;i<selectindex;i++)
{
if(select[i]==cloneindex)
{
y-=5;
}
}

Its just the main code. I dont explain the details. Or want me make a demo?
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: RTS Game-update template, or make full

Postby jimmynewguy » Sat Feb 13, 2010 3:43 pm

well to be completley honest, i havent touched this .ged in a while. But i can start udating it and if it actually ends up working well give the codes. Right now it's kinda crap :(

EDIT: This is why lol
Attachments
Heli.PNG
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: RTS Game-update template, or make full

Postby DST » Sun Feb 14, 2010 1:32 am

see the next post.
Last edited by DST on Sun Feb 14, 2010 1:35 am, edited 1 time in total.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: RTS Game-update template, or make full

Postby DST » Sun Feb 14, 2010 1:34 am

2 things:

1. Using a 2dimensional array for all the actors in the game and all their attributes is much easier to manage. When you search for objects in a loop, you can ask for any aspect of that object; as in units[i][health], units[i][damage], etc. etc. The array in Nova Epic is 1000 x 44, thus 44 attributes per object.

This allows you to clone stats, as well, for instance, you may have a rate at which the unit checks something; but you may need another rate for it to check something else (in the case of a battlecruiser, with lasers, missiles, and bullets, you need to track up to three targets and store three damages and three firing rates). But when using defines, you don't have to reorder your array every time you add an attribute. Just throw it in the next empty slot and define that slot number with a viable word
i. e. units[i][rate1], units[i][rate2], and so forth. You can use empty slots for timers as well.

2.
Bee-Ant wrote:5. How you control the actor?for instance move up :
Actor-DrawActor :


You are asking a question each frame that only needs to be asked one time. If you are selected, do this. It only needs to be known on a mousebutton up. Asking it every frame, from multiple actors, doesn't make sense in an rts game.

This is the value of a command like moveto; why assign directional velocity over and over again each frame, or ask the unit to decide if it's arrived yet ? just use moveto and movefinish to tell it what to do.

And with the targeting, the function should return the actor state, like this:
Unit>Draw Actor>
switch(units[me][state]){
case 0:
state=findtarget(target1); //looks for a target for weapon 1, returns 1 on success, 0 on failure
break;
case 1:
state=attacktarget(target1); //attack the target; returns 1 if target still alive, 0 if target was destroyed
break;
}

You can then set that script to run based on a counter (to match the unit's response rate) so that, most of the time, the only thing all your units are doing is checking to see if their timer is ready, and only once every couple seconds do they have to find a target, fire an arrow, or do anything else at all.


This is how you get 1000's of units battling at once.


Then apply this logic to the arrows; the arrow itself has a moveto and movefinish! we don't need a collision, just hurt stuff when its done moving. Arrows move much faster than units anyway, if the units a few pixels over when it hits, so what? there's 1000's of units in battle. No one will notice.

If you look at starcraft, this is exactly how they do their shots.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: RTS Game-update template, or make full

Postby Bee-Ant » Sun Feb 14, 2010 5:26 am

1000x44 means 44000 1d array.
How can you save that state?
If I'm not mistaken, array in variable window only supports 1d under 9999....

Oh...I know, I know, I know...
Xixixixixi :twisted: (evil laughing)
I found out something...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: RTS Game-update template, or make full

Postby DST » Sun Feb 14, 2010 3:12 pm

by using the f commands, instead of saveVars. :P
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: RTS Game-update template, or make full

Postby Bee-Ant » Sun Feb 14, 2010 4:14 pm

DST wrote:by using the f commands, instead of saveVars. :P

Hush hush hush...
Dont spread it out :evil:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest