« first day (2906 days earlier)      last day (2115 days later) » 
03:00 - 17:0017:00 - 00:00

5:00 PM
It just seems like a lot of overkill
 
every message gets sent to everyone, and gameObjects just take whatever they need
the code is super simple, and it doesn't seem to be slow even for hundreds of units
 
Lets make the following changes:
Make the health bar slide down instead of just going down instantly
Make it so that when a unit dies, it fades out.
 
that I'm ok with, but let's say the bullet... B can't seem to get damaged before the bullet reaches it
 
What do you mean?
 
hm, I definitely seem to have two types of messages. Some take "no time" to execute because they're logical, and some take time to execute as animations and maybe later on sounds
 
5:03 PM
Seems like a good idea
 
A charges up for 50ms, creates a bullet, the bullet takes 100ms to travel, explodes on contact for 50 ms, a death animation that lasts 200ms, a heal animation for some more
etc...
 
Works for me
 
and so a message queue could be used for animation separately to take it out of the mushy game code that spams everyone everything, and if some animations are compatible (e.g. two people firing at different targets) they can be played together
and so I could have units generate proper animations instead of animating "themselves", like "animation(UNIT_INTERCEPTOR_DEATH, 200ms, unit.x, unit.y)
 
BTW your css seems to fail to load
 
hmm? my css?
 
5:07 PM
oh yeah, 404 on https://alexmitan.github.io/coding-tbg/stylesheet.css
 
Oh, I forgot that in there
Oh well
 
works anyway
 
BTW could you make an option to disable console.log...
I can't do anything with my console if it just fills with messages like that
 
fair
for a sketch, it'd be fine to do
debug && console.log(...) right
and switch debug
 
ye
But mabye make it triggerable by a keycombination
So... you type somthing on the game and it inverts debug
@AlexMitan Hold on.. that's too many replaces to make
console.log = (function() {
  const log = console.log;
  return function log(text) {
    if( debug) { log(text) }
  }
})()
Just put that in front of your scripts
 
5:14 PM
just do console.log = function(){} to stop the logging
 
Ok
BTW I am getting noticable lag with a lot of units
 
Same, I think it's the Canvas redrawing everthing every frame
hence the switch to SVG
just gonna remake this in svg now
 
That's a lot to do :|
 
You can find out whether that's true from the performance profiler in your developer tools
 
@TheMaskedRebel I'm busy
@FreezePhoenix Fine thanks
 
5:20 PM
@AlexMitan Your game used 90% of my CPU for 10 minutes
@doppelgreener Trying that out now
 
@FreezePhoenix Again, not really a lot to do, I just have to replace the graphics component with a SVG one
 
@AlexMitan Very little of the CPU is spent drawing
 
Crap. It's the messages isn't it
 
@AlexMitan Nope. This was with console.log disabled
 
no, the in-game messages
 
5:23 PM
in a total of 22 seconds, 303 MS were idle
@AlexMitan Correct
What is your method named update
HOLY
 
the frame-by-frame runner
the... draw.. thing
wait, maybe it's the fixed interval
 
Nope
It's the function on line 45
Ok... I'm checking out your lib folder
Ok... this is bad.
Modify cmutils.pickFrom to read
 
?
What's going on
 
