All right, guys, welcome back to the solution for this really amazing challenge over here.
The first video was one hour long and I guess no one any time for this one.
So I have prepared this video over here, which has been cut down to the 3D essential pieces over here.
I mean, we are going through this now a little bit faster, but we have already extensively reverse
engineered the important part.
Therefore, in case if this is now too fast and furious, then simply just drop me a message and I will
provide you the the other video, which is way more longer.
I do not want to re upload it over here because then people can get confused why we are having it twice
in here.
All right.
So we want to add an cuatro shot because in case if you can add four player shots, then we are also
able to add eight player shots, for example.
All righty.
So let's see, our player shot or this double shot is being created in line 138.
And let's see, line 138.
Do not rely on this.
Line up us.
Always double check it, please.
Yes, but this looks good.
Okay.
So the visual comment would be this one over here.
So you can easily recognize this.
But this is not well, it's smiley syntax.
Therefore I now using these comments which are the original smiley comments.
So create a new player shot.
Okay.
Let's do it again.
And maybe let's add a few more than we can recognize this from existing code.
So here is a new player shop.
This is line 138.
He starts the other line and we can see this one over here was one player shot.
Perfect.
And then we also comment out the other player shot, which is this one over here.
And this one ends over here after invokes static.
Yes.
Okay.
So that's good.
I guess you know what?
And let's do this one last time.
Maybe it's not the last time, but I guess it's it's easier to follow if we are having it in this way.
And if we try to build this application back again and still have these comments, these comments in
there, then we will get in smarty error and can easily fix it afterwards.
All righty.
Okay.
So now we copy paste this one and we insert it in between.
So let's say create our own new player shot.
Create our own new player shot and.
All right, so now we are having three player shots, but they are not visible.
Why?
We will find this out on a graphic tablet OC on a graphic tablet.
Let's see, we've got our spaceship, this one over here.
And this has now and double shot.
If you pick up a red coin, remember, this one is the it's the original version.
Therefore, our patch regarding to the blocking fire rate and also the double shot has not been adjusted
yet.
So if you want to test if you have a triple octa pander shot, we need to pick up a red coin first.
Of course, you can already patch it.
But in this video on this solution for now, I would like to go with the clean version that we do not
mess up something else.
Okay.
All right.
So if you pick up our red coin, then we have our double shot OC the first double shot and this one
over here is our player shot one.
And this one over here.
Barely on screen.
This is our second player shot.
If you draw our imaginary line, that's the exposition.
Yes, that's X.
So X is this one over here, left and right.
And then we can see here we are having sup v 11.
We know we 11 is -15.
And here we are subtracting -15 from the X position, which means this one over here is our player shot
-15.
And here we can see we've got edge v 11, which means we've got plus 15, which means this is our plus
15 right now.
There's our third player shot and this one over here and this one is at SAP 11.
So also at -50, which means it gets drawn over this one over here.
This is why we're having three player shots, but only two are visible.
So therefore we have to adjust the offset which is in the 11 right now.
So v 11 is holding the value -15, not zero.
We can see this one is a floating point number and now we need to adjust this value.
So there are several different approaches.
The first one we are going to do is we try to find another floating point number, put it into a register
or maybe reusing the register if it's not going to be modified in our function and then we will replace
it over here.
Which means if you find in floating point number, for example, -30, then let's clean this up.
So let's say this one over here is not v 11.
Let's say we are creating a new register.
We 16 and this one holds now the floating point number -30.
So therefore our first player shot at -15 will be drawn over here.
And now our third player shot will be drawn over here at -30.
This is just an example.
All right.
We have to rely on the floating point numbers right now that are in our function.
Also, maybe a good point over here, we can only use register of floating point numbers in our function.
So within our function over here, the function.
Let's see.
So the function is.
Process.
So we can only use these values which has been defined in the process function.
Because for example, if you are using a register over here or maybe over here or somewhere else, then
this is not available or might have been overwritten in our method already.
So therefore, if you're looking for four values, please only look in the method process.
Okay.
And yeah, I would suggest this is what we're going to do right now.
So our first attempt is reusing a floating point number.
The second attempt is creating our own floating point number.
And the third attempt is.
We will find this out.
But the third attempt I will promise this to you is the it's the most amazing part, because there we
have absolutely no limitations.
All righty.
Okay.
So let's see.
Okay.
So we go back to the beginning of this method and let's hope that we've got a floating point number
in here.
Process perfect B12.
And this one over here is the floating point number 25.
And it's start within the register B12.
So now we have to check if we 12 will be overwritten in our method because if you reach our code, then
it might have been stored or used another value.
So therefore, let's see, we are searching for B 12.
And this one over here.
I mean, we also have to check if we are still in the method, but we are just a few hundred lines above.
So therefore I'm pretty sure we are in the method, in the process method.
So let's see.
Nevertheless, we are just comparing V 12 so it's not being touched and here we are just duplicating
be 12.
Okay, perfect.
So this means we 12.
There is no other 12.
Yes.
Within the whole nice within the whole code over here we only got to be 12 used two times and none of
them is touching the register.
So we are just using it but not overwriting it, which means that's now it's super amazing because we
can go back to our line 138, which is it, line number 792.
So we can we can be sure that we 12 is available over here.
So let's see.
Yes this is create our own new player shock begin.
Absolutely.
Fantastic comment.
So what we are doing right now is we are using V12 over here and that's it.
This will end up in having a triple shot.
I mean, we are not having a Quattro shot right now, but let's see if this even works out.
If it does, then we can also adjust it for the left side.
So what we have done right now is we have created three player shots.
One is -15, one is -25.
And we are having a single player shot on the right of our spaceship, which is plus 15.
All right.
So, yeah, I have to remove the comments, otherwise we will get an error, I guess.
And to recognize that these are our comments, then we can make it in this way.
So I guess all comments has been replaced.
Looks good.
Now I'm going to build this application, prepare the smartphone, and then I will see you in a few
moments.
Okay, guys, here we are back again.
I'm super excited.
Let's see if this works out.
So we are installing our new version, then we are starting our version.
Och.
And now we play our new version.
So let's see.
We've got one player shot, which might be a little bit disappointing right now, but we haven't patched
our application to start within double shot and therefore we have to wait until a red cone appears to
verify if our patch is successful.
And there we have it.
We've got a good auntie.
Let's see.
Three, two, one.
Perfect.
Nice.
Yes, we can see.
We are having a triple shot right now.
And it's also working.
Aliens got hit by this shot.
And once again, we've got a really good auntie.
Yes.
So yeah, it works definitely.
Okay, perfect.
Nice.
So let's also adjust the other one and let me close this real quick.
Okay.
So let's add one more shot that we're having a quadra shot and also apply our pictures that we are having
a non blocking fire rate and starting with our cuatro shot.
All righty.
Okay, let's do this real quick.
So what we need to do is we need to copy this one over here.
This is the right side of our of our player because we are having it and we need to add, well, that's
it.
Now we're having an cuatro shot.
I hope cuatro is for.
Yes, yes.
Okay, good.
So now we're having a shot.
But yeah, we need to get rid of our fire.
Right in the fire.
Right.
This one over here.
So here we are putting this 25 into we zero and here is our time to shoot.
So we are putting the zero back into this time to shoot, which perfectly aligns with this one over
here.
Not this one.
This one so we can set this to zero.
Then we are not having this this block file.
Right.
Okay, let's do this.
Okay.
No fire, right?
But we are still lacking the the shot at the beginning, which means if we go back into our code, we
are not having this entity regarding to our top shot.
Therefore, we need to get rid of this one also.
It's within line 137.
I mean, I'm using this line numbers quite often right now.
Even if I told you you shouldn't rely on this, but they are okay to get to get an overview if you are
on the correct line number.
All righty.
So let's see.
On 137.
Kay.
So double shot.
Yes.
Move results and then equals zero.
Okay, then we jump to this condition.
I guess the easiest patch is if we simply removed us this if statement over here.
Yes.
I mean we are starting the result right now in v zero, but we are not using it, which means it looks
like the following.
Which means if we are allowed to shoot, which we are, because we have already adjusted this one over
here, then we are having now our double shot or in our case right now it's let's do it in this way.
It's in it's in cuatro shot.
So now we're having it this way.
All righty.
So, yes, let's clear the screen.
Yes, I guess this looks good.
So let's build this application back again and see if it works.
So I will see you in a few moments.
Okay, guys, let's see.
I have sibilance scientist application and we have it installed.
We have patched our cuatro shot non blocking fire rate and that we are starting with the shot.
So this would be now a really amazing application if it works, let's see the space ping level two and
let's see.
Fingers crossed, 3 to 1.
Nice.
All right.
So in individual machine, this might lag a little bit right now.
Okay.
So I guess I also have to turn the sound down.
Yes.
Okay.
So now we can see perfect.
This works.
And this game is now a little bit more playable, in my opinion.
So it makes it a little bit more fun.
Yeah, we can see it's lagging a little bit, but we've got a lot of objects right now on the screen.
Okay, nice.
So this is how we can re-use an existing register.
Cool.
But what if we are not that lucky and having an and floating point number at the beginning like this
one over here.
This one.
So how can we create our own floating point numbers?
And this is something we are going to figure out right now.
So we are creating a new register, putting in our own floating point numbers.
And then we can we can adjust this offset a little bit far away.
So for example, to make it an offset of 40.
Okay, so let's do this.
Okay.
So to create our own floating point numbers, this process is way more complex than you might think
about.
So it's interesting how how your processor is storing those floating point numbers.
But I guess we do not have to dive too deep into this because in the last video, I did spend 20 minutes
explaining the whole process behind this, but you can easily look this up online.
So for example, this site is pretty amazing.
Float to x, this one H Schmidt dot net and here we can now see.
Okay, we've got a sign bit, we've got an exponent.
And so if you're more interested in the in the details behind this, what is Exponent Matheson means
then I guess there's a lot of good material out there where people can explain this way better than
I do right now.
So for us right now, it means we are only having to insert this hexadecimal representation to get the
floating point number or we can do it vice versa.
So for example, if you want to have 25.0, then we hit enter and we can see 25.0 is represented in
this way.
So we've got the exponent two square for, we've got this as my terza as already mentioned.
Feel free to look this up and then we've got this hexadecimal representation.
Now let's compare this value with the one we've got over here.
Yes.
Okay.
So we can see they are identical.
And yeah, this is how we can create our own floating point numbers.
Okay.
In case if you do not want to use websites to create a lot of numbers because let's say you want to
create 1000 and you do not want to enter them all the time over there, then that's also a good StackOverflow
entry regarding to this one, how we can do this in Python.
So we simply search for flow to hex and python and then this all loops this take our flow entry over
here.
Okay, here we can see we've got a solution for 32 bits, 32 bit values and 64 bit values.
I guess within smartly, I mean we are mostly dealing with 32 bit values, but we can already or we
can also figure this out regarding to the instruction.
And for example, here we can see we've got const slash high 16, which means we're using only 16 bits.
So therefore the 32 bit approach should work over here.
But if you're having a 64 bit value, then we need to use the other approach and this one over here.
All right.
Okay.
So we can use it in the following way.
So let's open a new python shell and then let's see, maybe let's close this.
So we paste it in and we can see that's a function definition flow to hex.
We are providing a floating point number and we get back the hex representation.
Okay, so here we can see we are using struct unpack and therefore we have to import struct first and
now we can see we are picking this floating point number and then we are unpacking it.
And these are let's see what's the what's the official term for this one I format string.
Yes.
So these are format strings and I guess, yeah, we can see this over here.
So this is just a little Indian format and we are unpacking or we are picking this floating point number
and then we are unpacking it again to get the represented value.
All right.
So let me have this this method over here.
We can use it and float to hex and we can use 20.50.
Nice.
And this is also exactly the same venue.
So these are two methods you can use to create your own floating point numbers.
All right.
In case if you want to have an and detailed explanation on this one, then I can also provide an external
video and bonus video regarding two floating point numbers.
But this took me a long 20 or 30 minutes to explain it because yeah, maybe my explanation is also a
little bit confusing.
So therefore I skipped it out over here to say some time.
All righty, let's go back.
So let's say we are not that lucky.
Let's keep this in foreground and we are not having this 25.
So let's create a new register.
And now 16, 13.
And let's see.
Maybe.
I mean, we can also use a cost value.
So 32.
But then we we can be sure that we are matching we are matching the representation of the Spitz.
Okay.
So let's say we want to have flow to hex 30 right now.
30.0.
Yes.
So this should work.
Okay.
We use this one over here.
And we can also make our own comment that this one here is 30 and floating point numbers.
Alrighty.
Looks good for me.
So therefore, now let's add an additional shot with this floating point number.
So we go back line 138.
So now we are creating this once again.
Oh, this line numbers.
I would remove this because that's not good.
So I would remove those line numbers was a mistake by me.
But it doesn't affect this application at all as we have seen it before.
So now we are creating a new one.
Another one.
And now, instead of V 12, we are using our newly newly created register.
13 We are within the sup float.
So now maybe let's, let's draw this real quick.
Okay, so here we are back on the graphic tablet.
Let's see, we've got our spaceship over here and this is the, the imaginary exposition line and the
first one and this is regarding to V 11 and sub, which means this one was the first shot -50, this
is the original shot.
And then we have added this one over here and this is now B12, which was I guess -25, if I remember
correctly.
So we 11 was -15.
Now we are having a shot at -25.
And now we did create another shot.
And this one over here and this one is V 13, which is our newly own generated floating point number.
Yes, it is.
So this one is at -30.
So it's a little bit closer to this one and it is at -30.
All right.
Now we are having three shots on the left and we are having this one plus 15, plus 15 and also this
one plus 25.
All right.
So this is a way how we can easily extend these player shots, but it has a little bit of a downside
because every time we are we are creating a new one and we need to use or re-use our values.
We have to maybe create new registers like this one over here.
Therefore, I would like to provide you an let's call it a little bit smarter approach.
But first, let's finish this over here.
So okay, so here we are back.
This one over here, create another one.
And this is our our third player shot, which is holding the -30 in there.
Okay, let's copy paste this because we have now three on the left and two on the right.
So we also need to have this for the edit part that we are also creating the third player shot on the
right of our spaceship.
So let's copy this one over here.
And I mean, it doesn't really matter where we put this into.
We can put it in between over here or at the end over here.
It doesn't really matter.
I put it in between.
Okay, so now we've got the sap.
We need to replace it with it, which means we are now at the offset plus 30.
All righty.
Okay.
So let's pay back this application and see if it works.
And then we have a look into our final solution, which is, in my opinion, the most smartest one.
So I beg.
I have signed this application.
So let's see.
And let's start it.
So now we should have three shots on the left and three shots on the right.
So let's see.
Level five in 3 to 1 go.
Yes.
So we are having three shots, but they are not that visible.
I mean, we can see it at the end.
Yes.
Okay.
So the offset, we are just having an offset from -25 to -30.
So only an offset of five.
So I guess a better option is if we change this value over here instead of 32, for example.
40.
Yes.
But then we also have to do it.
So let's see.
I python three
import bin ASCII struct.
Okay.
And float to hex and we want to have 40.
Then it's a little bit more visible.
All right.
So this is how we can play around with floating point numbers, creating our own registers, and using
them to create new objects in this application.
Freaking awesome, right?
In case if you have soft ID in any way regarding to this point, no matter how, then congratulations.
You definitely deserve your blue bird afterwards.
In case if not, you can still try to try to figure it out on your own.
And now we are going to have look into an in a more smarter solution because creating these amount of
registers might be a little bit confusing and annoying.
So therefore I will clean this up.
We start with a completely fresh application and then I show you a different approach.
Alrighty, let's go.
Okay.
So let's look into another solution, which is, in my opinion, the most amazing one.
And this is based on reusing smiley instructions to adjust our offset.
Sounds absolutely complex, but I guess it isn't that complex if we have figured it out once.
So let's see.
We've got our spaceship over here in this one and here we have our double shot.
So this one is now a clean version.
This is the original version once again, because yeah, explaining this within a version we have already
patched, that's a huge mess.
All right.
So this one, this is our first shot, -15.
And this one over here is our second shot plus 15.
Okay.
So we are already adjusting the offset regarding to those two shots in this line.
And this one over here is subtracting -15 and this one over here is adding 15 to this register.
So another solution would be the following We will reuse this part over here.
So this means we are copying it and inserting it over here, and this means we are having an offset
of -15 because we have simply just copied it.
But now we are also reusing this instruction.
So we are also copy pasting this instruction to have it twice in there.
So over here we are also doing our supp minus float and so on.
This means instead of subtracting -15, we are now extracting -15, -15.
So we are extracting -30 at all, which means we are now having our newly created player shot at -30.
So it still might be a little bit confusing, but I guess if we are doing it right now and then reversing
it once again, it might be a little bit more clear.
All right.
This is the approach we're going to do right now.
And after performing this, we will have look into this and discuss it once again.
Okay.
So let's switch back and then let's go.
Okay, so let's copy this one over here.
This is one player shot and let's put it in here.
Oops.
Sorry.
New player shot.
Begin.
And so now we're having here our third player shot, but it overlays with the other one.
But now.
Now we're using this instruction twice.
And that's it.
What happens right now is the following.
And let's get back on the graphic tablet.
Okay.
So let's discuss this part over here.
Only this part right now.
So we've got our spaceship and we're creating or we're getting the entity world into zero.
All right.
We have discussed this in the past.
Then we are fetching the position X and putting it into V one.
So we one is holding position dot x.
And now we are subtracting we one or via subtracting B 11 from B one.
So we won at this line we are now at this line is now we won -15 because we 11 is holding the value.
15.
All right.
And this is also what we can see in the chad output.
So maybe let's go back to this one real quick.
And there we have it.
We are within create player shot this world and we are now using or we are subtracting -15 from position
X.
All right.
So back to this one over here.
Now, we want to create this player shot here at -15.
But now they are sick, Lou.
We are using the SAP command once again, which means we are having it once again in our code, which
means we one is now once again, we one -15.
So this math, I guess, is not that complicated.
If we are subtracting we one -15 and then doing it once again, we are in total subtracting 13 from
the one, which means we are creating and play a shot at -30 right now.
And this means we can we can do this how often we want.
For example, we can we can copy paste this once again and within the next copy paste or play a shot.
Over here we are adding another line sub float which means we would extract, subtract, sorry, another
15 from our player shot, which in total is 15 plus 15 plus 15 is 45, so at -45.
And of course this also works for the for the add part.
So we can, we can now adjust our our shots within a step of 15 by simply just reusing the sub command
once again.
Amazing.
Right?
So this is, I guess, the most easiest way to spread out our player shot without creating a lot of
registers.
And that's also pretty smart because we are using existing instruction to perform this.
So let's do this over here.
If this is now a little bit too fast.
I mean, this part alone has been 30 or 40 minutes within the last video, but I guess that's way too
long that you want to watch this.
If this is unclear, absolutely no problem.
Drop me a message.
We can also discuss this together and figure out if there are certain things unclear.
So that's absolutely no problem.
But I do not want to spend another hour on this one if this is now crystal clear to you right now.
Alrighty.
Okay, perfect.
So let's do this over here.
Okay.
This may get a little bit messy, I guess, but let's see if we can handle this.
Okay, so now we've got this one over here and we copy paste it in here once again.
And what we are doing right now is we are subtracting another 15, another one from our player shop.
So now we've got -15, -30, -45.
And I guess we can also do another one.
Let's see.
I mean, in case if we are inserting it once more, then we are just increasing the offset.
So it's not like that we are adding these these match player shots right now.
This is just regarding to the offset.
This is like you want -15 all the time.
All right.
I mean, regarding to math, this is simply just yeah, -50, -30, -45 and and so on.
At the end, this one holds the holds, the end result, all of the subtraction values.
Okay, let's clean this up a little bit.
Okay.
So here we are at three.
So therefore we subtract four over here.
Okay?
So now we've got the left side.
Let's do it also for the right side, which means we are copy pasting this one over here.
And once again we do it this this clean.
All right.
And this time, instead of subtracting, we are adding this.
So we are simply just adding another 15 to our value.
All right, then we copy paste this once again, another one.
And once again.
Another one.
OC.
As already mentioned, this is the original version, so we have to pick up a coin first.
But if we are performing such or let's say, more complex patching, then it's a good idea to just focus
on one single patch instead of applying all.
I will apply all afterwards and see how this game looks like because I guess it's a lot of fun afterwards.
All right.
But now let's simply stick to this one and see if this works out.
Then we can adjust our other patches regarding to the blocking fire.
Right.
And also the yeah, that we start with this shot because we have to pick up a red coin first.
So I will build this application and see you in a few moments.
Okay.
So here we are back again.
I'm super excited to see how this works out.
Let's install our new version.
Success.
We did not know.
Sorry, we did not have any build errors.
That's good.
And now let's see.
Level five.
Yes.
Singleplayer shot.
We have to wait until a red coin appears.
So I create a little bit of space.
Why keep dying?
And then we have to wait.
Okay, guys.
Debbie Halford, let's see.
We pick up the coin and there we go.
All right.
It's a little bit laggy, but it works.
So, yes, you can see it.
It works perfectly, which is super amazing right now.
So now I'm going to add also our other pictures and I will introduce a little bit of more shots right
now because adding some new shots, I mean, it's just a matter of seconds, right?
Absolutely.
So I will see you in a few moments.
Okay.
So here we are back.
I have added a little bit of more shots.
I'm not sure if it's now synchronous left and right, but we will find this out in a moment.
And not blocking fire.
Right.
And that we start with these amount of shots.
So let's install our new version.
Okay.
And let's start it.
Let's see if this works.
So, level five, three, two, one.
Yes.
So you can see you can extend it as much as you like.
I guess the only limit to this one are those limits or these limits of your smartphone right now.
So it's a little bit laggy on the beam on the smartphone.
It looks pretty good.
And also, let's verify picking up a red coin.
Yeah.
Doesn't affect us all.
Okay.
So this is in my opinion, it's a very, very nice solution for this challenge over here.
And yeah, the video that once again get pretty long.
So sorry for this one, but I guess this challenge is one of the most amazing challenges in this in
this whole course over here.
And therefore, I would like to put as many information into this as we have right now.
Okay.
Maybe one last hint.
If you patch some applications like this, I mean, you can also verify it afterwards, how it looks
like.
So we simply open this with the screen.
We go into the player input system, so it's within the graphics and systems and then the player input
system.
Yes.
And now if you scroll down, there we go.
I mean, it's exactly like we have patched it.
We use our position -15.
The result of this will be once again reduced by -15, the result of this once again, and so on.
We can also see this double shot.
CM has the check is being in there, but the if statement has gone.
So yeah, the result value b0 zero is holding the result value over of this one over here.
But we are not going to use it in our code.
So therefore the if condition has gone and therefore we start with this player shot and here he is,
the other patch where we override our time to shoot with zero.
All right.
So thanks for being that patient with me and going through this whole solution now.
You definitely deserve your blue bed afterwards.
All righty.
So I hope this was funny also for you.
For me, it was a lot of fun and I love playing around with these applications and patching it in this
way.
We have already figured out that you create player shot also contains a lot of more funny stuff.
Feel free to play around with this one.
And yeah, of course if you have questions regarding to this one or regarding to other applications,
then yeah, just drop me a message.
I'm super happy to receive some feedback on this one.
All right.
So this is all for a solution we do right now.
Sorry if it gets long once again, but it wasn't that long as the last one.
So therefore we saved a little bit of time.
And now I'm really looking forward to see you in the next video.