#luastg chinese tutorial
Explore tagged Tumblr posts
Text
English Commentary on a Chinese LuaSTG Tutorial Pt 2
This part is about combining the Repeat node with Variables
= = =
Video 3: https://www.bilibili.com/video/BV1st411N7Kg?p=3 tl;dr Stuff about 60FPS (this was covered in the last post) and using the Repeat node with Variables
Context: I believe we need a bit of context before diving into this video. This tutorial seems to use an older version of LuaSTG lacking newer QoL features. The first part of the tutorial is notably focused on creating a group of bullets using the Single Bullet node.
The actual concept they put into practice is sound (i.e. using the Repeat node in conjunction with Variables) and it's still a useful video but please note that this tutorial was for a version of LuaSTG that seemingly did not have the "Create Bullet Group" node (which can replicate what was achieved in this tutorial with far less hassle).
Also, you may notice that the tutorial makes use of Intervals within the Repeat node... and that the Sharps editor's Repeat node does NOT have an Interval parameter. This is something of a problem with trying to follow this tutorial.
When following and trying to recreate some of their examples, it is possible to use the Wait function in place of Interval. But in other scenarios, Wait will not work. I haven't figured out why Wait works sometimes but not others but be wary of that.
Content
3:04 is when the tutorial gets to the good stuff.
In case you're not just watching the video, when you create a Repeat node, you should see directly under the "Times [repeated] parameter four other parameters: these are Number of Var(iables), Var [no.] Name, Var [no.] Init Value and Var [no.] Increment.
Number of Var determines the number of variables in the Node. By default it is set to 1, meaning that besides "Times" and "Number of Var" there should be three other parameters (all related to each other). If you set the value higher, you will multiply the number of the three following parameters by whatever number you've inputted (i.e. you put "Number of Var" to 4, you will enable to Repeat node to have 4 sets of the following three parameters).
Those three parameters make up the Variable that will be used in conjunction with the Repeat node.
Var [no.] Name (1) is the variable name.
Var [no.] Init Value (2) is the init (initial?) value of the variable.
Var [no.] Increment (3) is the value of the increments.
1 is obvious. You must give your variable a name so that the program knows when you're using it. Note that there are some restrictions on what you can name your variable. I don't know these restrictions from the top of my head, but they are there, so not every type of name will work.
2 is the initial value of the variable. What is in the initial value? It's hard to explain because you can basically substitute variable into different parameters, and different parameters use the same values differently. Quick example. What happens if you use 0 on Velocity when creating a bullet? The answer is "you will spawn a bullet that doesn't move". Now what happens if you use 0 on Angle? The answer to that is "you will spawn a bullet fired at 0 degrees (aka to the right of itself)"... but even that's not true in all situations; a bullet fired at 0 degrees with Aim To Player active won't fire at 0 degrees, it'll fire at the player. Why am I bringing up these examples? The answer is that you can actually use a Variable for these two parameters (i.e. Velocity and Angle) as well as others. However, as you can see, the init value is very context dependent which makes it tricky to explain. The only thing consistent about init value is that it's the starting value for our variable. No matter whether it's for angle or velocity, the number you put into the init value is the number the variable begins with.
Now, increment... Let's see what increment actually means. Merriam-Webster has this very convenient first definition of: "the amount or degree by which something changes". It's a useful definition for bringing up "amount or degree" since increment can change either of these, depending on the initial value of the variable. However, a more useful definition is this: "one of a series of regular consecutive additions". This is what increment is really useful for. By combining a specific type of formula (made of Variables) with the Repeat function, you can make consecutive additions to... whatever it is you're doing. One application you might think of is changing a bullet to move slow or faster over time. What the video shows you to do is telling the game to change the firing angle of each bullet. There are obvious functions to this, like making the game create a bullet that increases in speed, but the video shows you another application: you can use the Variable to tell the game to fire a bullet at consecutive angles. The picture example at 5:00 illustrates it perfectly. The first bullet fired has the initial value (angle) of 0. After it's fired, the initial value changes because of the incremental value (36). When the second bullet fires, it uses the new value of 36... said value has now increased by 36 AGAIN so when the third bullet fires, it's now at 72 etc.
Let's recap:
Repeat nodes, by default, have 4 extra parameters besides "number of repeats". The first extra parameter determines the no. of extra variables (and their relevant parameters). The other three parameters determine the variable itself. Variable name allows the game to recognize the variable, and allows YOU to use it. Variable init value is the initial starting value of... whatever the variable is going to be used for (it could be the starting value for a change in velocity, a change in angle etc.). Variable increment is the value that the initial value is going to be consecutively changed by. (An extra note: the initial value doesn't need to be an additive value. The increment can be a negative value too. By using a negative value, you can make something move slower, or the angle can be a clockwise motion, instead of a counter-clockwise one).
As for how this all works: take note of the parameters in the Node they're showing off at 5:00. The Repeat node, set to repeat 10 times, has 1 Variable named "a", with init value 0 and incremental value 36. While inputting these parameters into the Repeat node is all well and good, there's one last important step. You can see it by looking at the Bullet node below it: the angle of the bullet is "a" (aka the Variable's name). This is how you tell the game that "I want you to use the Variable for this Parameter".
= = =
Phew that was a long-winded explanation.
I think the next post will be the last in this series. Just because there's not much else an English-only reader of the tutorial is going to get (though there's also not many parts left to the tutorial too).
UPDATE: Two more parts, not one. The third to last video is a lot longer and more complicated than I remembered.
2 notes
·
View notes
Text
【Study-referral】PC development environment for different engines(STG)
SEI's unity document The main problem of Unity developing stg: there are too many objects on the screen. It is a game that generates and eliminates a large number of objects in a short time. As a result, the direct use of unity production will cause the game's response to be slow, and the number of bullets in the screen cannot even exceed 200. This is a very serious problem for stg. Because stg needs a lot of bullets to cause visual impact. But apart from bullets. Unity's shader effects, 2d animation logic, and particle effects are all very good tools for the production of game character moving background effects. Sei made a practical single-level stg game (released for free on steam). This game uses unity to make animated backgrounds and particles, and uses self-developed plug-ins to make bullets. Some ideas for making unity2d skeletons are mentioned in the documents he left in the game. Including the production of the boss walking map and the title screen. These tasks only need to layer the character in psd and adjust the animation of each frame. Its efficiency is higher than pixel painting. This is an improvement that can be improved for my project. And I have done AE puppet animation. Layering can increase efficiency. At the same time, add the tutorial that I have studied before to import ae animation into unity as ui. Unity has a relatively strong potential for game development.
Luastg LUaSTG is an engine developed by Chinese programmers. The main program is composed of c++. Users can use the scripting language lua language to write some bullet logic. Its advantage is that bullets and operations are relatively smooth and easy to master (as long as the core is not involved, such as changing the number of animation frames). The disadvantage is that the image processing function is not perfect. Need to change the source code to make some replacement bullets, pictures and other operations. The background also needs to import the picture into a coordinate system to create a new camera. The operation is cumbersome. Touhou Danmakufu Barrage engine made by the Japanese. The overall package is very complete and fully functional. The disadvantage is that the game cannot be stabilized at 60fps when the amount of objects exceeds a certain amount.
SeiweLL. 2017. 弹幕游戏制作工具概述(下) < https://tieba.baidu.com/p/4939382652?pn=2> SeiweLL. 2019. Touhou Fantasia Developer Document
0 notes
Text
English Commentary on a Chinese LuaSTG Tutorial Pt 3
This part is about the remaining videos.
= = =
Video 4: https://www.bilibili.com/video/BV1st411N7Kg?p=4 tl;dr Some bits are unclear but from what I can tell, there are sections about symbols, infinite loops and sound
Content: There's about five parts / sections to this video.
The first part / stretch from 0:00 - 1:29 seems to be about symbols you can use in LuaSTG. If you've read the other posts, you'll know that the subtraction sign can be used to signify negative number, but it can also be used as a subtraction sign in formulas.
The other symbols are exactly as you can see.
+ is addition
*(asterisk) is for multiplication
/ (slash) is for division
Circular brackets are... circular brackets. In case you've forgotten high school maths, it's related to that "order of operations" stuff. I think it's also brought up to establish "this program uses circular brackets and not square brackets (that other programs might use)
I'm not too sure what ^ means, however. Likewise with %. My maths knowledge is pretty rusty... this unironically might be my first application of the topic since finishing high school ;\
I do remember (vaguely) something about percentages really being fractions. Maybe % is related to division in that case? I think ^ also means "to the power of". To the power of what? Dunno, just look it up. I told ya, I don't know maths.
= = =
The second part starts at around 1:57. I actually don't know what's happening in this part, so I'm skipping over it. A gentle reminder that the complicated setup in their example is because they're using the legacy LuaSTG editor. The Sharps editor can replicate the same thing wiht far less hassle using the "Create Simple Bullet Group" node (a node missing from the legacy editor)
= = =
At 03:00 (part 3 of the video) they bring up infinite loops. I'm not gonna make specific commentary on this because this is very basic level stuff. Here's a very useful link that can explain the concept better than I can. It's specifically for Danmakufu but the concept remains exactly the same. tl;dr don't make the game shoot bullets infinitely without pauses in between, and don't make the game wait infinitely either.
= = =
At 4:00 is part 4 of the video. I'm not actually sure what the topic is. I was certain it was about interval (reminder that interval doesn't exist for Repeat nodes in later editors, so it'd be about Wait nodes), but I actually really don't know. I will just comment on interesting stuff in the examples given.
At 4:52, you can see a formulas used in place of a value (i.e. increment 360/15. 360 divided by 15 is 24. If you put in 24 instead of 360/15 you'll get the exact same result).
At 5:40, you can see the Repeat node + Variable being used to determine the bullet spawning position. You have x%384-192 (value/position x on the grid) then 120 (position y on the grid). It looks like this:
(x%384-192,120)
It's basically taking the same concept from the last video (using Repeat + Variable) but instead of applying it to angle, it's being applied to the horizontal position of the bullet).
At 5:55, they use the Repeat with a Variable to increase the velocity / speed of each subsequent bullet in a bullet group. This is an example of another easier feature in the Sharps editor, as the Create Simple Bullet Group node has a Velocity begin + Velocity end feature.
At 6:01 is something interesting. They've placed a Repeat with a Variable instead of a Repeat with a Variable. You have a Bullet node, inside of a Repeat Node, inside another Repeat node. Take a closer look at the Variables; the second Repeat node's variable is ANOTHER variable [i.e. a2's initial value is a1's initial value]
I don't actually know what the tutorial is trying to explain but this process of putting a Repeat within a Repeat seems to be necessary when trying to use a Variable within a Variable. I've actually tried replicating the example with only one Repeat (i.e. use 1 Repeat Node, set Number of Variables to 2, Variables A1 and A2) but this just caused an error.
It seems that if you're going to use a Variable within a Variable, you will need at least two Repeat nodes; one establishing the first variable (A1), and a child node establishing the second variable (A2) that will make use of the first variable.
At 7:05 they go into adding sound. I don't know what else to add, this is pretty simple stuff. The video does conveniently mention which sound effects are the actual "bullet" sound effects (i.e. tan00, tan01, tan02, kira00, kira01 and kira02).
= = =
Video 5: https://www.bilibili.com/video/BV1st411N7Kg?p=5 tl;dr it's about RNG
They go into some Random Number Generators. This has been covered in Ryann1908's tutorials already; one in his longer tutorial (where he uses the function to mimic Sakuya's Eternal Meek spellcard) and one in his shorter tutorial (when it's been used to randomly pick a color for Marisa's stars shot). I've also mentioned Ran:Sign before; Ran:Sign is probably the least useful of these, because unlike Float or Int, where you can put a minimum and maximum value, Ran:Sign can only generate two values: either a positive 1 or negative 1. There is one parameter that actually benefits from this: throw it into a Bullet's Rotational Velocity parameter and see what happens.
This is all so basic that even the sparse LuaSTG Wiki has info on it.
= = =
Video 6: https://www.bilibili.com/video/BV1st411N7Kg?p=6 tl;dr The tutorial recreates two attacks from Touhou 7
This one was actually hard to understand until I recreated the pattern for myself. I don't know if this is exactly what is being said, but for the Chen section of the video:
When they're highlighting the slowest bullets, I'm 90% sure it's to say that these are the first bullets to fire. No, you read that right. The slowest bullets are the first bullets generated in the pattern. The secret sauce to this pattern is that each bullet has a higher velocity than the previous one, thanks to the magic that is Repeats and Variables.
When they're highlighting the fastest bullets, I think it's to mention those are the last bullets spawned. This should be true if we apply the logic from the previous section; if each bullet has a higher velocity than the previous one, the last bullets to spawn HAVE to have the highest velocity / be the fastest moving.
When they're highlight a single wave / barrage, I think it's to mention how the repeats work. With the way they've used Repeat, each wave is 15 bullets each, and the waves are fired 6 times (in 6 different angles).
You can recreate this by copying the same setup, just make sure you add a 2 frame Wait as a child of the first Repeat. It should go:
>Repeat 15 times >>Wait 2 frames >>Repeat 6 times >>>Create Simple Bullet
The Youmu recreation is a bit different. The "slowest bullets being the first bullets spawned" are the same. Unlike the "15 bullet barrage fired in 6 angles" with Chen's attack, it's actually "4 bullets fired from 16 angles" which definitely confused me (when I first saw the video, I assumed it was "16 bullets fired in 4 barrages). Note how they use Repeat + Variables again to decide the X and Y coordinates of the pattern.
There's a small section after the Youmu recreation. I do not know what it's explaining.
In the final section of the video, they show off a button that no longer exists in the Sharps editor that used to be in-between Pack Project and Run Project. From the design of the symbol, it seems to have been related to the Stage nodes?
= = =
Video 7: https://www.bilibili.com/video/BV1st411N7Kg?p=7 tl;dr ...I don't know what this video is about. It also doesn't need a tl;dr since it's only 30 seconds long...
Content: I really couldn't tell you what this video is trying to say. The first part uses some sort of "If Else" node which is something I'm especially out of my depth on. All I know about the "If Else" node is that you can use it to do multi-phase spellcard attacks (like most Stage 6 final spellcard attacks a la Miko or Shinmyoumau).
The rest of the video seems to be about making the Chen recreation more complete. They make two Repeats of Chen attacks (the first repeat is the one we saw before, with Orange bullets; the second repeat has Green bullets and fires in the opposite direction by changing the increment to a -7 instead of a +7). The attack also seems to have more RNG, as a Ran:Float has been added into the formula (a=Ran:Float(0,360), increment 7 -> a1=a, increment 60)
= = =
Video 8: https://www.bilibili.com/video/BV1st411N7Kg?p=8
tl;dr ...dunno. I think it's about running multiple tasks? It's a shortie. It's also the last tutorial in this series...
Content: The last video is a bit confusing. Considering the example shown at the end, where Mokou is firing two streams of bullets (the green bullets moving in a counter clockwise direction, and the blue swords in a clockwise direction), my guess is that it's about running two separate Repeat + Variable streams of bullets.
I read this in a different tutorial, but you can basically run multiple tasks at the same time. This knowledge can be very helpful if, for example, you ever wanted to make a boss use the Move To / Move By node while also firing bullets. I *think* that they're saying "you can do these two streams at the same time if you run them in different tasks". But I'm not 100% sure that's the case.
And to be honest, I don't think that, if that is what they're saying, that it's necessary. At least it's not for newer versions of LuaSTG. I know for sure that you could run those two streams (purple and cyan) in the same Repeat node if it was the Sharps editor. All you'd have to do is establish two Variables in the Repeat node, then give the separate Bullets / Bullet Group a specific node. Put both bullets as the child of a Repeat node and bam. That's it.
The last thing I'll note is that this video was last made in 2019. So the chances of a continuation seem slim...
= = =
Conclusion
So that was one tutorial down. There are actually three other Chinese tutorials, though this tutorial is the only one that is in a video format. The other tutorials, especially the one about coding in LuaSTG are harder to follow just bc of this difference.
If I get the time, I'll try to do commentaries on the other tutorials. I at the very least, plan to cover ONE of the other Chinese tutorials, since I've been able to follow that specific tutorial very easily (it's this one. It has animated gifs and while it goes into some complicated concepts, it's been more rewarding to follow than the others).
You can find the other Chinese tutorials on the LuaSTG Shoutwiki. Note that while it shows 2 video tutorials, it's actually only 1 (the one we just covered) since the other video tutorial is no longer available on Bilibili
1 note
·
View note
Text
English Commentary on a Chinese LuaSTG Tutorial Pt 1
Here are my personal notes on (one of) the LuaSTG tutorials I’m going through. Disclaimer: I don’t know Chinese, so this isn’t a translation of the tutorial. This post more has “sharing my homework” vibes. The tutorial, (which is linked on the LuaSTG Wiki) is here.
= = =
Video 1:
tl;dr They show off the legacy LuaSTG editor and how to start a new project.
Content: No, seriously, that’s it.
= = =
Video 2:
tl;dr They show "Create Simple Bullet" and Debug Settings.
Content: At 3:55 is when you get to the useful stuff. Basically they're saying that there's a grid system that determines positioning. The grid starts at the center, with the mid point being 0,0. The diagram with the four sector (-,+; +,+; -,-; and +,-) is very handy, and I strongly suggest screencapping for personal use.
(This isn’t super relevant, but I believe Danmakufu, the other noteworthy shmup engine, has a grid system with a completely different starting value. That is to say, 0,0 does is not the center of the screen there)
They then mention the maximum points are 192, 224 and -192, 224.
At 5:40 they're explaining how angles work. 0-359 is one, counter-clockwise rotation. They explain you can actually go past 360, and use 469 degrees as an example, but there's not any real point to using 469 degrees over 109 degrees (since that's what 469 is: 360 + 109 = 469 degrees).
At 6:40 they explain that you can also use negative 0-359. In their example, positive 90 shoots directly up, while negative 90 shoots directly down. You can basically think of this difference as counter-clockwise (positive) vs. clockwise (negative). You can easily test this with the Rotation Velocity function when spawning a bullet.
Afterwards they go into Aim to Player. Ryann1908 covers this in their tutorial but it's the general issue of "homing bullets need to have 0 degrees in the Angle parameter"
One note I'll add is that homing bullets that don’t have an Angle of 0 are still useful. A good (painful) example of this is Youmu's first Nonspell in PCB. After Youmu fires those two slow waves of bullets, she uses barrages of red and blue arrows that are designed to box you in. The blue arrows are obviously aimed at you, but the red arrows actually are aimed at you too. It's also "Aim To Player" the angle paremeter just isn't set to 0.
= = =
Video 3:
tl;dr They talk about 60FPS... and also (hooo boy) Repeats and Variables
Content: Yeah, I’m gonna have to make a separate post just for the part about Repeats and Variables, because using Variables with Repeats is very, very un-simple Let’s just go over the part about 60PS for now.
At 1:42, they start talking about 60FPS. I’m not 100% sure why they’re talking about 60FPS in this specific section (I have to assume it’s related to the use of Repeats) so I’m just going to interject with my own notes.
I’m going to assume you know what 60FPS is, but if you don’t: FPS in this context stands for “Frames Per Second”. The Touhou games (and a lot of other shooters) try to run at 60FPS. How is this relevant to LuaSTG? Keeping this value in mind is one way to help calculate shots.
For example, if you want to fire a certain number of bullets per second, then you just need to remember that there are 60 frames in a second and calculate the number of Waits accordingly. Want to shoot 60 bullets in one second? Make a Wait of 1 frame. Want 30 bullets in one second? Wait 2 frames in between shots. 20 bullets? Wait 3 frames. 15 bullets? Wait 4 frames etc.
Note that you don’t have to work in the timeframe of only one second. How about “I want to fire 5 bullets over 2 seconds?” Well 2 seconds is 120 FPS. 120 (frames) / 5 (shots) = 24 (gap between bullets). So we want a gap of 24 times between bullets. I know this sounds super obvious, but trust me, it’s useful to keep in mind.
= = =
Expect the part about Repeats and Variables very soon.
1 note
·
View note
Text
I’ll post about after a good night’s sleep but
The Chinese LuaSTG tutorials *are* useful. I just messed up when I went over them last time. Just couldn’t wrap my head around the lack of Intervals (the newer version of LuaSTG I was using didn’t have that function with Repeats... but I just figured out that Intervals can substituted with Waits)
0 notes