Hello, Buffer

Weighted distrobution with non-uniform sets

The problem is as follows A customer will order a set of views in one of two configurations:

Full Frame logo: 1/4 Logo:

    +------------+       +-----+------+
    |            |       | A   | B    |
    |            |       +-----+------+
    |Full Frame  |       | C   | D    |
    +------------+       +-----+------+

So i have a set of customers with properties:

  • Name
  • Limit (Amout of views they purchased)
  • Shown (Amout of views aquired)
  • FullScreen (If it’s a fullscreen or not)

I then try to generate every possible screen and give it a score(Later to be used as weight): I also iterate over every customer to gain a `total_remaining` for use in the `weight`

for customer in customers:
    remaining = customer['limit'] - customer['shown']
    total_remaining += remaining
    if remaining < 0:
    if customer['fullscreen']:
            'name': customer['name'],
            'limit': customer['limit'],
            'shown': customer['shown'],
            'remaining': remaining
    if not customer['fullscreen']:
            'name': customer['name'],
            'limit': customer['limit'],
            'shown': customer['shown'],
            'remaining': remaining

Both fullscreen and quarts are now in a temporary dict, i neeede to iterate over twice to get the `total_remaining`

And for then we add all possible screens in `possible_ads` For the fullscreen this is straight forward:

for full in possible_fullscreeens:
        "weight": (full['remaining'] / total_remaining) * 100.0

For quarts this is a lot more work, and i probably did it wrong in a stupid way. But here we go.

# First i get all the possible combinations for the given set
possible_combinations = get_possible_combinations(len(possible_quarts), 4)
for subset in itertools.combinations(possible_quarts, 4):
    score = 0
    name = ""
    for customer in subset:
        customer_name = customer['name']
        name += customer_name + ','
        score += customer['remaining'] / 4.0

        ((score / total_remaining) * 100.0) / (possible_combinations)

Then we use the weights to do a weighted random selection

(total_remaining, possible_ads) = update_adds()
if (len(possible_ads) <= 1):
    print("All done")
weights = []
for ad in possible_ads:

ad = secure_random.choices(possible_ads, weights=weights, k=1)[0]

My assumtion is that it should take about as long for everyone to reach the limit, i have some wierd distrobution in that respect This is the response after 100_000 runs, the lower letters have high numbers because their limits is low, and `A`,`A1` and `A2` are fullscreen

A    %:      24.82
A2   %:      24.908
A3   %:      24.81
B    %:      19.68
C    %:      19.296
D    %:      19.42
F    %:      3.7216
G    %:      36.724000000000004
H    %:      36.832
I    %:      37.532
K    %:      37.104
L    %:      100.02
M    %:      100.05
P    %:      105.0
Q    %:      110.00000000000001

This needs more work

Hello, Tesselation

So progress is super slow as i have little to no time, but i have now had some time to think about what shape i want the “grid” of my map to be.

PS: I am thinking about making a game with diplomacy inspired rules, so each turn you queue up an action, and at the end of a “tick” the actions are executed in parallel. The intrigue of this comes in that if two forces have equal attack-score, which they do. (1 unit per square, 1 unit = 1 attack or defense). But you can get other troupes or friendly troupes to “give aid” in your attack or defense. So how many neighbors each square has should drastically change the nature of the game. BUUUT, I’m still a programmer and require something that is easy to generate and tessellates, because the alternative would be that i create a dynamic, organic map with my human brain. And that’s not how i function.

These are our candiates


Tesselation_triangle.jpg Neighbors: 12


Tesselation_square.png Neighbors: 8


Tesselation_hex.png Neighbors: 6


Tesselation_octo.png Neighbors: 8 4 diagonal and 4 cardinal

Looking at the numbers alone it seems that Octo and Square are in the same league, but i like that Octo gives you an offset of 0.5 on every other line. This makes it harder to create “battlefronts”, so hopefully this will make you defences less static, creating a more unstable game, setting the stage for more interesting interactions.

Got something working today, where each cell also know who it’s neighbors are Screenshot_20211122_213217_webrts_hex.png

