Jump to content


Photo

Awesome 2d Rts Engine (similar To Warcraft/strcft)


  • Please log in to reply
106 replies to this topic

#31 stumlehb

stumlehb

    GMC Member

  • GMC Member
  • 200 posts

Posted 02 February 2010 - 12:59 AM

stumlehb - i have a feeling that you copy and pasted units from the old engine version (02.7) to the new engine (11.0).
the problem is the units in the new version have more new variables than the ones that were in the old one, and some of the new hud elements require those new variables but cannot find them. what you can do to fix these errors is to compare the old create event with the new one and add the missing cariables yourself.

if a im totally of the mark, then can you tell me what to do to recreate these error messages.


I did import them and checked them(hope I didn't miss anything though). I've been having some other error messages related to variables as well. but they seem to happen intermittently. for example it will say that the unit_hp variable for the enemies is not recognized, but I know that it is being used because I was able to kill some of those enemy units, before the error messages pop up for the same kind of unit later.. I'm wondering if it is a game maker bug of some sort, because I have had other random intermittent problems with game maker before.. for example, in another game, certain animations intermittently do not show all frames of animation, even though it shows all of them sometimes..

I'll try making all new objects from the templates again instead of using the imported ones...
  • 0

#32 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 07 February 2010 - 03:36 AM

NEW UPDATE!!

see first post for details
  • 0

#33 Zargy

Zargy

    GMC Member

  • GMC Member
  • 222 posts
  • Version:GM:Studio

Posted 08 February 2010 - 11:31 PM

Very nice! I like it!
  • 0

#34 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 09 February 2010 - 09:05 AM

if there is anything specific that you would like to know how to add to my engine please ask so i can help you
  • 0

#35 mortalpico

mortalpico

    GMC Member

  • New Member
  • 556 posts

Posted 10 February 2010 - 11:28 PM

Omg , the new engine is more way better!

I have a problem...

How can i make my Unit morph or Evolve into a new form with new skills?

Example:

First Form:Larva
Must Morph into Egg after 5 minutes...
Second Form:Creeps
And when i want it to build something it must morph into the building i want it to be!

How can i do this?
  • 0

#36 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 11 February 2010 - 02:57 AM

for the first part use an alarm

*create*
alarm[7] = 5mins;

*alarm[7]*
im_pro = instance_create(x,y,obj_creep);
im_pro.selected = true;
selected = false;
instance_destroy();

for the next part just make it so when the creep builds a building it gets destroyed, and for the building:
*step*
if is_built = false
{
build_progress += 1(or a larger amount if you want it to be built faster)
}
  • 0

#37 mortalpico

mortalpico

    GMC Member

  • New Member
  • 556 posts

Posted 11 February 2010 - 06:39 AM

Oh , thanks rude guss!

Finally fixed that thing!
  • 0

#38 Music Minion

Music Minion

    GMC Member

  • New Member
  • 94 posts

Posted 23 February 2010 - 11:12 PM

This is a very impressive engine. the design is genius and the fact that you did this while able to use an unregistered version of gamemaker without the pathfinding functions is amazing. My only complaint is you added a comment /*var*/ every time there was a variable and since my computer is older it slowed my keyboard for typing in different things =( But other than that I give it a 10/10
  • 0

#39 Snopel

Snopel

    GMC Member

  • New Member
  • 61 posts

Posted 25 August 2010 - 05:16 PM

i know you probably don't go and check the comments anymore but if you do i'm haveing a problem with one of the codes when i try to build a house

ERROR in
action number 1
of Mouse Event for Left Pressed
for object Obj_Button_House:

Error in code at line 7:
   if obj_HUD.target.is_built = true
                     ^
at position 20: Unknown variable is_built

also if you could explain how to make it so when say i press the build worker button it subtracts 10 res3 from the stockpile and could you make a readme tutorial to better explain how to do everything

Edited by Snopel, 25 August 2010 - 08:57 PM.

  • 0

#40 stumlehb

stumlehb

    GMC Member

  • GMC Member
  • 200 posts

Posted 01 September 2010 - 12:22 AM

also if you could explain how to make it so when say i press the build worker button it subtracts 10 res3 from the stockpile and could you make a readme tutorial to better explain how to do everything



add stuff in the obj_button_worker 'left pressed' event. here is an example of a button that builds a monk in my game and

//clicking effect - start
spr_state = 1;
alarm[0] = 1;
//clicking effect - end

//your own code to what happens when you press this button
if obj_building_template.make_progress = 0
{

if obj_resource_manager.res1 >= 100
{
obj_resource_manager.res1 -= 100;


if obj_HUD.target.is_built = true
{
    obj_HUD.target.make_power = 20;
    obj_HUD.target.make_object = obj_unit_monk;
    obj_HUD.target.make_time = true;
}
}
}

here it is again with a different unit:
//your own code to what happens when you press this button
if obj_building_template.make_progress = 0
{

if obj_resource_manager.res2 >= 100 && obj_resource_manager.res3 >= 10
{
obj_resource_manager.res2 -= 100;


if obj_HUD.target.is_built = true
{
    obj_HUD.target.make_power = 20;
    obj_HUD.target.make_object = obj_unit_bar2;
    obj_HUD.target.make_time = true;
}
}
}




not sure about your is_built problem.. how do you know what the target of the hud is? I'm guessing its not what you think it is at that moment.. but maybe you just need to add an is_built variable somewhere?

Edited by stumlehb, 01 September 2010 - 12:24 AM.

  • 0

#41 sub

sub

    EVIL GENIUS

  • GMC Member
  • 1889 posts
  • Version:GM6

Posted 01 September 2010 - 03:05 AM

for example it will say that the unit_hp variable for the enemies is not recognized, but I know that it is being used because I was able to kill some of those enemy units, before the error messages pop up for the same kind of unit later..

sounds like the unit was just destroyed in the last (or current) step. this problem often happens in a draw event for a unit HUD (or tracking a dead/destroyed target), since the draw event happens BEFORE the step event, if the enemy was killed (object destroyed) the code is still trying to reference that object.

i usually do something like this for drawing a HUD or referencing targeted units..

if not instance_exists(target) exit;
draw_text(x,y,target.hp);




to add 'height' in to your game introduce a z variable for units and structures. (z=1 is ground level, z=3 is 2 pixels above ground level, etc)

to see how this works,
just make a small demo engine thing, add 1 object, give it x,y values and give it a z value of 1 in the create event. add a keypress event for up and down.

up code = z+=1;
down code = if z>0 z-=1;

in draw event add this;
draw_sprite(sprite,0,x,y-z);
draw sprite_ext(sprite,0,x,y,image_xscale,image_yscale,image_angle,c_black,0.2);

^ that needs registered mode.. to work around that, just make a black shadow sprite and draw that (without using the alpha and angle setting)

Edited by sub, 01 September 2010 - 03:30 AM.

  • 0

#42 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 01 September 2010 - 01:09 PM

i know you probably don't go and check the comments anymore but if you do i'm haveing a problem with one of the codes when i try to build a house

ERROR in
action number 1
of Mouse Event for Left Pressed
for object Obj_Button_House:

Error in code at line 7:
   if obj_HUD.target.is_built = true
                     ^
at position 20: Unknown variable is_built

also if you could explain how to make it so when say i press the build worker button it subtracts 10 res3 from the stockpile and could you make a readme tutorial to better explain how to do everything


WOW! i rarely check this thread (about 6 months since last time i checked). It can be quite difficult to understand how to do things, most things can be achieved by duplicating a specific object and then modifying variables in the create event, to make it what you want. I wont have a written help file/instuctions until most of the bugs are fixed in the engine (enough to run smoothly). If you want to know how to do something please keep asking questions.

By the way, you obviously didnt find it too easy to use, but do you have any other comments on the engine, or suggestions?

EDIT:
@sub, thanks for your help mate.
AND i also see your making an rts too? is it in response to my poor rts engine? if so, BRING IT ON! and let the best rts win! :D

Edited by rude guss, 01 September 2010 - 01:14 PM.

  • 0

#43 sub

sub

    EVIL GENIUS

  • GMC Member
  • 1889 posts
  • Version:GM6

Posted 07 September 2010 - 10:41 PM

you're welcome. i'm just a fan of the genre. also a friend has been using your rts engine so i thought i'd drop by.
  • 0

#44 Snopel

Snopel

    GMC Member

  • New Member
  • 61 posts

Posted 24 September 2010 - 08:54 PM

ok i got my other problem fixed but i just want to know how to make something like a watchtower that does'nt move but it shoots a ranged attack at enemies
  • 0

#45 stumlehb

stumlehb

    GMC Member

  • GMC Member
  • 200 posts

Posted 25 September 2010 - 05:35 AM

ok i got my other problem fixed but i just want to know how to make something like a watchtower that does'nt move but it shoots a ranged attack at enemies


Make a regular unit, but set them up with a ranged attack in the create event code, and set their movement speed to 0. they will stay in one spot and shoot enemies in any direction. you can add different animated attacks for each direction of attack, so a cannon can fire smoke out of the left window when shooting left, etc.

you may need to adjust something in the step event so that they always attack the nearest target rather than always attacking the first one they've seen. It was easy to change the enemy ai to attack nearest instead of attacking first seen, by removing one line in the step event, so I imagine it should be similar in the regular units step event. This is the line to remove from the enemy units step event in order to make them attack nearest(so that they switch to a closer target when their first target runs away):
if able_to_move = false && state = 0 && attack_target = 99 //setting target if doing nothing and enemy is close

If you want the tower to be buildable, you might need to mess with and look into the building templates as well.. you might be able to transfer some of the building code to the regular unit. or maybe you could transfer the attack code from the regular units into a copy of a building template.

Edited by stumlehb, 25 September 2010 - 05:42 AM.

  • 0

#46 thechronicler

thechronicler

    GMC Member

  • New Member
  • 39 posts

Posted 30 October 2010 - 08:25 AM

This is awsome material ::lmao::
  • 0

#47 AwkwardAvenger

AwkwardAvenger

    GMC Member

  • New Member
  • 14 posts

Posted 22 December 2010 - 05:04 AM

Hey guys, I've been working on an rts for a little while now with this system and its going great! Just a question though... You said they're all pretty modular, well I've completely overhauled the enemy ai... but one thing i'm clueless to changing is the movement system... Mine is topdown so i want to change the 8 directions movement system to something along the lines of image_angle = point_direction and point_direction = the area they're moving to... But i have no idea where to make the changes...any help?
  • 0

#48 stumlehb

stumlehb

    GMC Member

  • GMC Member
  • 200 posts

Posted 23 December 2010 - 03:56 AM

Hey guys, I've been working on an rts for a little while now with this system and its going great! Just a question though... You said they're all pretty modular, well I've completely overhauled the enemy ai... but one thing i'm clueless to changing is the movement system... Mine is topdown so i want to change the 8 directions movement system to something along the lines of image_angle = point_direction and point_direction = the area they're moving to... But i have no idea where to make the changes...any help?


I would guess that you could put that in the draw event for each unit, but you'd want to change or remove the stuff that looks like this:
if direction > 247 && direction < 292 {draw_sprite(state_anim[state,0],-1,x,y);}
if direction > 292 && direction < 332 {draw_sprite(state_anim[state,1],-1,x,y);}
if (direction > 332 && direction < 360) or (direction >= 0 && direction < 22) {draw_sprite(state_anim[state,2],-1,x,y);}
if direction > 22 && direction < 67 {draw_sprite(state_anim[state,3],-1,x,y);}
if direction > 67 && direction < 112 {draw_sprite(state_anim[state,4],-1,x,y);}
if direction > 112 && direction < 157 {draw_sprite(state_anim[state,5],-1,x,y);}
if direction > 157 && direction < 202 {draw_sprite(state_anim[state,6],-1,x,y);}
if direction > 202 && direction < 247 {draw_sprite(state_anim[state,7],-1,x,y);}

You might also want to change the stuff in the create event for each unit , where it says:
/* initializing sprites */


edit:

I would have guessed that 'movement system' would deal with things like potential step vs grid based movement, which would be in the step events of each unit.

Edited by stumlehb, 23 December 2010 - 04:02 AM.

  • 0

#49 Schyler

Schyler

    Noskcirderf Derf

  • GMC Member
  • 2678 posts
  • Version:GM:Studio

Posted 23 December 2010 - 04:45 AM

The people look like Minecraft.
  • 0

#50 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 25 December 2010 - 12:19 AM

The people look like Minecraft.


Hahaha, If anything, that guy copied me!! I made those graphics before minecraft was even started!! Im pretty sure that this thread is nearly 2 years old.

@AwkwardAvenger - About how you want to change the graphics, stumlehb is pretty much right.
  • 0

#51 Kunarian

Kunarian

    GMC Member

  • New Member
  • 2 posts

Posted 13 March 2011 - 03:52 PM

Hey dude a few questions:

1. Where should I put death animations
2. Could you explain how I could make ages
3. Could you explain how I could make upgrades change the look and stats of units
4. Maybe throw in an explanation on how to add in factions with their own unique units

Sorry if I'm asking a tad too much, I need a bit of help.

Thanks for any help you can give.

BTW great engine almost perfect, couldn't find another example of coding prowess.
  • 0

#52 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 13 March 2011 - 04:32 PM

Hey dude a few questions:

1. Where should I put death animations
2. Could you explain how I could make ages
3. Could you explain how I could make upgrades change the look and stats of units
4. Maybe throw in an explanation on how to add in factions with their own unique units

Sorry if I'm asking a tad too much, I need a bit of help.

Thanks for any help you can give.

BTW great engine almost perfect, couldn't find another example of coding prowess.


1.i havent done that yet, so theres no place to put them yet.
2.see below, cos i think that might answer this question
3.when the upgrade is complete, go through all the units and buildings, delete them and replace them with new buildings and units.
4.just make it so units can only build particular buildings, which have 1 factions units.
eg. faction1 peon can only build fac_1_baracks, and that building can only build fac_1_marines
whereas a faction2 peon can only build fac_2_baracks, and that building can only build unit_zerglings and unit_drones.
  • 0

#53 Kunarian

Kunarian

    GMC Member

  • New Member
  • 2 posts

Posted 13 March 2011 - 04:38 PM

thanks a lot!
BTW when you answered the upgrading question did you mean simply have age_1_barracks deleted and age_2_barracks placed where it was? same for units.
  • 0

#54 stumlehb

stumlehb

    GMC Member

  • GMC Member
  • 200 posts

Posted 13 March 2011 - 06:14 PM


1. Where should I put death animations
4. Maybe throw in an explanation on how to add in factions with their own unique units

1.i havent done that yet, so theres no place to put them yet.
4.just make it so units can only build particular buildings, which have 1 factions units.
eg. faction1 peon can only build fac_1_baracks, and that building can only build fac_1_marines
whereas a faction2 peon can only build fac_2_baracks, and that building can only build unit_zerglings and unit_drones.


1. I've successfully put some death animations in this engine but haven't worked the bugs out yet.
In the create event of the unit I have something like this:

/*var*/ state_anim[7,0] = spr_man_downright_death; // for death
/*var*/ state_anim[7,1] = spr_man_downright_death;
/*var*/ state_anim[7,2] = spr_man_upright_death;
/*var*/ state_anim[7,3] = spr_man_upright_death;
/*var*/ state_anim[7,4] = spr_man_upleft_death;
/*var*/ state_anim[7,5] = spr_man_upleft_death;
/*var*/ state_anim[7,6] = spr_man_downleft_death;
/*var*/ state_anim[7,7] = spr_man_downleft_death;

/*var*/ state_anim[8,0] = spr_man_downright_dead; // for deadness
/*var*/ state_anim[8,1] = spr_man_downright_dead;
/*var*/ state_anim[8,2] = spr_man_upright_dead;
/*var*/ state_anim[8,3] = spr_man_upright_dead;
/*var*/ state_anim[8,4] = spr_man_upleft_dead;
/*var*/ state_anim[8,5] = spr_man_upleft_dead;
/*var*/ state_anim[8,6] = spr_man_downleft_dead;
/*var*/ state_anim[8,7] = spr_man_downleft_dead;


then, in the step event, I have this somewhere near the end(although I probably do more than I need to here):

if unit_hp <= 0
{
ally_units = obj_nothing;
attacking = false;
gathering = false;
able_to_move = false;
can_gather = false;
can_attack = false;
ispeon = false;
attack_mode = false;
state = 7;
image_speed = .5;
if state = 7 && image_index = gath_spr_length
{
state = 8;
image_speed = 1;
if state = 8 && image_index = gath_spr_length
{
instance_destroy();
tmp = instance_create(x,y,obj_unit_body);
tmp.var_direction = direction;
}
if selected = true
{
global.number_of_selected -= 1;
}
}

It seems to work intermittently, but I can't get the dead body to appear facing the correct direction.


4. regarding factions, I'd like to know how to make a computer controlled ally faction which attacks enemy computer controlled units in this engine, but doesn't attack your units, and another one that attacks both enemies and your units.

5. There is some sort of bug, where the number of frames in the sprite selected for a unit(in the drag and drop window) affects the number of frames animated for that unit. For example, if the unit sprite(the one displayed in the map editor) has 10 frames, and the walk animation has 8 frames, the walk animation will play frames 1,2,3,4,5,6,7,8,1,2 and then repeat(which is bad), but the 10 frame attack animation plays all 10 frames and then repeats (which is good). If the unit sprite has 8 frames, the 8 frame walk animation will play all 8 frames and repeat (which is good), but the 10 frame attack animation will only play frames 1,2,3,4,5,6,7,8 and then repeat without ever playing frames 9 & 10(which is bad). So I try to keep the number of frames the same for each state by removing 2 of the attack frames, and making the unit sprite have the same number of frames as the walk and attack animations, and that seems to work, but it would be nice if there was a better way to deal with that.

Edited by stumlehb, 13 March 2011 - 06:20 PM.

  • 0

#55 Snopel

Snopel

    GMC Member

  • New Member
  • 61 posts

Posted 31 March 2011 - 09:57 PM

I have a question. the last thing you said on the first post is that you were going to wait until you release an update. Are you still working on that update?
  • 0

#56 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 11 April 2011 - 02:28 AM

I have a question. the last thing you said on the first post is that you were going to wait until you release an update. Are you still working on that update?


yeah, im still working on that update, but its been an on and off with the progress. It'll be a while before i release it, so you should be fine using the the latest engine.
  • 0

#57 sub

sub

    EVIL GENIUS

  • GMC Member
  • 1889 posts
  • Version:GM6

Posted 21 April 2011 - 01:26 PM

cool this is still going.

are you using a single script to deliver damage to units? ..i throw my death detection in that.

since you make a dead body object there anyway, you could easily throw the death anim and dead body in that same object and strip that whole sequence from the step event entirely. (make the obj in the death script)

i know at this stage it will just annoy you when i say step events are not really needed, but look into it. try alarms and paths. (check out ilimi's curse methods?)

do you know if stumlehb has posted his RPG made with this? (i'll message him also)

i remember seeing this a few months ago and was impressed then.
  • 0

#58 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 28 June 2011 - 05:03 PM

You guys thought this would never come hey?? JUST! RELEASED! AN! UPDATE! i uploaded version 0013.0 of my engine, which include an updated fog of war engine and a queue for building units. More details and picture in the first post. ENJOY!
And don't forget to report bugs/ask me questions!
  • 0

#59 marineman215

marineman215

    GMC Member

  • New Member
  • 148 posts

Posted 28 June 2011 - 06:04 PM

I found a bug! When dragging a selction box: when the mouse moves into the MiniMap on the HUD then the view goes around. I would disable this while selecting

Thanks,
~MarineMan215
  • 0

#60 rude guss

rude guss

    GMC Member

  • GMC Member
  • 236 posts

Posted 29 June 2011 - 01:15 AM

I found a bug! When dragging a selction box: when the mouse moves into the MiniMap on the HUD then the view goes around. I would disable this while selecting

Thanks,
~MarineMan215


Cheers mate
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users