yangamedev

LD26

Day 0: Revving the Engine

Great seeing all the activity! To fully enjoy this post, open this in a new tab so we can enjoy it together. It’s time for a premature victory lap. Volume warning!

http://www.youtube.com/watch?v=GcTStCOKXGI#t=27s

While we sort out what kind of game we want to make, I’m free to explore the tech before I’m crushed by the weight of demands. RTS is terrific for multiplayer re: input, you’re sending commands instead of keyboard input. And not to mention no collision gargle. So I’d be remiss if I didn’t take a shot.

I gambled on Player.IO as I’m not into hosting a Haxe remoting server and I figure Flash-only-networking for this compo is ok. Yesterday I didn’t know if I could get Player.IO working in Haxe. Today I know!

shipit

 

I long for the day when I’m free to send bullet data across the network every 16 milliseconds. But alas, I’ll spend some time bringing down the 130+kb/s transfer.  

BTW The bullets on the other clients are stalled because they don’t know they’ve been told to fire — I can send prefabs across the network but not commands like “go here, this fast” just yet. RPC’s to the rescue!

Finally, here’s the game code so far, all in one file: CTF.hx: http://pastebin.com/MD6fdZGe

CTF is the class that defines and spawns prefabs like with Unity. It does this by creating Actors (GameObjects), and adding shared Behaviours between them. Once defined, we’re free to spawn them however we like, mixing and matching behaviours as needed for gameplay.

You can see it inherits the Engine class, I don’t want to even call it an engine, as that implies a huge turkey that you have to stuff in your mouth all at once (UDK, Unity, etc.). With a framework, I’m free to nibble or scarf as I choose. Having this class makes creating new games all the quicker because the boilerplate is solved up front, but can be modified per game with overrides to add new components or just replaced completely, see?: http://pastebin.com/Wz3eh23f.

My strategy this compo: keep the tech clean, funnel in art, stumble over game ideas by accident, be able to punch out a game in 60 seconds …if… when the inevitable Swordfish-hacking-scenario erupts. [IMAGE CENSORED]

Stay ready people!

LD27

Strategy vs. Tactics

In researching this compo the criticism of RTS’ is that they are more like Real Time Tactics — a faster mouse-clicker and better micro-manager wins the prize. There’s merit to that, but real-life involves strategizing over the long-term, not seeing immediate results, making very few simple commands in response to changing conditions.

Strategy involves long-term planning and a divorcing of oneself from the various tactical outcomes. In business and the military, a chain of command is established so the top-level General or CEO can implement their strategy through use of simplistic commands to complicated people. George W. Bush said “let’s go get Iraq!” and the generals said to their sub-commanders: “ok, mobilize our infantry and artillery to the southern regions”, and so on, all the way down to the soldiers who need to pack their toothbrush.

This is more the scale I’m interested in, and what becomes apparent is how much I don’t want to click on things. “Guh, just go get Iraq!” I want to say.

actual_framerate

I’d make it a .gif but this is the actual framerate

 

My goal is to free the player from micro-managing units and simply get on with the strategy of winning. I love in Majesty how you have indirect control by planting Quest Flags with reward money, which is collected by any units that feel it’s worth the money to take up the task.

But there’s downsides to all-strategy-plus-autonomous-AI: I remember a big criticism of Dungeon Siege was that the game pretty much plays itself. With a handful of characters that’s not really fun…you want to feel challenged. But with 80 units? That’s more Homeworld territory, and ideally I’d judge my success on how few mouse-clicks and keystrokes you need to win.

Current progress on “Counterstrike RTS” milestone:

  • AI decision tree on all units: Idle vs. Hunt states, all units attack closest on sight
  • LOS for AI based on world collision, enter Hunt state on acquiring target
  • Fog of War LOS: Can only see enemies on screen that 1 or more friendlies can see
  • Order issuing: “Go go go” and “Hold this position” — individual or group

 

 

Out of Sight

Last time I showed off my 162-unit RTS at a stunning 5 seconds per frame. Not FPS, that’s SPF. And that ain’t good.

Clearly it’s not scaling well as I crank up the units. What we’ve got here is your classic O(n^2) problem between entities. There’s a bevy of literature out there regarding space-division in a proper manner for these types of issues, but I had an idea.

The game literature out there deals with LOS for terrain but not for dynamic entities. I decided to roll my own: introducing the Visibility Matrix(tm):

darkness

Anybody there? “None.” Seems legit, Bob you’re on point.

 

