Log In  

Alright. I'm finally getting somewhere with my level code, physics, and... well, I'm still WORKING on my composition stuff, too. But now I'm also starting to work on enemy AI. And here's another spot I'm kind of fresh to.

See, past projects I've worked on include fighting games - which are essentially just really big FSMs, and the AI uses some conditions like player distance or input to determine appropriate responses (some MegaMan bosses do this, too)... and music games, which is really just about lining up targets with precise timing and that's really all there is to it. Making shots doesn't seem any different than making fireballs in SF, either. But making enemy AI for platformer and top-down-adventure games is kind of a different thing; and I could use some guidance - heck, maybe even outright collaboration with.

There's four titles of enemies I'm trying to reasonably replicate here:

200X - a MegaMan knockoff.

Concert of the Damned - something between Zelda II and SotN, maybe a little Shovel Knighty too.

Gentroid - Yet Another Metroid Fangame (there's a good grip of these, it seems - and Cow has the physics/feel to that DOWN! Perhaps I should just step aside...)

...and an as-of-yet-to-be-determined title that's in line with Zelda 1 and/or Gauntlet; maybe a bit Isaacy, but certainly not Isaac. Save for maybe boss influence, we'll see where that goes.

How do some of you do your enemy AI? I know really simple stuff could be handled by my "MakeTarget()" code, but not stuff that depends on terrain contact. "MakeTarget()" is mainly about making basic movement patterns - lateral, vertical, sine-waved values, diagonals, circles or semicircles, that kind of thing.

function maketarget(obj,scr,x,y,xrange or 0,yrange or 0,speed or 0,loop or 0)
--x/y position relative to map
--set sine motions to control
 local movex=2*sqrt(xrange)*speed
 local movey=2*sqrt(yrange)*speed
--reverse direction! 
 if (movex=xrange or movex=-xrange or xrange<0) movex*=-1
 if (movey=yrange or movey=-yrange or yrange<0) movey*=-1
--diagonals or curves
 if loop=1 then
 elseif loop=-1 then
pico-8 platformer adventure ai enemies

P#36764 2017-01-27 04:58


So... I guess what I'm aiming for is a back-calculating method for controlling player movement, via globals. So, let's say I'm wanting a typical jump-to-same-level duration to be 90 frames; and for it to go up 3.5 "tiles" of 8 pixels apiece; with a 0.8x accel/decel rate (gravrate). I define the jumpheight as 28 (pixels) and the jumptime as 45 (ground-to-apex; so half of 90), and then use that to calculate jumpvelocity.

My usual go-to is jumpvel=2sqrt(gravity tiles * gravrate), and then letting the typical gravity accel/decel take over from there. "gravity" is seperate from gravrate, in case I want to disable it (by making it 0) reverse it (by making it -1), or reducing it (making it a decimal, usually between 0.5 and 1).

Also, working on a similar accel/decel for horizontal walk/runspeed... so let's say I'm aiming at 0.3 px/frame to be the max speed (18 pixels a second, or a little over 2 tiles, so you can jump four across, level-to-level)... I still want a 20-frame accel and 10-frame decel delta to that, to give some fluidity to the player's motion, it's not all "everything or nothing." So the actual velocity is like "0.3 - (0.015 * runframes, if less than 20)" and then at release, setting that value to 20 and reducing it 2 at a time so that the calculation still affects the movement speed.
I think I'm losing my mind though, so am I still doing this right? >.>

I'm increasingly forgetting stuff, and when I'm working and calculating, it's interfering with my work - and THEN when I'm off, I'm no longer calculating, and everything's kind of getting messy. Dammit!!

wip platformer physics

P#35112 2017-01-06 17:19


So, election and holiday season both got pretty crazy up until last week. So most of my PICO-dev has been during lunch breaks and to/from work or in little spurts on days off. That said... I probably get about 16-32 sprites, or 4-8 screens of map writing done, maybe a function per toss. That said, a fair number of these can reuse some code I use, which is a good thing; because I can concentrate most of my code into one project, iterate it to working condition, then copypaste and adapt it to other carts. All things considered, I still wish I could've been getting more accomplished by now; maybe it's just impatience talking... I see a fair number of good carts being pushed, maybe that's the thing.

These include Concert of the Damned (really, I've only reworked the maps so far), 200x (pictured above... if 20xx was the proc-gen response to MegaMan X, this is me trying to do that with MegaMan Classic or Xtreme, if it were meshed with MM9's Endless Attack mode), Gentroid (same approach but more Classic Metroid inspired), a simply-titled "PlayThing" (just an experiment for learning various things in PICO-8; where I'm currently focusing my code for the time being), "Race to Riches" (a simple speed platformer inspired by David Newton's "Treasure Tower"), and "Shirley Nutt" (a nut-collecting demake of Sonic, but where you can shoot nuts forward to control space ahead of you, and with none of the asinine plot or buddies or loop-de-loops, or even bosses).

Matter of fact, I have two experimental "Playthings." XD I started one on my PC, and a second, different-but-similar sort of one on my PocketCHIP. There's some ground they have in common but I have to kind of match up the factors and really make one do something.

That's one "plaything's" spritesheet so far and here's the other:

The first is geared with more versatility in mind where the second is clearly more action-platformer based. I'm learning to toy with compound sprites in both cases, but in the first I'm trying to layer elements together to make more expressions, where with the second I'm playing with making more distinct "characters." Either way, I do feel like it's more prudent to utilize the map space to it's max more than the sprite space; but I do feel tugged between the two approaches.

pico-8 wip blog

P#33840 2016-12-21 07:00


So, in between lunch breaks, I've made tiny-but-significant progress in my level generation code. It's part of a "bigger picture" thing, and meant to be useful across multiple projects; since I'm kind of digging into proc-gen core gaming. Even this little project is a proof-of-concept of a major undertaking, depending on if I can squish this into tokens available.

The idea here is to take a number of levels "LV" and make each one a 15-plus-one table - the first 15 being a kind of "perlin noise" function used to script "rooms" into the level, and the last being a control variable "BIOME" which influences the level's colors, themed elements, etc. I'm planning on coupling this with horizontal and vertical "targets" - ones to collect, ones to avoid, ones to attack, etc. Well, a "target" can be oriented both vertically and horizontally, and in varying speeds (more on this after my next WIP major chunk of code, "MAKETARGET()").

So MAKELEVEL(3) would generate 3 "output" tables:


...and then these tables will define the 5x3 screen map of each level.

I'll have to add "biome control" in later scripting, depending on the kind of game it generates, after the level generation. The "doorway" table definition occurs BEFORE it runs... for instance, it makes sense for a platformer to limit "doorways" to being {0,4,5,9,10,14}, where in top-down adventure or RPG games, it could be anywhere.

That said... still checking this for proper P8 syntax, and to see if it can be simplified. Being intermediate-level at best, I have the suspicion this can be streamlined a little bit still. Maybe even a lot.

function makelevel(lv or 15)
 if (lv>15) lv=15
 for lv>0, do
-- create sequence of 16 doors
-- we don't have to use them all
 for n=1 to lv do
  add doorlist (return doorways,d)
--each exit makes a short,
--high-risk way, then a long
--low-risk alternative
 for n=1 to lv do
--vertical paths?
  if (vstep<0) vstep*=-1
--horizontal paths?
  if (hstep<0) hstep*=-1
--add values to paths
  for n=vstep to 0 do
   if (stdoor/5)<(endoor/5) 
   add ezpath "5"
   add hdpath "5"
   add ezpath "-5"
   add hdpath "-5"
  for n=hstep to 0 do
   if (stdoor\5)<(endoor\5)
   add ezpath "1"
   add hdpath "1"
   add ezpath "-1"
   add hdpath "-1"
 add ezpath {"1","-1","5","-5"}
 if (#hdpath<3) add hdpath{"1","-1"}
--shuffle ezpath/hdpath order
--read paths, edit level table
    local pos=stdoor
    for i=#hdpath,2,-1 do
        local step={
    local pos=stdoor
    for i=#ezpath,2,-1 do
        local step={
    --return generated results as a
    --list of "lvl1,lvl2" tables...
    return "lvl"lv{}=level{}


I use a pretty standard LUA shuffle script there, too. And I hope the FOR/DO/LOCAL STEP{..} is effectively equal to a switch/select case statement, because this is where I needed that!

As for the high variables on HDPATH, I'm adding a 16-factor to the typical 4-directional perlin noise, to designate them as "hard path rooms," where harsher penalties for screwups can occur.

WIP P8 file available here: https://app.box.com/s/95hozscthimtty9wsw2febpyfpi0zlw7

pico-8 code

P#30416 2016-10-09 10:15


Well, THIS was a surprising side of myself to find coming to life while messing with PICO-8. Little as I've been able to really sit down and focus, I've actually started getting more into hardware and Linux now as a result of my exposure to it! I've already built a "Picade Console unit," and got that loaded up with some games... for some weird reason, Emulation Station still having trouble launching PICO-8, even though it can see the games there for it. I've done the "sudo chmod +rwx pico8" thing too. But nevertheless, the controller/unit was FUN to build, and that's something I really haven't done in a good ten years now. I'm up and playing a bunch of cool classics with it, too! I'm probably gonna get a full Picade Cabinet kit when they become available again, too! :D

Also, after MUCH delibration, my PocketCHIP finally shipped as well! It's only been a day now, and I had to do some calibration to the touch screen, but developing for PICO with it is still fun and solid! The somewhat nonstandard punctuation is a little tricky at first; but once you get acquainted a bit, it's pretty solid. I didn't have as much trouble hitting diagonals as I expected to have, from what I've heard here - but getting my right thumb back on the 0/+ keys (the Pocket edition equivalent of o/x or z/x) usually involved me looking away from the screen for the placement. It also felt weird trying to compose sound with "Q 2 W 3 E 4 R T 6 Y 7 U" since the number keys THEMSELVES were in a piano-like arrangement at the top of the screen (that might be one version difference worth considering); but once I popped up an octave and stuck to "Z S X D C F V B H N J M," it wasn't so bad. Then if I needed the top octave, I'd just change that bit in the tracker view. Editing sprites, maps, and even code felt natural as feck, though. And it's kind of a neat touch that it boots in Splore mode... but I can understand why the regular version doesn't do that.

It also feels REAL DAMN GOOD to have my first entire weekend off since June. T.T But I suppose without that intense grind, I wouldn't be swimming in all the cool nerdy wares I have going on now! And it's all 100% thanks to the PICO-8 community.

pico-8 picade pi chip pocket pocketchip

P#28754 2016-09-18 17:01


Okay, so right now, it's a bunch of design-doodled stuff for the time being; something like a "development wishlist" that I'm hoping to grind myself through soon... and hoping I can squish into PICO's limitations.


Basically, a SMB "demake" comprised of 4 levels, repeated with some factors changed like enemies/placements, coins and platforming widgets. It follows the typical SMB pattern of "overworld, underworld, scarce ground, fortress," except that the bridge battle at the end will require you to cross it once forwards, once backwards, and a third time across. The "and friends" part is for pallette swaps, switching the focus of the game (and maybe, if enough tokens remain, the end-of-level widget, we'll see):

Marlo (red): Flagpole, clearly.
Zonac (blue): Speedrunning, distance jump at end instead of height.
Dunky (brown): Enemy combos, the DKC2 end-of-level prize-hammer thingy.
Roshi (green): Collectables, flowery-roulette wheel except now it's stars.
Warlo (yellow): Coins!! Slot-machine-card thing from SMB3.

I don't think I'll do much with powerups - just one that makes you big, and if you recollect it, you can do a mid-air trick one time. Marlo gets a double-jump, Zonac gets the Fire Shield-style dash from Sonic 3, Dunky... I haven't decided yet, probably the ground slam, though; Roshi does the ground pound drop, and Warlo... don't know about him yet either. There'll be bouncing starmen too, but only for scoring purposes, no invincible crap in this game!!


"The Legend Of Zelda," abridged edition. 20-screen overworld with a set of 9-screen dungeons, caves/entrances shuffled every time except the wood sword. The "guardian" will appear at the BEGINNING of the dungeon... and I'm hoping to use a "Hint, Item, Puzzle, Solution" system past that for the level's item, and the heart container/level end.

It also features a simplified inventory: Boomerang, Bombs, Torch, Bow/Arrows, Whistle/Flute thing, Health Potion; Raft, Ladder, Ring, Power Bracelet. The open-from-the-start caves include the Wood Sword, Level 1, Level 2, the hint for the changing Lost Woods segment, and the first shop (Shield, Bombs, Torch). The hidden levels can contain up to 5 duds, but may also feature: Level 3, Level 4, maybe a Level 5 if it pads out that much, $15 (x2), $50, the Money Game, second shop (Shield for cheaper, Potion, Ring), a choice between a Heart Container or the White Sword, the Magic/Master Sword, a -$35 trap, a trap that costs you all of your bombs, and a trap that costs you your choice between the torch (or significant $$) or a Heart Container.

For reference, I think I'm gonna max the $ value at 99; and do the $1/arrow thing, too.


A Pico take on MegaMan 9/10's "Endless Attack" mode. 9 scenes of 3 screens apiece with generated platforming/enemy trickery (5 horizontal, 4 vertical); and after every 3 sets of that, a boss phase (with a selection of three "boss arenas"). After you beat the boss, you get your choice between a large health restore, or a new weapon. The weapon toggles with Select, but you don't accumulate them like in MM games, or recover ammo for them. The ammo you get is what you get, and when you take another weapon, it replaces that one, will full ammo. After 8 regular you-like bosses, it throws a fun fortress-style boss, and then a Wily-style boss for the tenth.


Kind of a dummy version of Smash Run from Smash Bros, but with 7 challenge gates, each containing a Smash match (ala Classic Mode). Unlikely to feature actual Smash characters (for a plethora of reasons), but it'll give you a lineup of 8 characters (mostly color swaps, it'll show generated special move sets), the ones you don't choose will be your opponents. Master Hand is a bit much, so "big boss" concept will have to be totally rethought.

This will really max out the Map space, and focus spriting almost entirely on the characters, the tileset, and maybe just a couple of platforming widgets and minor goons to keep it interesting. Create-a-character mode is a maybe; but that would defeat the character generator, wouldn't it?

Return to ZWORD

A Palace-focused Zelda II demake... this starts you off in a one-screen town, then you proceed into a generated palace, formed from combinations of 8 (3-screen across) wide sectors, interconnected by doorways and elevators. There's an item/weapon room, a palace shop, and a place to upgrade your three main stats, Attack/HP/Blocking. None of that magic crap in this game!!

The focus is mostly on Z2-style fencing/combat, since that was the meatiest part of the title, and while it may feature a few little creature-grunts, the majority of enemy design will focus on that as well. Also, instead of passive items, or things that affect "map screen stuff" (that isn't featured here at all), you'll be able to collect and change between an assortment of weapons to fight with; maybe each with their own full-HP projectile attack that, unlike in Z2, isn't completely worthless.

Finish the boss fight, place the seal, and the exit of the palace leads directly to the next town (although there's no turning back at that point!), where the next palace is generated.

Weapons may include: Sword, Pickaxe, Morning Star, Whip/Flail, Spear, Torch, and maybe Boomerang, Magic Rod, Fireball Rod. I also might throw in passive-effect wings for mobility options that Z2 lacked, but that's more a Gentroid thing; and "if there's room/tokens left after everything."


Okay. So my previous attempt at this, using dynamic map generation, hit the token wall. That's what I get for trying to make such a big world out of so few things.

So in this reattempt, I'm planning to use some prefetched scenes, like in these other titles, rather than scripting them to fill themselves with content. So far, the map space plan involves two of the 2x2 screen hubs, 3 vertical corridors, 3 horizontal corridors... and all the connections between them are lateral. There's also a start screen, a "get the item" screen, a pause/status screen, and a 2-screen across boss arena.

Truth be told, I'm still working out how to get the Metroid/SuperMet sensation out of such limited constraints, and if I want the game to be level-based - IE: beat one boss, do the escape sequence, repeat - or nonlinear - IE: finish the entire set of bosses by having multiple preassembled layouts, and then hub those together, and then finish with a single endgame/escape sequence?

What I do have worked out, is the power set. Morph Balls will include the ability to jump with them, btw. But you can only equip one per set, and your mileage may vary. Charge shots become missiles/explosives.

Head: Dark Vision, Block Scanner, Screw Attack, extra HP > Ammo, extra Ammo > HP.

Wing: Slow Fall, Hover, Slow Rise, Momentary Free-flight, Double Jump, Unlimited Jump, Teleport

Arms: Burst Shot (shoots 3x quickly), Double Wave Shot, Double Bounce Shot (~30 degrees), Triple Spread Shot, Piercing Laser Shot, Shot Eraser Sword, Shot Repel Sword, Grapple Beam/Whip, Double Freeze Shot, Basic Shot (to start), Basic Blade (to start)

Core: Resist Heat, Resist Freeze, Resist Shock, Resist Enemy Collisions, Resist Knockback, Resist Shots, Reserve HP

Legs: High Jump, High Speed, Stomp Attack, Water Weights, Magnet Boots (ceiling walk/wall walk?), Sure Stop

Ball: Basic Ball, Speed Ball, Bounce Ball, Spike Ball (can climb walls, hence the Magnet Boot overlap being unnecessary?), Float Ball (on liquids), Cannon/Launch Ball (think Shinespark, but with the ball)

Etc.: Missiles > Super Missiles, Bombs > Power Bombs, Grenades > Super Grenades (first is charge shot, second is direct upgrade to it), Ammo Up, Health/Energy Up.

I'm also thinking of doing a Gauntlet-style thing where your energy counts down like a timer; but every segment has a place to repower yourself; to be fair, but to keep you moving.


A Spelunky demake is very exciting, but also very difficult to fully concieve. There's a huge difference in the control schemes, and it's a very complex game. That said? I'm still sitting on this (haven't really fleshed it out yet), but some things I'm considering in comparison:

-Up + Attack for Rope, Down + Attack for Bomb.
-No crouching, lifting/throwing, or flipovers. Also, no Kali, because there's really no way to do sacrifices now.
-No fall damage, or at least a bigger fall buffer. Possibly fall stunning instead, without the HP penalty?
-Damsels and idols will collect upon contact, but Idols will also immediately trigger associated traps. Maybe some changes to the traps too, to make them more interesting - like the Ice Caves one making a quake that drops all of the falling platforms.
-No Olmec. Really, it's mostly that he'll eat up FAR too much sprite space, or just look like a really ugly, overstretched idol.


A Binding of Isaac demake, but like Spelunky, the control limitations may be tricky to work with. Here's the thought so far:

-Shot button, Bomb button. Hold shot to strafe while auto-firing that direction. Brimstone or Mom's Knife are the only charge attacks.
-No space bar items. Pills give effects immediately upon collecting them. Cards? Not sure yet. Maybe similar to pills - but with no way of identifying them first, it may be better to just not have them at all.
-Powerups are entirely passives, and/or things that influence shots and bombs. Issac's sprite may change color/size, but not very much beyond that.
-Few bosses with more color variants? And on that note, one level per set, rather than two; Hades, Chest, and Cathedral all branch from Womb. So a whole run is 5 levels, basically.


A similar demake of Rogue Legacy, with things trimmed down and the controls simplified. Map is likely to feature mostly single-screen and two-screen chunk segments; and one boss arena with platforms that toggle on/off. It helps that they're all resized basic goons, anyhow.

-Traits and visual effects (somewhat) intact.
-Gear and passive effects available on the manor.
-No Classes/Class Effects. :( This hurts, but I don't have enough buttons for it.
-No dashing/dash runes. Same reason.
-No Magic/Subweapons, and with that, there go the minigames. UNLESS - that replaces the sword entirely, and then you have no sword (or the sword becomes another subweapon?). Not certain on this yet.
-Maybe no fairy chests. It's not that they aren't fun - they're kind of the heart of the game, when you think about it! But having to set aside so much map space for dedicated rooms constructed for many of the challenges will kill the level generation; especially some of the funner ones. The "kill all enemies" thing isn't THAT compelling, is it?


It's just Bejeweled 3. Classic, Lightning, Butterflies, Poker, Diamond Mine, Blitz Modes. shrug Maybe with 360-Blitz style controls? Second puzzle classic after Tetris now, no?


A DDR demake that tricks the SFX/Music data by rewriting it on the fly; and editing the framerate to coincide with song tempos (there's a 7.5 factor differencial between FPS and BPM; and it doesn't have to be 1:1 perfect). That said... I wonder if Pico allows L+R or U+D inputs, or prohibits them by default? That could be a problem if it does...

"Feature creep" includes dynamic remix generation (altering the tempo, looping the stepcharts?) or course mixing (basically, chaining one song chorus/verse to the next on the fly, only does the final song's outro). Likely to feature "abridged versions" of popular songs, and only the most vital thereof. At least the spriting is simple in theory!


A somehow-more-minimal Mini Metro?! A Pico-version of Coin Crypt? No idea, just spitting things out now.


Could really use more discussion/insight on the scope of these, and their feasability; or smarter ways to pull this kind of thing off. I see some really incredible stuff already being produced here!

P#23020 2016-06-16 17:29

:: More
About | Contact | Updates | Terms of Use
Follow Lexaloffle:
Generated 2017-03-25 03:52 | 0.183s | 2097k