cmutils.pickFrom = (function() {
  const {floor, random} = Math
  return function(arr) {
      return arr[floor(random() * arr.length)];
  }
}
Every single time you run update , you are traversing the Math object four times;
 
Also, the game is running at "100 fps", of course it's lagging
 
5:31 PM
Yeh that's way to high
 
It's just for scrappy "see if the architecture works" purposes
I never planned to use canvas anyway
 
BTW canvas is the fastest thing in your game
Every single one of your functions takes more time than the canvas operations
 
@FreezePhoenix once you end the profile you can see what functions have what % of time spent on them
 
I know
 
I'm gonna have to see how it runs at a proper "fps"
 
5:35 PM
 
And with a reasonable number of units
 
@doppelgreener The canvas is the least of his worries - that small orange band at the bottom is the canvas operations
 
@AlexMitan btw do you broadcast messages to every unit or do you have some kind of event subscription mechanism set up?
 
The game won't have 600 units on screen at 100fps each, and won't be on canvas, and won't have this architecture. I appreciate everything but I won't optimise something that's on its way out
 
@FreezePhoenix yep agreed, highly unlikely canvas will be a breaking point here anytime soon
 
5:36 PM
@doppelgreener Broadcast until I get an intuition what "message pipes" to run things through
 
@AlexMitan Why would you use SVG? That's more dom interaction and will be slower
 
I already ran a "simulation" on paper and it seems I need a message channel for game mechanics and another for animation
 
At least let me clone your repo
 
@FreezePhoenix Easier to code for, and more in-line with the game logic
 
@AlexMitan cool. Something you can instead have is objects subscribing to "I want damage events to red" or whatever, and being put in a list, then when a message is broadcast about damage events to red, only those objects are given the message.
Is optimisation of this project actually desirable or was it a throwaway? How far are you planning on going with it?
 
5:38 PM
@doppelgreener Yeah, that's fair. I logged the "team kills" thing just to prove the flexibility of total broadcast: death messages get processed by the world, which takes the sender's parent, the fleet, and adds to its score
@doppelgreener I'm moving that simulation to SVG, and as soon as it runs decently I'm going to figure out the message architecture a bit deeper, if I need to. The canvas thing is a one-day throwaway
Under more reasonable parameters, 100 units max per side
@FreezePhoenix SVG also features "leaving things alone unless they need to be changed" and "timed animations instead of hand-interpolating attributes I barely know how to work with". Plus, d3 is magic
 
How is your pipe waiting for messages? Lowering the FPS didn't help
 
@AlexMitan cool, ok.
 
Noticeable pickup If I modify CMUtils
I noticed you never used a single async function
 
Async/await is pretty nice.
 
5:53 PM
And is performant
 
@doppelgreener Got any good links for that or am I going to have to figure it out?
 
6:18 PM
@AlexMitan Bit of both. Some people including me find it a little bit brain-bendy at first. First you'll want to know about promises because async/await uses them behind the scenes. Then maybe this guide will be helpful.
 
@AlexMitan whats up!
 
If you're already familiar with promises I can try to explain what async/await does.
greetings, @Duke!
 
Hey!
Remember that board game I kept trying to design that slowed down a lot because I couldn't find a way to make really elegant and test fast? I'm iterating through making a web game based on it.. roughly
But now I'm more.. learning the fundamentals of all of this
 
i was just looking at that. really glad to see your still at it. you have some great ideas worth full exploration
you can get some very good advice on this chat--lot of experienced devs
 
I pushed another commit, now it's fully like the previous sim
With removal of both data and graphics on death
I'm super, super happy about this. Time to stress-test.
 
6:28 PM
@AlexMitan I can't remember if I ever got your email, but hit me up at dukezhou108@gmail sometime if you think of it. (definitely would like to keep in touch)
 
Will do!
How's your game going? Saw that you post around here
Last I saw, you were working on an AI for it right?
 
It was probably a mistake to release when we did, before we were ready, but we got some good feedback and will start addressing some of the immediate issues in the upcoming release ~September. (Right now it's the problem of "too hard for some player, too easy for some players" ;)
But we likely won't have a fully "ready for primetime" version until the end of the year, best case
but I'm happy because we'll be implementing an initial "goodness" evaluation function for the AI, which should improve strength significantly
and, once we get our server working again, we should be able to do cross-platform PvP for any system we ultimately run on.
 
Warning, "never-made-a-game-AI-in-his-life" question incoming
Since your game has easily quantifiable state, have you guys used neural networks or something?
You could simulate your game and then classify how good an AI is by how often it wins against a random AI and other AIs
 
@AlexMitan that's really cool!! :)
 
@doppelgreener It'd seem like canvas might have been the problem after all
@FreezePhoenix I switched to 1000 units on SVG and it's alright
 
6:34 PM
radical
 
We're avoiding NNs for now because we want the AIs to be able to function on lowest-common-denominator, non-networked mobile devices. So it's strictly a "strategy ladder" model for now, entirely based on heuristics ("GOFAI";).
Look-ahead will be next, but NNs still a way off.
 
Neural nets take a lot of resources to run?
I didn't think they did.
I mean, Susan on Mac in mid 90s used one.
 
to train they take a lot of resources
 
They take a while to train, not so much to execute
 
I don't get it
you're not training them on the client
you train them dev-side and ship them
or, you want the AI to learn from the player (like Susan did) so the training data is each game the user plays
also not a problem
 
6:37 PM
Just upload the data from the games or something?
 
No, training a NN from a single match is very quick and simple
that's one of the cool things; training them on a dataset of a million doesn't take super long, though you wouldn't want to do that client side.
But adding the training from a single data point is just a "few" calculations.
easily done on a client
But that's only if you're interested in an AI that learns from the player.
 
eventually that is the goal
 
that can be fun, but it might not be what the player is looking for. It would mean the AI is useless to start with
Susan was easy as pie to beat, until it started learning. part of the fun of that game was watching it get better from game to game
 
to learn from their human player, and for humans to be able to have their personalized AI's play their friends personalized AI's
 
Or, you can ship with an AI that's partially trained
so it's not useless to start, just not great yet
 
6:40 PM
but, initially, we want the reasoning to mirror human reasoning per the "strategy ladder"
 
I don't see how you know if it mirrors human reasoning
different people will approach the game different ways
maybe your own reasoning. But not "human reasoning" in general.
 
aah, but there are certain inherent qualities to the game that are "grokked" as a player advances
level 1 AI places randomly
level 2 AI always places the max integer
 
Do you know that for sure. For example, I learn Tekken combos by looking at button-press lists and practicing them
 
(7 year old can learn to beat those reliably)
 
My wife just mashes buttons and eventually learns it.
once learned, She can't even tell me what the button combos are.
so you can't say for sure what's going on in peoples' heads as they learn it
 
6:42 PM
oh yeah, I've been analyzing this game from a solution perspective since ~2013
 
many people have different learning styles.
Some will play with intuition, without really knowing exactly what they're doing. others will calculate very carefully.
some will use a mix of both
 
and both play styles work, but there are certain characteristics to the mechanics that you can't get around, in particular, regional stability states (stability, epistability, metastability)
NN is the no-brainer for pure strength of play, but I'm fairly certain it won't be required to beat the strongest human players. Where I see NNs being interesting in this project is the personalization (as you've noted) and AI vs. AI in higher dimensional games, not suitable for human play
we also definitely want a string of "dumb AIs" where strategy is easily discernible
i might be wrong, but it will be interesting to find out!
 
7:08 PM
@DukeZhou Also, the main point of the game is to work on a friendly coding interface kind of like Warcraft 3's to turn unit micromanagement into scripting
imagine that in an RTS you had units with triggers like "fire at most wounded enemy" or "when wounded, go behind squad" or "when on low health, go to nearest healer"
 
API for customizing the AI is definitely in the pipe-line, but our dev schedule is glacial atm. We're really interested in leveraging this for education, and what I hope for is that kids from middle-school on up will eventually be designing their own AIs to play, but ML and GOFAI
 
@DukeZhou GOFAI?
 
"Good Old Fashioned AI" aka "Classical AI" aka "Not true AI-since-the-recent-ML-milestones"
 
Ah, so rule-based, hand-written logic type stuff?
...kind of like what I hope my players will be writing ingame?
 
yup. imo it's still valid when approaching from an Algorithmic Combinatorial Game Theory perspective, and I think [M] is the strongest game for that, because all game states and outcomes are naturally ratios, and Sudoku itself led to difficulty classification in regard to puzzles in general
I was trying to get some of the math people to help me do a proof on a mirroring partial-solution for the even-order game grids 2x2(2x2), 4x4(4x4) etc., and then someone asked a question about the impartial Sudoku game and a PhD demonstrated the solution via "Infinite Sudoku"
(best part is, he didn't figure out the solution--his 11 year old daughter did--he just subsequently demonstrated the proof;)
what really gets me excited at present is how to distinguish between "weak stability" (regional polarity cannot be flipped with a single placement) vs. "strong stability" (regional polarity cannot be flipped with any number of placements) and how to efficiently gauge the latter
how to "attack up the resolution chain" (metastability)
how to determine when the game collapses into a tractable state so that perfect play can be achieved (does the AI agree to early resolution? Only if the outcome can no longer be affected.)
Where I see an advantage is, this generalize approach doesn't require re-training for every variation of the game mechanics and board topology. See Chaos Functions, "historical map generation"
 
user92578
7:33 PM
@doppelgreener mmmmmhm
 
(once I realized the game might be solvable to varying degrees, I needed to find efficient methods to generate unsolved variants)
 
user92578
@doppelgreener people bad, standard good
 
user92578
<insert xkcd about competing standards here>
3
 
11:49 PM
@AlexMitan WHAT THE HECK IS TEH GRAPHICS
 
03:00 - 17:0017:00 - 00:00

« first day (2906 days earlier)      last day (2115 days later) »