PETRI CHAMBER // ORBITAL MEMBRANE DEFENSE

A petri-dish tower defense. Central nucleus, 6 max orbital membranes with vesicles.

CORE ENGINE:

  • Dish radius = min(W,H)*0.48, background #efe6d0 with Li() paper noise
  • Nt=6 max membranes, Fc= radii, Ni= hues[70][108][146][184][222][260][170][200][15][340][45][190]
  • Rotation Mi()=0.55+ringSpdLevel0.15 rad/s, Damage Oc()=4+ringDmgLevel4, Arms ql()=armLevel (2 base)
  • Ring state {radius, arms [{angle a, prevA}], speed, hue, flash}
  • Player maxHP xl()=75+hpLevel25, regen Fi()=regenLevel1/sec, hp=100 base, shake = min(18,dmg*1.2)*exp(-6t)
  • Canvas full window, DPR capped 2, central offset for UI panel

ENEMIES:

  • Types: coccus (circle 165/340 hue), bacillus (rod 22x10 rounded rect 95/8 hue, 1.18x speed), elite (flag tail sin(flagPhase) wave, 45 hue, 0.72x speed)
  • HP = floor(10+threat*3+pow(threat,1.3)) * (elite?2.2:1)
  • Speed = 26+rand16+threat1.15 * (elite?0.72:1) * (bacillus?1.18:1)
  • Elite chance = min(0.16,0.02+threat*0.012)
  • Move = toward center + wobble sin(time*3+wob)*8
  • Reward = floor((5+threat2)(elite?3:1)) ATP

SPAWN / THREAT:

  • Spawn at max(W,H)*0.54 random angle, count = 1+floor(threat/6)
  • spawnInterval = 3.5-threat*0.09, min 1.1
  • spawnTimer, threat starts 1, every 4 spawns threat+=1, every 3 threat levels toast CONTAMINATION X
  • Death text = Contaminated + time + Level threat + Z cleared

WEAPONS:

  • Bolt: damage Vc()=5+boltDmgLevel*4, speed 720, lifetime 1.6s, aimed at cursor, float text -dmg
  • Membranes: vesicle pos = center+cos(a)*radius, sin(a)*radius, collision vs enemies

UPGRADES:

  • Bind New Membrane: 28*2.15^rings
  • Enzyme Blast: 18*1.55^(lvl-1) +4 dmg
  • Membrane Damage: 22*1.55^(lvl-1) +4 dmg
  • Protein Speed: 26*1.6^(lvl-1) +15%
  • Duplicate Protein: 90*2.4^(armLevel-2) +1 vesicle per ring
  • Cell Wall: 401.7^(hpLevel-1) maxHP 75+hp25 + full heal
  • Regeneration: 70*2.1^lvl +1/sec

RENDER:

  • Clear + dish clip, nucleus 24px + breath sin(time*1.9), inner spots
  • Rings: stroke hsla(hue,70%,55%,alpha), vesicles arc fill, flash = 1 on hit
  • Enemies: coccus circle + inner nucleoid, bacillus rect+arc ends, elite flag Bezier tail
  • Motes: 140 bg particles, type 0 dot, 1 bacillus ellipse, 2 speck, drift
  • Panel: 340px glass rgba(10,10,16,0.72) blur 20px border white/[0.08], Vitality bar, Integrity, Cleared, Time

AUDIO:

  • AudioContext master 0.38, dry 0.72 wet 0.22, Convolver 2.6s decay 2
  • Pad: 42Hz*[1,1.5,1.333] triangle/sine -> lowpass 320 + LFO 0.05Hz*120, gain 0.035
  • Tick Zc: triangle 196Hz2^(Tc/12) Tc= + sine2.97, decay 0.34s gain 0.08*v stereo pan[0][3][5][7][10][12][15][17][19][22]
  • Hit Gc: noise 0.38s + sine 160->42Hz, Death bc: 5x triangle 180Hz*2^(-/12) descending[0][2][5][9][14]
  • Contamination qc: saw 190->50Hz waveshaper tanh*5

INTERACTION:

  • Click = fire bolt, H hide UI, M mute
  • Auto-resize + panel offset calc, RAF loop Ui()

One file. No deps.

DEVELOPER NOTES:

This build is entirely in HTML5 and based on a Unity prototype.

If you would like me to update and expand this file please consider donating.

Let me know in the comments what desired improvements or bugs you experience and we will update it for Version 2.

Petri Chamber is free to play, if you would like to purchase the zip file you can use the source code to Petri Chamber in your projects.

Download

Download NowName your own price

Click download now to get access to the following files:

Petri-Chamber-Download.zip 59 kB
if you pay $10 USD or more