Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Squish is a way to utility package for Homegames-core and Homegames-web. It contains several utilities and the class definitions for the entities most important to running Homegames.
Below the term First Class
is used to describe several functions and variables. This means those values should be treated as immutable, and in the case of functions are called automatically.
squish is a first class function that is used to compress the information of the game down to a set of integers. This compresses the data required to rendering down.
unsquish is a first class function that is used to uncompress squished entities. This uncompresses the data that was squished down for more easy manipulation and usage.
gameNode is the most foundational component to Homegames. The contents of a game is made up of a set of gameNodes that define entities, and display logic. Wrapped in a listener it contains the following:
A helpful wrapper and the recommended way of generatin a gameNode. It gives you the following:
Asset(onClick: (player) => console.log(player), coordinates2d: [[0, 1], [2, 1], [2, 3], [0, 3], [0, 1]], assetInfo: { myAsset: { pos: { x: 0, y: 1 }, size: { x: 2, y: 3 }}}, playerIds: [2])
myAsset
and on clicking on the asset the asset will log out the clicking player.Shape({ color: COLORS.CANDY_RED, onClick: (player) => console.log(player), shapeType: Shapes.POLYGON, coordinates2d: [[0, 1], [2, 1], [2, 3], [0, 3], [0, 1]], border: 2, fill: COLORS.CANDY_RED, playerIds: [2], null, null })
Text({ textInfo: { text: "My Text", color: COLORS.CANDY_RED, align: 'center', x: 2, y: 3, size: 1 }, playerIds: [2] })
Colors is a utility for using shared homegames RGBA values. Colors is exported as an object with two keys: COLORS & randomColor.
COLORS is an object that takes the form of: string -> RGBA Array
. For example we can GET the RBGA value for Homegames CANDY_RED (RGBA of [246, 84, 106, 255]) by doing the following COLORS.CANDY_RED
. Thus COLORS serves as a map between strings and in-built colors.
randomColor is a function that takes the form: string[] => RGBA array
. It is a function to get a random RGBA from the set of RGBA that Homegames provides. It can take in array of strings that limits the options, allowing for the exclusion of certain RGBA values from returning. For example we can call this function like randomColor(["CANDY_RED"])
which would return an RGBA array from the set of COLORS while preventing CANDY_RED from being a possible return value.
Game is the base class definition for a game in Homegames. Most games will extend the definition to Game, and leverage most or all of its internal logic. Game holds the following Member Variables:
player id -> player object
Game also holds the following Instance Functions
players
value.players
value.listeners
value.listeners
value.root
value. An example call would be: getRoot()
. It is expected that this function is overwritten in the extending class's definition.timeouts
value. It takes in two arguments a function to be called at the end of the timer, and how long the timer should be. An example call would be: setTimeout( () => console.log("Welcome to Homegames"), 200)
intervals
value. It takes in two arguments a function to be called at the end of the timer, and how long the timer should be. An example call would be: intervals(() => console.log("Welcome to Homegames"), 200)
timeouts
and intervals
from the Game, as the Game instance is spun down.Shapes is functionally an enum of the types of shapes Homegames supports.
ShapeUtils is a utility for building shapes for use in GameNodes. ShapeUtils is exported as an object with two keys rectangle & triangle.
rectangle is a function that takes the form (startX, startY, width, height) => the rectangle's coordinate set
. Thus rectangle creates an array from the starting x position, the starting y position, the width, and the height that defines the vertices of the rectangle. An example call would be: rectangle(0, 1, 2, 3)
which would create a rectangle with the top-left corner at (0,1), and bottom-right corner at (2, 4).
triangle is a function that takes the form (x1, y1, x2, y2, x3, y3) => the triangle's coordinate set
. Thus triangle creates an array from provided vertex pairings. An example call would be triangle(0, 1, 2, 3, 4, 5)
which would create a triangle with vertices at (0, 1), (2, 3), (4, 5).
terrainGenerator is a utility function that generates a "board" from the provided information. This "board" functions as a map, defining regions of the board that are randomly marked to be "filled". This can be used to procedurally generate fields of play with parts of the map unaccessible to players. The "board" is guaranteed that all un-filled points are contiguous. An example call would be: terrainGenerator({ x: 50, y: 100 }, { x: 2, y: 3 }, 5)
. This would generate board of area 50 * 100. The "filled" regions would be of area 2 * 3, and a maximum of 5 such "filled" regions will be placed. The outcome of this would be two-dimensionl area, where each element has the form
{
filled: boolean
north: boolean
south: boolean
east: boolean
west: boolean
}
filled of true means this place can be marked as inaccessible to players
north of true means from this place a player can move "north".
south of true means from this place a player can move "south".
east of true means from this place a player can move "east".
west of true means from this place a player can move "west".
FAQs
squish & unsquish stuff
The npm package squishjs receives a total of 293 weekly downloads. As such, squishjs popularity was classified as not popular.
We found that squishjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.