You’re blue, the enemy is red but hidden (left the text on to show their position). I turned off the world so it can read better, but remember there’s a slab in the middle of the world blocking each other’s view. Each cell refers to the visibility between the two actors. The “oo”‘s mean “can see”…the “–“‘s mean “can’t see”.

 

during

Good ol’ Bob. Never complained about recon.

 

Visibility between Blue:7 and Red:0-5 has been established in the Visibility Matrix, and the units can query these values rather than generate it on their own expensively.

What makes this faster is these vis checks are time-sliced, i.e. only a few of them are updated every frame instead of the O(n^2) nightmare from the last post. To achieve this we simply walk through the matrix left->right, top->bottom, updating each cell with a fresh LOS.

How many cells do we update each frame? Well if there’s n units, then the Visibility Matrix only needs n * (n – 1) / 2 cells, as visibility is commutative and we assume each actor can see themselves. Best of all we  guarantee that no enemy can see you before you see them, so no ambushes just a little lag.

Finally if we demand a maximum response time for the unit in frames, then the number of checks performed each frame to guarantee an update = max frames / # cells. At 60fps and a 1 second response time your calls are spread out over 60 frames.

 

pincers

Here’s the same 162 units rocking it out at a smoking 9fps. I’m calling it 10fps, that’s a 50x framerate increase.

Where this really takes off is I can store more than just vis data in there — distance calculations, health differential, whose turn it is to do the dishes, whatever I’d normally have to generate at runtime about information for each pair of actors.

Once I move all these calculations to the server I hope to throttle up a gear in terms of units. But maybe I should make a game first…

Comments

MiniBobbo
25. Jul 2013 · 14:06 UTC
It has been interesting seeing how you tackled this problem. It is one I’ve been pondering also. I like your implementation and might have to steal the basics.

Can’t sleep. Game will eat me.

The game demands I post progress.

A* pathfinding, timesliced just like the LOS calculations, steering behaviours take it on home. It’s quite a thing seeing these mannequins finally hop to life. I’ve left collision on them so it’s a bit of a canadian standoff at the moment. Once flocking behaviours are enabled I’ll be taking off the inter-actor collision in preparation for moving the logic to the server.

canadian_standoff

After literally days of waiting around, Red Team jumps into action.

Are you sick of that screenshot? Me too. Decided to make the map tileable so I can build small prefabs and sew them together:

gits_n_shiggles

 

Whether it’s an arena-shooter, RTS map or roguelike, I’m fairly confident I can make levels quicker this way. And the best part is that all instances of the same tile share the exact same pathfinding & terrain-LOS data!

Transitions are the pain in this solution though — although AI will traverse one side of the world to the other by using the tiles and pre-generated paths as stepping stones, but LOS edge-cases are keeping me up.

whatamess

What a ridiculous mess this has become. I love it.

 

Attention Artists, Soundists and Musicists: Open 48 Hour Jam this Weekend!

Are you on the sidelines for 7dRTS, wanting to get some time on the field? How does the idea of an Open Game strike you — the Assemblee compo but in reverse?

Last week I mentioned re-skinning of my game as I’ll be defaulting to Oryx’s masterpieces with Ogmo as the level format and the typical FruityLoops/Bfxr accompaniment. Once it’s made, it’s as easy as swapping out the art/sound and yours in, provided you stick to the format. I see musicians offering people their work for credit, but I’m too busy to lurk through soundcloud, let’s do it in reverse.

I figure I let you set the direction based on 3 main concepts:

  1. CS Strat: dozens of on-screen units, weapon types, props, level skins, units can level up a la XCOM. Ogmo maps. Can either go serious or make it like “Backyard Sports” — kids running around in the backyard (“I shot you!”…”Uh uh I have Class 4 Armor on”) is a cute idea. Will need a Mom character as a referee. Definitely orange slices at halftime.
  2. Raid Commander: Roguelike with dozens of units, like a WoW raid that you control…heroes/enemies/world tiles/props/bosses/projectiles. Still liking a silly theme with this one, I imagine a lot of Leroy Jenkins and Guild Drama, Ninja’ing and PUG-awfulness.
  3. Gamedev RTS: I’m dying to make this one…heroes are Artists, Coders, Musicians, Designers…fight off Bugs, Reviewers, Fanboys, Publishers, Pirates, Cloners. Was hoping to make it a 4-player base-building exercise where you build up your game and slay foes for cash…but that’s too ambitious. A roguelike where you start as a solo indie and level up your skills and staff to defeat greater “foes” (projects) sounds more concrete.

