December 2016 Game Dev: 2D PCG Shooter

That is awesome. We can turn the clone into a feature by having a power-up that (temporarily?) spawns another player. Imagine five of these little dudes running around …

GitHub shows that your branch is 21 commits behind master and 2 commits ahead.

Did you merge master into severok and then push?

Technically we can keep adding objects into the player list, so that should not be a problem.

I thought I pushed it… maybe not…

I have an amusing new bug while working on object collision.

This basically tells me that the splash_screen is spawning out of control, making new copies every frame… until I punched it.

Added additional stop-gap fix in game_start by clearing the misc_list to ensure that the splash screen is removed.

I’ll take a look later tonight inshaAllah


1st Blood.

Edit: Just pushed my branch
when I call ‘git merge master’ it just states that it is already upto date.

$ git merge master
Already up-to-date.

I feel like I am doing something fundermentally wrong here?

Edit: PSA: Bullets are equal oppertunity. Do not walk in the same direction you are shooting

It’s been fun but I am calling it a night.

I’m not an equal-opportunity bullet collider. No self-death plzkthx.

You’re good to go on the merge side. You’re 9 commits ahead of master (your unique 9 commits) and I’m four commits ahead (my unique 4).

Please merge and push to main whenever you feel like it. The more often, the better. Ditto for merging (my changes) from main into your branch.

@BloodMoney has entered the ring. His contribution, inshaAllah, will be game design. So, please work with @roketfiq to get the art + game design consistent.

Then, we’ll see about how we can put some sort of Islamic or educational spin on it.

I think @severok and I will shortly be done the “basic” features from which we can start brainstorming + experimenting.

@BloodMoney Welcome aboard.

Tonight Insha Allah I will start my experiments with AI.

I have been rethinking my approach however, how about instead of hard coded behavior functions selected by the object attribute, how about a single function that is affected by a configuration attached to the object ie a json file outlining behavior attributes like:

Aggression
Preference range vs melee.
Agro range
Preferred distance
Etc.

Then having a general ai function make decisions based on the behavior configuration attached to the processed object.

we’ll see about how we can put some sort of Islamic or educational spin on it. -Ashes

Pew Pew Pew - Severok

Play Pixel Purge and you’ll get an idea of what I have in my head: enemies randomly spawn, and slowly get bigger/stronger and new types show up. I envision the same thing.

Having said that, I think the AI is good enough as is – we don’t have waves spawning, damage, etc. yet so we can come back to AI once those are done. I think we just need some pre-set AIs (which we have) and we can start randomly spawning creatures with those AIs (and the corresponding image), eg. aggro always has the red tank sprite.

Also: wave generation is easy. Just assign a point value to each monster (eg. coward melee = 1, coward range = 5, aggro melee = 3, aggro range = 10) and pick a simple formula (eg. 10 points per level) and pick randomly (within reason) monsters up to that amount of total points.

Starting work now. This post will be updated as I get stuff done.

@severok there’s something wrong with your GitHub profile. Your commits aren’t linked to your account properly (your profile only shows 5 commits, you have 10+). Can you please run these commands, substituting in your GitHub user name and email?

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

Edit 1: fixed the splash-screen thing (root cause) inshaAllah. Also fixed broken update-calling on the splash screen sub-object. Yeah, that broke somehow.

Edit 2: implemented dynamic reload. Open your IDE on one screen and object.json on the other. Run the game. Then change the size of the slow object to 10. Wait a few seconds. Observe. Be impressed. (Please?)

Done for the night. Please merge ashes999 branch if you’re cool with this. This is what I meant by configurable, dynamically-reloaded content.

Yo art team,
It occurs to me that our game is going to need some music. But since we are an Islamic team, how are your vocals?

Anyone interested in laying down some Nasheed tracks for us to insert near the end of the project?

I still am not home yet since Thursday night is when I take my wife shopping and tomorrow I have to go to work early to prepare for a presentation. Insha Allah I still can find an hour to contribute tonight.

Alright, Checking in.

I got about half an hour or so, so lets see what I can do.

To start off, Dynamic reloading is awesome. That is going to be really useful for debugging and balancing later.

Doomed

Idea

Victory

Edit:
They are getting smarter… RUN

ARGH

Agro AI: Charges directly for player, starts Melee attacking @ range of 10.
Coward AI: Holds distance @ range or 200 ± 50, attacks at range.
Slow AI: Agro @ 30% speed. Has 3x health.

Player death recalls the start_game function.
Added command to clear the active_objects list - works however…
function contained command to start enemy spawning thread, thus on each restart an additional thread is spawned and enemies start spawning faster.

(1st 2 seconds of life… 30 or so)

Prepare to die.

And I am most definately done for tonight.

  • AI in 3 flavors
  • Enemys attack
  • Bullets hurt everything, previous bug resolved (No more shooting self).
  • On death, game restarts (Player can take 3 hits before death)
  • Changed enemy spawning, now spawn in random positions on box 100 pixels off screen.

It now actually plays like a game!

…Those cowards are terrifying creatures.

I added an extra attribute to the objects called “Cost”
In enemys it represents the cost of spawning.
In players maybe the cost of changing player object (Class?, Level up?)
In bullets it represents the cool down period between attacks.

My plan is to further improve spawning where the game tracks the number of enemys destroyed and tracks it to level the player.

  • Every game tick, a counter is increased by the player level.

  • the game selects the next enemy type to spawn, and waits until the counter > the enemy cost.

  • Enemy is spawned, the cost is subtracted from counter

  • As game progresses, enemys spawn faster. Weaker enemies spawn faster than stronger enemies, ie weaker in larger numbers.

  • If you find yourself in a quiet moment with no new enemies appearing… you know something BIG is on its’ way.

