Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 31

Author Topic: Proceedurally Generated RTS  (Read 56961 times)

Draco18s

  • Bay Watcher
    • View Profile
Proceedurally Generated RTS
« on: January 07, 2011, 09:43:04 pm »

So as a result of some interesting posts in another thread I threw together this little doodad to see how viable and simple procedurally generated RTS units might be.

Turns out: not too hard at all.  Took about an hour (including clicking and writing down stats for comparison and tweaking of the formula).

Speed and range are in pixels, unit is not scaled appropriately, but range circles are the size expected for a battle field to be no larger than the flash application itself (which is currently default: 550x400) as to avoid scrolling.  100+ range should be pretty huge.  Reload time is in seconds.  So each shot is pre RoF seconds, each burst doing D damage with S shots per burst.  Damage taken would be (shot damage - target armor) with some minimum value.
Logged

winner

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #1 on: January 07, 2011, 09:58:49 pm »

nice, how about codeing a small game to try them out?
Logged
The great game of Warlocks!

Draco18s

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #2 on: January 07, 2011, 10:52:43 pm »

nice, how about codeing a small game to try them out?

Working on it.
First up is to generate 2 units, spawn 1 of each on the Field o' Battle, add some simple attack logic (find a unit within 2*Range -> engage and attack, else if being fired on -> engage and attack, else move towards the center), and see what happens.

So far it gens two units and I can independently regenerate either one.
Logged

winner

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #3 on: January 07, 2011, 11:10:32 pm »

exellent :D you don't even need to bother with the ai yet, you can have both manually controlled to start with.
Logged
The great game of Warlocks!

Draco18s

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #4 on: January 08, 2011, 12:52:24 am »

There needs to be some AI.  Telling units what to do requires that the AI move towards a location and fire on targets.  It's far easier to spawn 1 unit and tell it to target the other.

In any case, some garbage collection issues aside:

One on One Deathmatch

(Garbage collection: apparently a null object can still have an X and Y location but not the TakeDamage() function, and if called the flash player throws the error: "cannot access method of a null object reference."  IF ITS NULL, STOP TRYING TO TARGET IT. GOD.  So instead of removing ships, I moved them off the stage and paused the simulation.  Clicking "fight!" again uses a different script to clear out the ships, but some bullets aren't being GC'd right and will flicker off one side.  Was a quick and dirty, throw things at each other, thing, so I'm not worried, I just wanted to get it to a point where it didn't throw debug errors.)
« Last Edit: January 08, 2011, 12:55:28 am by Draco18s »
Logged

Urist McOverlord

  • Bay Watcher
  • [Evil_Genius]
    • View Profile
Re: Proceedurally Generated RTS
« Reply #5 on: January 08, 2011, 12:58:16 am »

Also, if you stop the simulation, you'll have some bullets flying from nowhere where the units used to be.
Logged
Magma: The cause of, and solution to, all life's problems.

If it moves, it wants to kill you. It may not try to, but it wants to.

Draco18s

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #6 on: January 08, 2011, 01:36:23 am »

Like I said, the garbage collection isn't functioning properly.

I'm working on it, but I need to sleep.
Logged

Draco18s

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #7 on: January 08, 2011, 02:07:05 am »

New version up.

I think the GC errors are gone, or at least, not visible.

Also tweaked the procgen formula some.  There was just too many high damage, high shot # ships (50 x4!?) as well as no-hp, no speed, no damage, no shot, no range ships (an initial rand of 1 or 2 (on a scale of 1-5) left a ship with Nothing Good).  High range ships now have Even More Range plus some extra speed, as they tended to be slow.  Near-0 range ships should still be the fastest though.

I'll probably have to scrap and start over tomorrow.  The formula isn't letting enough diversity through while curbing good-good-good-"so what if I don't have range?" types.

Of course, in an actual game, there's the build cost to worry about too, and I plan on that being a function of damage + armor.  So a low range unit with high damage will be more expensive than several lower-damage, but higher-range units.
Logged

Omegastick

  • Bay Watcher
  • Crazy musician man
    • View Profile
Re: Proceedurally Generated RTS
« Reply #8 on: January 08, 2011, 08:00:51 am »

I find that the winner is pretty much determinable by doing damage+HP and seeing who has the higher number, that is the winner. Range is entirely useless and I've had one pretty much unbeatable guy for about five minutes of constant battling and changing the loser simply because he has HP 500 and damage 50x8.

So, yeah, it needs some balancing, but other than that it's coming along well.
Logged
I make music under the name Flag Red, check me out:
Soundcloud
Youtube
Facebook

lemon10

  • Bay Watcher
  • Citrus Master
    • View Profile
Re: Proceedurally Generated RTS
« Reply #9 on: January 08, 2011, 08:04:57 am »

Yeah, some of the dudes have pretty insane damage. But its pretty cool, as it is range is pretty useless ya, unless your dude has both a better range and a better speed, then it does nothing (and if you do then then you can get some extra shots off before it gets to the edge). Also, this would be cooler with more dudes per side (although i already know that you are planning that already).
Logged
And with a mighty leap, the evil Conservative flies through the window, escaping our heroes once again!
Because the solution to not being able to control your dakka is MOAR DAKKA.

That's it. We've finally crossed over and become the nation of Da Orky Boyz.

Draco18s

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #10 on: January 08, 2011, 09:42:20 am »

Posted a wrong link last night, durp.  This is the new one.

I know there's still problems with the balance (high damage + high HP is pretty common) but I said I'd have to re-write the code anyway.

And more dudes is the task for this morning.
Logged

winner

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #11 on: January 08, 2011, 11:51:28 am »

once I got a guy with range and speed high enough comparatively that he could just keep backing up and shooting
« Last Edit: January 08, 2011, 11:53:25 am by winner »
Logged
The great game of Warlocks!

Draco18s

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #12 on: January 08, 2011, 12:35:43 pm »

once I got a guy with range and speed high enough comparatively that he could just keep backing up and shooting

Yup.  It's kiting its targets to use its range and speed to its advantage.

Anyway, new version is progressing slowly.  I've got a new formula for units and a new stat (armor piercing) as low-damage units were unable to hurt tanks at all.

Problem now is getting a group of them to behave properly.  Sometimes they refuse to change targets.
Logged

winner

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #13 on: January 08, 2011, 12:47:50 pm »

what language are you using?
Logged
The great game of Warlocks!

Draco18s

  • Bay Watcher
    • View Profile
Re: Proceedurally Generated RTS
« Reply #14 on: January 08, 2011, 12:55:56 pm »

what language are you using?

ActionScript 3.

AS has this nasty habit of leaving references to objects around.  So if unit1 and unit3 are targeting unit2, if unit2 dies, both unit1 and unit3 have a reference to unit2 which needs to be set to null.  Removing unit2 from the stage doesn't make the reference null!  So I can't just check "if target == null" I  have to check that it's null, and it's hitpoints are positive, and that it's still on the stage.

unit2 also has a reference back to both unit1 and unit3, so if either of those die, I've got to clear that out as well.

Anyway, I've almost got a mob version.

Mobs!  The kiting behavior is jerky, but it works. :D
« Last Edit: January 08, 2011, 01:02:27 pm by Draco18s »
Logged
Pages: [1] 2 3 ... 31