How can you make an object disappear in ROBLOX over a certain interval? - lua

I'm making a game in ROBLOX, which has a cutscene in it at the start. At the end of the cutscene, the camera zooms up on the character and you spawn in. However, when I spawn in, I can see the dummy I used for the cutscene, so how after a certain interval can you make that dummy disappear?

Does the dummy just need to become invisible? If so, every physical object in ROBLOX (or more formally Part) has a .Transparency field that spans from 0 (for no transparency) to 1 (for full transparency, or in other words, invisible). I don't know what your "dummy" looks like in the object hierarchy, but let's say your dummy were a Model located at workspace.dummy, and that it has a head, torso, left arm, etc. located at workspace.dummy.Head, workspace.dummy.Torso, workspace.dummy.LeftArm, etc. To make the Parts of the dummy invisible, you would have code that looks like this:
workspace.dummy.Head.Transparency = 1
workspace.dummy.Torso.Transparency = 1
workspace.dummy.LeftArm.Transparency = 1
...
And so on. This, however, will make the dummy invisible to all players. If you are making a single-player game, this will not matter; however, if it is a multiplayer game, then this could be a problem. Making the dummy non-transparent again to do the cutscene for a new player would make the dummy visible to all players. If this is a problem for you, there are two things you could do that I know of:
The first and easiest way would be to just have the cutscene take place at a location very far away from where your game occurs; for example, you could shift everything in your cutscene 10,000 studs in the X direction. This would ensure the objects in the cutscene would be out of the render distance of the players playing the actual game, so only the players whose cameras are being manipulated to carry out the cutscene would see it.
The second, more complicated, and not future-proof option involves a very useful bug that is frequently taken advantage of but subject to being fixed at any time since it is not an official feature. This bug is the exploitation of a Camera (or less commonly a Message, which is deprecated) to create what are called local parts—Parts only visible to a certain player. How to create local parts and discussion of benefits and consequences of using local parts is a little complicated and beyond the scope of this answer. Go here if you'd like to learn more. Taken directly from the ROBLOX Wiki at the time of writing:
Local parts are in no way supported by Roblox. They exploit unspecified replication behaviour - at any given moment, the development team could release an update that changes how Camera and Message instances behave, preventing you from making local parts.

Related

How would you go about creating a random spawner for coins within a certain area? It has to re-spawn coins after the player has collected enough too

I have a coin which rotates and changes size so far. I want to be able to set an area (which is not a nice square of course) that they can randomly spawn locations. The thing it has to do is once there are less that 7 coins then it spawns more.
Anyone able to give me some advice? Not sure what is most efficient method.
It sounds like you should be making use of ZonePlus and its getRandomPoint function.
If you want a direct reference, the creator of the module made a playground and its source code is publicly viewable. The playground contains a 'CoinSpawner' (literally what you're looking for).
You can either make use of "Region3" or you can set up multiple possible spawn points and run a math.random function to choose which one.

How to add "Action Points" to Scenekit Game using Gameplaykit or something similar

This is a very common question, and I am not asking for technical details. What I am looking for is an approach or best practice guidance for the following situation:
Imagine a jump and run game entirely made with SceneKit. The game is played by controlling a character running to the right or left side, climbing up walls and jump over obstacles. (it is a 2½-D style game where the character always runs in one direction or it's opposite. Mainly on the x-Axis)
At certain "locations" (on the scene x-axis) I need to implement some specific actions, that should occur as soon as the main character walks, jumps or runs over that specific point.
What I have done so far, is adding simple invisible SCNPlanes with static physics bodies, with the bitmask configured to detect only the contact (no collision). In the physics handler (physics delegate) I can now fetch contact of the objects the character trespasses. Currently I have a large switch-statement to fetch the names of the "Action-Walls" as I call the planes through which the character walks. So, I can trigger whatever specific action that I want to happen at that location.
It is working this way, even quite good, but I wonder if there is a way to add some better "action points" using i.e. Gameplaykit, but I only find information about agents and behaviors or pathfinding.
What I am looking for is some static point, when trespassing it, an associated action happens.
I have no clue about the possibilities of Gameplaykit. Can anyone tell me an approach using Gameplaykit or whatever Apple has in its magic box of useful tools to make this better than using action walls of SCNPlanes and the physics handler?

Deflod rendering issue

I am going to make simple 2D game in Defold game engine and I am new in this area. My question is, I have 2 game objects every object has sprites in it. A sprite in the first game object must be background for sprites of second object. I have designed it well but when I run (or render, I don't know how to call properly) it sometimes sprites of second game object are invisible and some times everything is OK.
The same issue if I set main backgruon image for the game. Please share your experiences with me. Thanks beforehand.
You posted the same question on the official Defold forum so I'm going to replicate the answer you got there here on SO as well. The solution is to make sure that the depth of two game objects that overlap isn't the same. If two objects have the same depth and overlap you might sometimes see one in front of the other and sometimes vice versa. The default render script allows a z-range of -1 to 1 (you can use fractional z-values to get fine grained control), but you can copy it from builtins and increase the range if you want to. Something like -10 to 10 is usually a good enough value.

Optimized RPG inventory parsing using OpenCV

I'm trying to develop an OpenCV-based Path of Exile inventory parser. The inventory looks like this, with items left and right. The round things on items are called "sockets", are randomized, but they can be hidden.
There are two options for this:
When you hover an item in game, and press CTRL-C, a description of the item is copied to your clipboard. A solution would be to do this on every single inventory cell, to re-create the whole inventory, bit per bit. There is an issue with this, however: the "item copy" action is probably logged somewhere, and having 12 * 5 = 60 actions like this in under 2 seconds would definitely look fishy on GGG's (the devs) end.
Using image-recognition software to decompose the inventory like a human being would. There are several methods with this, and I'm struggling to find the most effective.
Method 1: Sprite detection
This is the "obvious" method. Store the sprite of every single item in the game (I think there must be around 900-ish sprites for all the bases and unique items, so probably around 250 sprites if we exclude the unique items), and perform sprite detection for each of them, on the whole inventory. This is without a doubt extremely overkill. And it requires tons of storage. Discarded.
Method 2: Reverse sprite detection
For every single sprite in the game, calculate an associated md5, and store it in a file. Using OpenCV, cut the inventory's items one by one, calculate their md5, and match against the file to detect which item it is. It's probably faster this way, but still needs a ton of processing power.
Method 3: Same than #2 but smarter
Use OpenCV to cut the items one by one, and based on their size, optimize the search (2x2 item means that it's either a helmet, boots, gloves, or a shield. 2x1 item is always a belt. 1x1 is always a ring/amulet, and so on).
Is there another method that I'm forgetting? All of these look like they need both heavy processing, code, and before-hand work from me.
Thanks in advance.

How to create "fluid" or "squishy" bacteria-like nodes in swift

I'm currently designing a game in Swift and Spritekit that calls for bacteria-like graphics for the main player. I have no idea how to approach the physics and visual effects of a node like this. If you don't know what I'm talking about, here's a visual:
So basically the player is a circle/oval that can completely alter it's shape based on the surrounding structures.
I've tried this by creating a huge array of nodes strung together to create the larger structure, however this is extremely inefficient and lags the computer when I try to scale it up to multiple players. I also want to fudge this the least amount as possible since it requires realistic (or at least expected) physics of something like this with the ability to jump, move, slide, etc.
Thanks!

Resources