It occurred to me this build could be a showpiece for people’s content, selectable in the frontend as a visual or audible “skin” with their name featured. If any of the above game ideas inspire you to reskin the linked sprites or come up with an audio treatment then let me know in the comments.

I plan to do a lot of this in between now and the next LD48 (and beyond!), so there’s no hurry. And I’m not in competition with anyone here (that much is clear, yikes) so why not co-operate in an open and detached fashion? I won’t be waiting around for anyone’s art/sound, but it’s nothing to swap Oryx’s out and yours in.

If you want to practice and 7dRTS has gotten your blood up, here’s your chance! If not, feel free to steal these ideas, that’s all they are.

 

Recursive Level Development

Gearing up for final content push, getting the maps setup. Next couple of days are going to be a panic so I had to get this solid. The idea is that this map I’ve been staring at all week can become a Tile in the larger world. I already spawned a bunch of them but the pathfinding wouldn’t sync up and I wasn’t about to make a colossal A* matrix for whatever map size I decide.

firsttile

Tile-ification: Marked exits as Doors with their respective direction normals (dx, dy)

 

This tile already has a method for constructing the A* map, so I wanted a way to allow units to seamlessly travel between any two points on the map. That’s going to be brutal for long distances, and I don’t want to be limited in this regard. Why? Because I guess I just don’t feel like it…and that’s why I don’t finish LD48’s :(

Before I could crap all over myself I realized that if I arrange these tiles on a grid of their own like cards on a table, I realized I could use the pathfinder to solve the world path (macro, or inter-tile path as opposed to tile path which is micro, or intra-tile path). So I hacked a fake Ogmo file and modified the loading code to generate tiles.

worldmap

Rigging the level loader and pathfinder to build worlds from building blocks is the smartest wheel-reinvention I’ve yet to perform.

 

Since A* assumes adjacency means walkability, this system would allow world pathing across adjacent tiles even if there was no door. Sticking this limitation on the designer is not the end of the world, and the pathfinder could be subclassed to be door-aware.

So here’s where the recursion comes in: why don’t I just screengrab each of the tiles and allow myself to build world maps in Ogmo?

yo dawg

Since the world map tiles are image captures, they’ll need to be updated if the referred tile gets changed. Otherwise, I’m ready to rock.

I could essentially build a GTA-sized map with layers upon layers of these things. I got no sleep.

Finally there’s the pathfinding. What’s great about using these pre-baked tiles is the A* map doesn’t change. And the paths between doors can be pre-computed, meaning the traveller is doing no A* work except at the start and end tile destinations. Booya.

choochoo

The units know which tile they want to get to, but they have to ask for directions at each purple square. The directions are accurate…occasionally.

I thought I was a genius, but I cracked open Game Programming Gems and there it is. I will create the patent and sue myself, see you later suckers I’m rich.

Say goodbye to the beanie babies, I’m piling Oryx art in now that I can create some interesting roguelike levels.

 

Comments

27. Jul 2013 · 17:13 UTC
Either you, or I do need to get some sleep 😉 Sorry, have to read that again tomorrow.

Home Stretch

I started 148 hours ago — it went by in a blur but also it feels like I’ve been doing it for a month.

I finally tried my hand at level design, and instead of dreading it it’s actually a lot of fun seeing it pop up in game. I credit all the work I did getting the world structure setup so I can listen to tunes and make a ton of levels.

beforelighting

I’ve got 1000 ideas floating around in my head but I don’t want to miss the basics. I decided to tackle lighting this morning, and it took five minutes:

afterlighting

It’s not the best but it looks better! Plus I can try having each of the bulbs emit light (I’ll just disable pathfinding is that cool?).

Sanojian mentioned: “Could it be that after 30-odd failed games it starts to get easier?” Yes! A ghostyard of abandoned projects on my hard drive has finally shown some value.

title

Little touches like, oh, the frontend are things I pass off while I’m fighting with flocking and hierarchical pathfinding. I just refuse to make another tech-heavy fun-light game. We’ll see how it goes.

Comments

28. Jul 2013 · 15:48 UTC
A hood-throwing-arrow guy ? Need it :p

Good luck, the game look nice, I’m looking forward playing it :)

Under 12 hours to go

My fingertips are numb I’ve typed so much.

You folks like dynamic lights on your bullets? Visibility matrix debug output? Magenta collision boxes? Me too!

