Elemental rebooted Devlog

To summarize… I have switched from using mouse controls(more fun but less perf) to use button controls(less fun easier to port to hardware and better perf on said hardware), My game would run probably really good 30+fps but the memory usage would be INSANE(storing hundreds of cards gets ya).

not directly for the end and start( the time value should only be in-between those) Its more of a percent of the start to the end(dunno how to word this

time goes from 0 to 1. If you take:

function lerp (start: number, end: number, time: number) {
    return start + (end - start) * time
}

lerp(5, 10, 0) → 5 + (10 - 5) * 0 → 5 + 5 * 0 → 5 + 0 → 5
lerp(5, 10, 1) → 5 + (10 - 5) * 1 → 5 + 5 * 1 → 5 + 5 → 10

If time went from start to end, lerp would look like:

function lerp (start: number, end: number, time: number) {
    return time
}
2 Likes

I mainly wanted to sort it so it doesn’t look a huge mess of spaghetti, and you can easily add more types of entities (using the update function, and if needed to the render one)

1 Like

yuo should probably use both mouse and controller

1 Like

That would be the worst of both worlds. So lemme get this straight you want me to have janky controls(buttons) and have overlaps that drain performance?? What would be the point? I would develop the button version and if I wanted I may make a mouse version.(another way would be to use 0-9 to switch cards faster)

I don’t really know the best way to make it but it could be like:

let s = sprites.create(img`1`, SpriteKind.Player)

if (control.deviceDalVersion() == "sim") {
    browserEvents.onMouseMove((x, y) => { s.x = x; s.y = y })
    browserEvents.setCursorVisible(false)
} else controller.moveSprite(s)

control.deviceDalVersion() returns “sim” on the simulator and something else on hardware, so this way your only using one at a time

2 Likes

I guess this would work but likeee… I don’t wanna. Thanks for your continued support man! Anyways I’m completely redoing the engine to fit this(now cards are just data storing and a single method lol). My next biggest issue is probably going to see how I’m going to Implement moves. @Luke how did the enemies in your game card delver do it? I am most likely going to do it like sts does with some using a cycle some using percents for attacks and probably some with phases(simple check and then switches to a different cycle).

3 Likes

I just had an array for each enemy which corresponds to the cycle of intents

4 Likes

darn it(you went ez mode). I was praying you had some insight on other attack patterns

3 Likes

what are you thinking that makes it more complicated? (because so far I haven’t really understood what it is)

3 Likes

it shouldnt be too hard to generate a random array of intents every round for each enemy though. I used a system like that but it was to read card info instead and it wasnt random

3 Likes

im thinking more of using a class to store the intents and then idk how but run conditionals and percents on them and stuff to get an output of a single intent(i will then store this enemy behavior class on the enemy). Anyways lemme explain this in this way. Cycle attacks are like this:
Buff → Attack → Attack → Attack ->Attack → Buff and on and on.
Percent attacks would be like this:
Debuff → 50% to attack/50% to block.
Phase attacks would be like this:
Attack → block on and on but when the enemies health is below 20% it switches to Debuff → Attack and then on and on

Your welcome!

1 Like

I have something I wanna run by @VoxelMaster64.
How would I make custom enemy behaviors? My strategy would be to create an arrow function that is attached to my enemy.
Then I would run it every turn. The function would output a return value of enemyIntent which I would save to both currentIntent and all intents. After it finishes I would change my enemies private index by one. Is there a better way to do it?Also here is my code for all the stuff I mentioned:

enum Intents{
    Attack,
    Debuff,
    Buff,
    DestroyElement,
    CreateCurse
}
interface EnemyAction{
    intent:Intents
    identifier?:number|Element
}
class Enemy {
    health: number
    enemyBehavior:()=>{}
    private index: number
    currentEnemyIntent:EnemyAction
    allIntents: EnemyAction[]
}
1 Like

your doing the arrow function wrong, you want the type to be () => void. And it might depend on how many enemies are going to be fighting per round. If there is one enemy, it might be like:

class EnemyCard extends Entity {
    ...
}

enum Intents {
    Attack,
    Debuff,
    Buff,
    DestroyElement,
    CreateCurse
}
interface EnemyAction {
    intent: Intents
    identifier?: number | Element
}
class Enemy {
    health: number
    enemyBehavior = () => {} // type is () => void
    cards: EnemyCard[] = []
    
}

/*
array of all the behaviors, maybe save
each index to a enum if needed, but
enemyBehaviors[0] may be a simple bot
(e.g. only attacks) and enemyBehaviors[15]
may be a complex boss
*/

/*
if you want to reuse a function from enemyBehaviors, you could do 
let enemyBehaviors = [
    () => {...},
    () => enemyBehaviors[0]()
]
*/

let enemyBehaviors = [
    ()=>{
        ...
    },()=>{
        ...
    },
    ...
]

let enemy: Enemy



// Maybe in another file?
class Player {
    cards: PlayerCard[]
    function clickCard(card: number) {
        cards.removeAt(card)
        enemy.takeTurn()
    }
}
3 Likes

oh yeah I fixed that also I don’t need entity since I’m deciding to have 0 overlaps so its kinda goneeeeeeeee

2 Likes

WAIT WHAAA-

@ScriptScraper is part of the teammmm!?!?!"!?!?!?!?!?1?! Lez GOOOOOOO

also uhmmm @TeddyB can you make some fire music please I would like a piece like "Exordium " by Clark Aboud

linke here

1 Like

I didn’t know that there was a vote sorry @TheGooberEarth. May I be artist or musician though?

I have experience in real life music if that helps? And experience in pixel art as you already know, Just not alot of experience for art. I’m good if there is a reference?

1 Like

hmm I kinda assembled it a while ago…ill ask you the same thing as what I asked teddyb to make and I’ll pick the best one(the other song might still get used)

1 Like