Technically I have now hit all my initial targets so I am happy to take on more requests.

I think today marks the end of week1.
@ashes987 how do you think we are progressing?

I think we’re doing excellent. Splendid. Wonderful. It’s time to iterate on game design.

Please pull/merge my branch. Here’s what you get:

Sorry I didn’t check in last night.

I was trying to put my son to sleep then suddenly my Alarm went off for Fajr.
I was also trying to find time this morning but my wife and I need to travel out of town today and have been busy getting ready.

Insha Allah I will be back in form tonight.

I would like to try focusing the game with the player in the centre of screen then rendering the sprite locations reletive to the player, allowing us to move around in a larger game world.

I am imagining it as:

Object.sprite.move_sprite(object.x - player.x + screenwidth/2 , object.y - player.y + screenhight / 2)

In my mind, that should place the player in the centre as they always move to (screenwidth/2, screenheight/2) with all other sprites being rendered against that offset.

Maybe before the sprite is rendered, check the location and pass if outside of the window range.

Okay, 10 minute code attempt:
Sort of works but with bugs.
Works fine when you stay around the center of the background sprite.
If you walk off that, the player shots start aiming in the wrong direction

pushed, but have to run.

No worries about the life stuff. Life happens. I’m glad you have your priorities straight (de-prioritizing the game over family stuff).

I would suggest rolling back / undoing your change. This feature is hard to get right (“world” vs “screen” coordinates, scrolling, wrap-around the world possibly, etc.) and not really that valuable.

I would prioritize this as “maybe if there’s time”. I’ll make a list of stuff in the GitHub issue to do “mandatory” and stuff to do “maybe if there’s time.” Truth be told, we just need a story/background/theme and some concrete monsters and guns, maybe power-ups, and maybe a wave counter or points or something. Progression of difficulty, with some milestones (eg. some types of enemy only appear after X conditions are met).

The real change was 1 line of code when the Sprite location is updated which I can change back easily.

There was an additional change where I pass the main list to the process function instead of the specific object type list which is a change I wanted to make anyway.

I was more curious about how well it would work off setting all the sprites every frame and it would only take a moment to make the change.

For my next serious target after I have finished the new list of assigned tasks would be to implement a sound engine.

As as experiment if I get sounds playing easily enough I would like to pass the object associate with the sound (eg enemy firing a shot) and setting the sound volume for the distance from the player.

Setting sound distance makes sense for non-important or non-urgent sounds. Things like gunshots, etc. the sound is another useful piece of feedback from the player. They would miss it if the sound is too distant. I personally wouldn’t implement that as distant sound myself.

Can we focus on the core game first? We need at least power-ups and a couple of guns and some sort of difficulty progression (stages, new monsters, something) over time.

Pasted from GitHub issue things to do @Severok:

  • Pick the proper game window size and update the game (this will require some rebalancing, and possibly tweaking sizes of stuff, spawn rates, etc).
  • Turn the melee weapon into an actual solid rectangle that blinks in and out of existance, instead of the current shot.
  • Cover: 10-20 objects randomly scattered on the screen that absorb bullets and can’t be walked into (neither by us, nor by them). They’re destructible, given enough damage (10 hits?).
  • Stop the player from moving off-screen

I’ll do the last two if you do the first two.

Today I am tackling the melee attack and turning it from a short range clone of the ranged attack into an object held near the player.

There is probbably a good reason why I am not on the art team.

Note: Sprites now rotate based on the direction they are moving.
Currently working on the sword box.
I want the sword-box sprite to appear facing the correct direction on spawning so needed to sprite rotating and re-centering.

  • Added 2 attributes to the objects for purpose of calculating centering parameters on load. Attempting to reduce the amount of processing required frame to frame by precalculating and storing static co-efficients.

The bugs were an added bonus.
Every game has bugs, if they are in the art then maybe they don’t have to be in the code.

I guess that is it for today:

  • Melee attack has been altered -> Short range attack now a static object held infront of player.
  • Attacks no longer process collisions against the object that spawned them
    • Added attribute ‘parent’ to objects to track ownership
    • I had a problem with stabbing myself during melee.
  • Sprites now rotate to the direction they are currently moving.
    • ‘Sword’ sprite will point in the direction the player attacks.
  • Added new bugs to game.
  • Reduced accuracy of ranged enemy. (Balancing)

Todo tomorrow:

  • Alter collision detection for rotated sprites.
  • Pyglet sprites are rotated around bottom-left, not centroid. Must re-calc sprite location + width against angle.

Rotated polygon collision is really difficult. I did this once. I hope you can figure it out quickly because, if not… we’re in trouble.

You forgot to check in your new sprites. Using an IDE like Visual Studio Code helps with this (GIT integration shows “files on disk that aren’t set to be committed yet”).

Your art is better than mine, mashaAllah tabarakallah. My craters are jealous.

I am still going with the cheap and easy AABB method, but instead of using the raw sprite attributes, I will calculate a box around the rotated sprite given that I know its’ origin, dimensions and rotation.

Sorry about that, I have now uploaded the missing images.

There is a little jitter with the sword. This is because I assigned it a health and cooldown of 10 so it refreshes every 10 frames.
I made the sword follow the mouse around so that the player could swing the sword. For now I have the sword being continously spawned in the approriate location to avoid coding a new AI for it, but did not want to call the object-spawn function every frame and risk slowing things down too much.

If you set the health and cooldown to be 3 and 2 respectively, it should follow fairly nicely.