Hopefully i will get more done later, who knows.

Hello, WebRTS04

Yesterday i said that i will have to focus on core game play going forward, so i have used what little time i have today to make the background more colorful. WebRTS_04.gif

I tried to fix so it pans with the camera, not easy. So Look at this neat paralax effect to show the grand size of space.

Hello, WebRTS day 3

Day 2


Day 3


Hello duckies🦆

Now day 3 is coming to a close i’m facing steady progress, i think it’s time to put an end to that. I will have to do something which is the bane of many projects and a stopper for any popper enthusiasm, create a spec💀!

I did imagine this project to be a async multiplayer game, and was thinking i could write a REST api and just do HTTP request for all communication.

But i don’t know how to make this design “turn-based”.

Like the transport routes, should they show the travel path as segmented parts? ✔️ probably And planets should they gain “energy” every turn or wait a set amount of time to give a bigger amount? I guess this is game design, and my mantra for this project was to create something so easy, i could iterate quickly. So to a certain extent i think getting an MWP together is the way to go. I will let that be my guiding principle.

Lets now try to define what this MVP should contain:

  • We have unmoving “Planets” scattered around
    • These generate “Energy” when “Owned”
    • A player can send energy from one planet to another with transportships
      • Doing that to an unowned planet will lay claim to it
      • Doing that to an “enemy” will claim if the sendt energy is bigger than the stored energy in the planet
  • Complete monopoly or biggest empire when timer runs out is victor
  • The game will move in “ticks”
    • One tick can be each hour during waking time
    • Users can submit their move at any time in between ticks
    • It will be executed at the time the next tick starts

That is the spec for now, tomorrow i will have changed direction. Stay tuned….

Hello, Godot project

So i’m going to get a project started so i don’t lose my mind.

I have always wanted a game to play asynchronously with friends over a long period of time. Most of my gaming is just a backdrop for social interaction, and getting older it’s ever harder to keep in touch with friends on a regular basis. This combined with a love for “hidden role” games and diplomacy, i want to create a game that is played with friends over a longer period of time, Weeks, moths!

I have some ideas for a simple strategy game that could be expanded upon, but knowing that i am no professional game designer, and that i don’t know what this is yet, i’m turning to something i can, failing quickly. So i’m just going to start by trying to make an MVP for this product, the simplest strategy game i can think of that can be played asynchronously, and iterate, iterate, iterate.

That will require me to maintain a web server for the API and the codebase for the game/client, should be doable

Will come back when i have more to show, hopefully soon, but time is not something i have a surplus of ATM

Hello, WordPress

I’m currently in the process of setting up a more streamlined bloggin pipeline from my trusty emacs config. Hopefully this will enable me to share snippets and thoughts for my own sick pleasure.

Currently i’m working in spacemacs and org mode, i will check if some features are working

for x in range(0,10):

OMG yes it can print code with syntax, this is the best shit 🙂

fn pathfinding_human(
    _human: &Human,
    transform: &mut Transform,
    pathfinding: &mut PathfindingAgent,
    #[resource] _view_rect: &CamViewRect,
) {
    if pathfinding.path.is_empty() {
        let result = astar(
            |&pos| linear_successors_ivec2(pos),
            |&pos| pos.distance_to(pathfinding.target),
            |&pos| pos == pathfinding.target,
        println!("PATH IS: {:?}", result);
        pathfinding.path = result.0;

    let cur_position = transform.position;

    let dir: crate::util::Vec2 = IVec2::to_vec2(pathfinding.path[0]) - cur_position;
    println!("Direction :{:?} \n Mag:{:?}\n Norm:{:?}", dir, dir.mag(), dir.norm());
    if dir.mag() > pathfinding.speed {
        // if transform.position.to_ivec2().distance_to(*pathfinding.path.first().unwrap()) == 0 {
        transform.position += dir.norm() * pathfinding.speed;
    } else {
        println!("Popping point on path: {:?}", pathfinding.path);
        transform.position = pathfinding.path[0].into();

Hell yea, thats some saxy saxy shit