Sprint #2.5 - Daily Scrum #12
Product: Tetris2P AI
Sprint Summary
Daily Objectives
- Finish rewriting the new collision resolution function
Notes
I think a ‘bottomOnly’ collision needs to ensure both left and right sides are both included or excluded
- Same with rightOnly collision needing topandbottom?
Nevermind, I think I need to add some sort of partial resolution instead of just hard setting the position. How should I implement this so its efficient? First I need to get the expected x and y displacement. I don’t want to keep iterating until I find a proper position resolution, since that would be too much work for just a resting object. Maybe we should return how the x and y distance of the overlap with the collision, or add a checking function for it. Take the bigger displacement value and scale back the x and y displacement of the player object so the displacement would be 0. Let’s iterate/draw out the edge cases. I think what’s actually more important is what direction the collision happens first. What determines which direction the collision happens first?
Ideas:
- Move x and y displacements separately?
- check distance of axis displacements
- If displacement is greater than width or height, then its one directional collision
Tentative Final Answer:
- If you’re able to remove a collision by only removing displacement on one axis, then the collision is along that direction.
- If you’re able to do (1) on both axis, then take the axis with largest displacement
btw, you can implement sweeping aabb collisions later on if you want, but for now I want to deem it unnecessary overhead calculations. I wanna make it a completely separate function later anyway, but I’d like to actually start my tetris game as soon as possible. :)
What’s the process for implementation:
- move position, check for collisions
- pick larger displacement value and check if collision still exists without it
- if collision disappears, then assume collision in that direction
- If collision is still there, then assume collision in perpendicular direction
Currently facing a bug where setting the AABB’s max height to the ground’s min height causes a bug, but setting it to the ground’s min height minus one will work properly. I fixed the issue but changing the collision function to less than or equal to’s rather than less than’s (and greater than’s).
Cool it’s working now :) Cool I also got a mini state machine for drawing different colors onto the canvas :)
What’s next?
- Start the hecking tetris game
- Do some sprite animations
- Start exporting as npm module
Let’s do the exporting as npm module part first
For that I think I should make a new git repo? Also let’s make sure I still have npm and node installed.
- npm version 6.9.0 :sunglasses_emoji:
- node version 12.3.1
https://docs.npmjs.com/creating-node-js-modules What’s the goal here? I want th developer to be able to install the package using npm install, but also be able to download the package and using for client side code. There’s really only three (potentially four) important files that needs to be minified down to one file:
- Engine.module.js (tentative name)
- Scene.js
- GameObject.js
- AABB.js
- Mainloop.js library (need to link)
What should I be looking up? Exporting javascript classes as node module? I can have a minified javascript file to include in client side html that exports the classes.
I still need to recreate the project as an npm thing? I didn’t get to accomplish much today, but I guess the goal by friday is to have this public on github :)
Objectives Completed
-
finished a rewriting a collision function and resolving collision for a mini platformer
-
created a mini state machine for sprite rendering in my platformer example