letshangout

 

I’ve been desperately trying to solve inter-tile collision, rewriting it saved the day finally.

So I got my train of guys going, you can go into train mode or group (huddle) mode, formations don’t matter in tight spaces so I’m going to focus more on the AI side of things.

Was having a great time doing loops until they’d stop all of a sudden. Couldn’t tell why.

yougottabekiddingme

 

They now descend on the poor guy with zeal, but then forget to keep following me. I’m thinking of just leaving them there for the next victim.

I present Raid

finaltitle

 

https://www.dropbox.com/s/megmeycl7jsbq43/raid.swf

 

I wanted to explore strategy without micro-managing, the idea was that you’d set the AI’s behaviours as in Dragon Age and it should run itself. I had the full gamut of selectable units and the like, but as I developed it I found it too cumbersome the more party members got involved. So I dared myself to strip it to the core.

WASD keys to move, Right mouse to shoot, that’s all that’s needed. When that’s all you have, what strategy will you employ?

yarrrr

 

I’m not happy with the game but I’m satisfied…I had to cull a lot back due to time, cpu, and brain energy (including my precious pathfinding nooooo). It’s nowhere near where I wanted it, but this is my first full game in Haxe with a home-rolled framework and I get to wake up to this game that’s begging for all the features I promised it! :)

I’ve learned a ton for the next LD48 — that tech is nice but a game idea is the balloon that floats you over the chasm. Too often I jump off the cliff trying to build the plane before I hit bottom. Content isn’t something that can wait until the end, I’ll learn that eventually.

Thanks sorceress for putting this together, much appreciated.

Once I’ve exhausted all the ways to fail, only success will remain

yougotmethere

 

(sorry Ludipe, but imitation is flattery)

 

Code: Haxe/OpenFL, FlashDevelop — Flash primary platform for networking (Player.IO), Ouya for shits n giggles

Libraries: enhanced Haxe MIDI ported to OpenFL, custom component framework (i’ll decide and share at kickoff)

Art: Paint.NET, Bamboo tablet, 5th-grade art talent

Sound: FruityLoops & surprise instruments, bfxr, Audacity

Tools: Ogmo

Please. Someone make a game of this.

http://youtu.be/LlvUepMa31o. It demands a platformer/forever runner treatment.

The animation was created with “The Music Animation Machine”: http://musanim.com/

I was going to sit on this idea, I’m sure it’s nothing new and something kickass could come of it.

Hot damn if you don’t make it I will!

Music synchronization!

ataribeauty

Click to play —  WASD keys, gotta touch ’em all!

 

So this was fun: I wanted to see if I could get some reasonable level of audio synchronization, getting pulse events from a click track played in sync with the audio (a la video I posted previously). Blew half the last LD doing this so I was determined to get it working or let it go, man.

  1. Load a track into your favourite audio editor
  2. Painstakingly tap out the midi events for the notes you desire (better yet, convert existing project to midi and go)
  3. Save out to midi, load it up and play in sync with audio track

Included the source (minus track I’m afraid), which includes flow, my announced OpenFL library code 

Good luck everyone!

AHHHHHHH IMPETUS!!

impetus

 

I WILL NOT RELENT

I WILL NOT RELENT

I WILL NOT RELENT

I AM DRIVEN!

15 TIMES MORE EXCITING!!!!ELEVENTY

booya

We’ve found ourselves a sub-theme folks

Halfway there!

title

I always ignore the title screen, not this time

game1

A barren wasteland where deliveries make society function

game2

The power goes out intermittently…almost in time to the music…

lose

Two different end screens I must be mad

My rule by halftime was that no feature could be improved in spite of another — and most importantly it had to be a game of some sort, and I achieved that once I forgot I was testing and started desperately reaching for that 10th delivery. Mission accomplished!

It’s not much of a game but it’s now ready for the pages of scribbled ideas I’ve painfully ignored. When I get up tomorrow it’ll be a full day of content madness!

Playable progress so far

It’s Party Time Y’all!

shot1

Click to play! Right now!

No time for Post Mortems,

Cause we are the champions…

…til they vote!!!

Thanks for hosting, LD! Had a great time on this one!

I’m having more fun playing GTA V than coding in C++

There. I said it. Enjoy your jam.

For the record I got a good little turn-based city-sim/roguelike going (who knows which game UI I just ripped off?), it’s just not going to happen this weekend.

grand

theft

 honor