Programming Loops vs Recursion – Computerphile

Programming Loops vs Recursion – Computerphile


[There’s] a lot of interesting stuff both from the
point of view of the content but also the historical context between, y’ know
“When were `for’ loops invented?”. Well that’s what Algol called them but prior
to that FORTRAN called them DO loops. And prior to that they existed in assembler.
So, first of all, what’s the history and what does it get you when you can do
loops, but when do you run out of steam, even with loops, and you have to use this
shock! horror! Pure Mathematicians thing – that computer scientists have to learn
about – recursion?! It was a real culture shock, it really was, in the roughly
1940s, 1950s to suddenly find out that what the theoreticians had been
drivelling on about for years – about recursive functions in mathematics – actually was of
massive, massive importance for computer science. Back in the ’40s and early
’50s it was all Assembler – or a slightly dressed-up thing called a macro
assembler, where you can have little routines full of, y’ know, packaged
assembler instructions which could be called up, as and when needed. So, that
sort of served people for quite some time. But probably one of the first
high-level languages to introduce loops was good old FORTRAN [shows textbook]. Even though
that was published in ’65 Fortran itself goes back, I think, for almost ten years before
that. It was invented by John Backus and a large team of people at IBM in the
1950s. Many of you will know it. It’s an excellent language for engineering and
scientific calculations. It is low level. I mean, when you look at the nature of a
FORTRAN loop it’s almost like doing it in assembler – but not quite. They didn’t
call them for loops – they called them DO loops. What I’m saying here is – you package all this
up – where you’re saying repeat the following sequence of
instructions, which I’ve done with my wavy lines here. Keep doing them until
you hit the statement with a numeric label on it of 180. The loop back from
the statement labelled 180, back up to here to increment the loop counter, which
you’re all familiar with in languages like C. It wasn’t done, as it would
be in C, by saying: “Here’s my block of stuff to be repeated it’s inside these
curly braces”. Here you can see it’s a lot more like assembler, a lot more low-level.
I mean there’s nothing magic about “180”; it could be “72”; it depended on your labelling
system. Implicitly here, in a simple thing like this, you’d start off [with the counter]
at one and every time I returned back here it would reset [the counter] to be 2, 3, 4 and so on up to
and including 10. It’s comforting for those who were coming from assembler
into a higher-level language to see something that was only slightly higher
level, in sophistication, than assembler was. How did loops become more “powerful”,
if you like? Well, again, even in assembler and even in
FORTRAN, there’s no reason why you couldn’t have a loop within a loop. So I
might have, outside of all this code, yet another layer of DO. What shall we say:
“DO 200 J=1, 20”. So, there might be some more statements between 180 and
200, who knows, but again, you see, a numeric label. And can see what’s
happening is that for every setting of J, which will start at 1 and go up to 20,
for every single one of those J settings the inner loop will be running through
the complete spectrum of settings of I going from 1 to 10. So you will have 200
locations [that] are being affected here. Basically going through the rows and
columns of a matrix. All sorts of calculations in physics, chemistry and
particularly engineering just rely on two-dimensional arrays full of numbers
– either integers or scientific numbers with a decimal point. and so on. Even hard-core assembly programmers had to admit if you were
doing heavy scientific programming it was nice to be a little bit more abstract
and to have this sort of facility available to you. Now you might say: “Well,
what came along to spoil the party then ?” or “How did people realize that this was
wonderful but not quite enough?” The compiler of course has got to be
tolerant and has got to be capable of compiling nested DO loops correctly but
how deep would it let you nest them? Well, I’m guessing, I would suspect that
the early FORTRAN compilers probably wouldn’t allow you to go more than about
10 deep, maximum. And I think you and I Sean have just been looking up what are the
current limits in C? I seem to remember the earliest `gcc’ was something like 32
But Ithink we looked up this … some C++ nowadays allows you to do nested loops
256 deep! And, of course, there are multi-dimensional problems that might
actually need that, because it it doesn’t take much knowledge of higher maths to
realize if you’ve got a loop within a loop the outer loop goes around n times; the
inner loop is going around n times, you are then coping with an n-squared
problem. If you put the third loop inside the other two you’re coping with a cubic,
three-dimensional, problem. So what we’re saying is all these multi-dimensional
polynomial-going-on-exponential problems, that come up quite naturally, you can
cope with them in nested for-loops so long as they don’t need to be more than
power-32 or power-256 or whatever it is. And you think, well, that should be enough for
anybody! There’s these multi-dimensional problems you can just do them by nesting
`for’ loops and surely [a depth of] 256 is enough for anybody? What kind of problem
wouldn’t it be enough for? Well, a lot of theoretical computer scientists of my
knowledge amused me greatly when – those of them that will own up to this – back in
the 60s. People started going to lectures from mathematicians, theoreticians, people concerned with “Godel Computability” and so on. And
of course, those sort of people, were very familiar indeed, at a mathematical level,
with Ackermann’s function. Now, as you know – you and I – we’ve done that one:
>>Sean: Was that “The most difficult … ?”
>>DFB: “The most difficult number to compute, question mark”
“We set this going four weeks ago
nearly now the first few are vanished …”
video insert>So what made it so difficult?
well you write down Ackermann’s function and it very clearly ends up with routines
calling themselves recursively in a very very complicated way. Now I think your
average sort of engineer would be happy to say that there’s this thing called `factorial’
which is 5 times 4 times 3 times 2 times 1, or whatever. And you could do that in a
loop as well as doing this fancy recursion thing, but a lot of
theoreticians admitted to me they saw a Ackermann’s function and said: “I could try that
out in FORTRAN !”. Now what they perhaps didn’t realize – but it became famous by 1960 – is: FORTRAN is wonderful, but original
FORTRAN did not do user-level recursion You could write a thing called ACK.
You could actually get it to call itself in FORTRAN. But you might have been
expecting that every time it called itself it would lay out a data area for
each recursive call they’re called “stack frames” – we know that now. You get lots of
stack frames, one on top of another and as you come back through the recursion
they’re deleted and thrown away and you climb back into your main program.
FORTRAN doesn’t do that. It sets aside one stack frame. You keep calling
yourself recursively it just tramples in its muddy gumboots over all your
data area and you end up with total garbage. It no more gives you values of the
Ackermann function than fly to the moon! And people said: “I then realized the
importance of having user-level recursion, in programming languages, to
cope with those really hard problems that fell outside nested for-loops”.
Algol was famous in that its routines could call themselves recursively and
could get the right answer and, for limited low-order values of Ackermann’s
function – very slow, very slow indeed – but it would come out with the right answer.
>>Sean: Is there any need to think of an example of a problem, or program, because Ackermann
feels to me like it’s the test-bed. You know, when you’re testing out a
motor-car you might take it on the track and see how fast it can go.
But in day-to-day life that car might only get half that speed. What’s the
real-world kind of equivalent? Is there such a thing?
>>DFB: Real world equivalent?
>>Sean: … of something that might need to use recursion … ?
>>DFB: … of that complexity? Not many things is the answer to that. I mean, yes, it’s
true that Ackermann, as you know, was David Hilbert’s research student. And the
challenge was on to find something that was so innately recursive that – remember
it was “generally recursive”, they called it – as opposed to “primitive recursive”. And
simple things like factorial and indeed indeed Fibonacci, are primitive recursive.
So I think you’re right that you really are just making the point that
eventually there are things that will kill you. I think the question in the
middle is: “Is there something out there – pieces of program you need to write –
where non-trivial recursion, in a sense, is needed but not quite to the
horrendous degree that Ackermann did. And the answer is: “Yes, compilers is where it hit
people”. Because although early FORTRAN did not provide user-level recursion, for
you and me, nevertheless John Backus and his team implemented it in the middle
1950s I think at IBM. And Backus wrote articles afterwards
basically saying: “We didn’t know enough about recursion and even though we
didn’t provide it for the users of our language, boy did we need it in the
compiler! And we ended up inventing it in all but name”
The syntactic structures of what is legal, in a language, even at the level
just of arithmetic statements can be quite recursive. Because you end up with
brackets within brackets within brackets all with a multiplier outside. And which
order do you do the brackets in? And, you know, how how many levels of bracket
nesting can you have. And if you don’t get things sorted out correctly then
you’ll get the wrong answer. But once again the problem could be that your users
would come up to you and present you with a problem just designed to test out
your compiler, and whether it was robust enough to be able to cope with a high
degree of nesting even just in arithmetic statements. So by 1960 in
Algol, yeah, the there were enough users, at the user level, who could see that a
modicum of recursion, perhaps more complicated than factorial but not quite
up to full Ackermann capabilities would be very nice indeed to have within your language.
Again referring back to that original video, I had a lot of really
interesting mail from various people who said to me: “OK, you said that this is an
innately recursive problem and it just had to have general recursion capabilities?
Well I …. ”
of trailer>

WEB2 CSS – 1. 수업 소개

WEB2 CSS – 1. 수업 소개


Let’s start the ‘WEB2 – CSS’ course This course relies on ‘WEB1 – HTML and the Internet’ If you don’t know what HTML is, I recommend you study WEB1 first before this course If you know quite well about HTML, you can skip WEB1 and continue with this course If you are ready, let’s talk about the purpose of this journey When the Web came into the world, there was only one technology, which is, “HTML” People could use HTML to create an electronic document In other words, they could express information using computers And the ability to make information available to anyone in the world through the Internet – that was a revolution Naturally, people got excited about the Web But human desires are infinite Initially when people first learned how to create documents using HTML, they were simply happy with the fact Soon after, various discontent started to bubble up Among many discontent, this course deals with the kind of discontent about ways to make a web page look nice and beautiful Now, we’re going to talk about why CSS had to be born, and decorate the web page we created in WEB1 only using HTML so that we can fulfill our desire about beauty one by one During the process, we will cover simple yet most important principles that control CSS Also we will study most frequently used features, based on statistics Once you have finished this course, you should have developed interest in beauty and also have energy to seek knowledge and experience needed to obtain beauty on your own Of course, this course doesn’t teach you about beauty itself because I’m not an artist nor a designer Alright, let’s set off for this new journey!

PHP Tutorial – 04 – Operators

PHP Tutorial – 04 – Operators


In this section we’ll look at the operators
in PHP, that are used to operate on values. There are basically five types: arithmetic,
assignment, comparison, logical, and bitwise operators. First, we have the four basic arithmetic operations,
as well as modulus to get the division remainder. The equal sign itself is an assignment operator
to assign a value to a variable. A common use of the assignment and arithmetic operators
is to operate on a variable and then to save the result back into that same variable. These
operations can be shortened with the combined assignment operators. Another common operation is to increment or
decrement a variable by one. This can be simplified with one of the increment (++) and decrement
(–) operators. The effect on the variable is identical whether we use the post or pre
operator, but a post-increment returns the original value before it increments, while
the pre-operator increments first and then returns the value. Note that expressions are normally evaluated
from left to right. However different operators also have different precedents, For example,
the multiplication sign binds harder then addition and is therefore evaluated first.
To avoid having to learn the precedents of all operators we can instead use parenthesis
to decide what part of the expression will be evaluated first. Next, there’s the comparison operators that
compares two values and returns either true or false. Notice the three equal signs (===)
for comparing both the value and data type. Used together with these we have the logical
operators. And/or (&&/||) can combine several comparison operators. And the not operator
(!) can invert the result. Finally, The bitwise operators work on the
binary representation of integers. For example, the xor operator (^) turn on the bits that
are set on one side but not on both.

deep-assoc-completion Features Overview – php associative array key completion and documenting

deep-assoc-completion Features Overview – php associative array key completion and documenting


hello my name is Artur Klesun and I am the
author of the deep-assoc-completion plugin in this video I’m going to
show you how the features of this plugin work. First some briefing: the deep-assoc-completion is the plugin that adds typing for associative arrays in
phpstorm like when you declare a variable which
is an associative array the plugin will remember the type of of the keys of this
associative array and when you use this variable later it will suggest you the
keys that are stored there. Okay let’s get right into the first example. Here you
see we are declaring a variable with some keys and here on the next line we
are using this variable and when we try to get a key from this variable when we
hit control space or just when we type the quotes the plugin suggests you
the three keys that we declared above and you see there there is a key name it’s
Val it’s type all this valuable information gets passed to us from the
plugin that’s what it basically does in a very simplified form yeah you can hit
enter and it completes the key and you can control click on this case and it
moves your caret to the place where this key was defined that it can be defined
at hundred lines a bow or even in older file even in some file in a vendor
directory like in some libraries that you include in your project the plug-in
is smart as hell okay is this example is not very not so interesting since we are
getting completion here for the variable we define it just one line and both like
we don’t actually mean the completion here since we see the names we just need
to raise our eyes few degrees above but what if we have a bit more complex
example right here it’s still pretty simple example but it’s already not so
because what keys do we have in this variable like we have this
variable here all right which holds a Volvo retirement by this function and
what this function returns depends on what this function returns and we also
do our a poke taking an element from the array return aided by this function no
because that is not as easy task as in the previous example so remembering what
function it returns what keys most likely is not possible for a human brain
in a project with like hundreds or thousands of functions but it is
possible for a machine since machine can perform resilience of computations per
second and it does when we have this plug-in in salt a little notice here the
plug-in understands most if not all built-in PHP functions like array pork
array map or a filter array reduce and it understands all the functions and
methods you define yourself or methods define it in library you use given that
this library source code isn’t available in your project which is usually the
case with PHP ok this example is well it’s still doable to work with this
associative array by remembering quad keys go where but if you want a deeper
example look at this hey you see we are have like 10 or something like that
keys in a row taken from an array and the plug-in knows them all and you can
control beyond every of them control B or control click the plug-in can do much
more complex stuff and you see here it’s not even a half of the depth limit of
the plugin and all these functions may be scatter at all across your project
they don’t have to be in a single file to work ok let’s move to the next
example I guess sorry for being boring now this works for the data we create
ourselves but how do we get the type of incoming data working for that cows the
plugin allows you to specify the keys in a PGP doc with such format
and the part of the Xia Kosygin in the dog should be able eat peach P
expression note that the value in the dog does not necessarily have to be an
array it can be any expression like for example a function call or well anything
else maybe a array of objects major that’s how you documents a he’s in
function argument and you get the nice and nice completion here notice that it
works not just inside the function but also when you call this function here
it’s a function promote that takes is a employee with such keys and when we call
these functions at plugins suggest use a completion with these keys you may
notice here is an empty string in the completion options that’s because of
this line the plug-in is so smart inserted and not just looks in
documented keys but it also looks at how this variable gets use it and also
determines the type info based on that like if I had something to do with key
name name last name for example in this function then I would get the completion
here as well just a small nice thing about the plugin remember how I say that
the value in the PHP dog does not necessarily have to be an array like it
can be a function call well here is more practical example here we have a
promotional variable and we type just the function name in the PHP dog that
returns as so called promotion object associative array let’s call it record
maybe anyhow we get the completion by specifying that the type of promotion is
what the function promotes returns we tells the plug-in where to look at these
keys from and that is the coolest features there is in in the plug-in one
of the coolest features by used this stuff a lot and it makes Kody
really comfortable giving you both a very complete typing and like you can
see here it has zero verbosity you define these kids just once just in the
function where you create them and you can reuse this function anywhere you
have an argument having this type yeah and this also works with method calls as
well not just script functions like here we have an employee again but this time
it’s employee for the method to get employer browsers and the employee
document in previous example and it also works a side note since in this
particular case the meta T is located in the same class we could write it like
that and the completion will still work using self instead the class name or we
could type static static will have a special meaning well like in normal code
it will be aware of the extending classes if you type its static and the
function name may be useful if we were like using some abstract or model
classes where you override some function so another thing about this stuff is
that you can either specify here just the class name in such case if you have
multiple classes if it’s same name in your project you will get as a
completion from all of them in such case and if you want to limit the type to a
particular class with such name you can use a fully qualified name with name
spacing by the way when you’re typing the method here when you type the class
name you can see it’s the plug-in suggests completion very convenient a
bit more about the documents since the format accepts any valid PHP expression
you can also write it this way and then the plugin will know that the variable
is an array of employees by employees I mean the output or function get employer
this function you can also write this way if you have a function that
returns an array but you want to specify that the parameter is of type matching
the element of in such array you can type it this way and it will
work hope it’s interesting for you so far okay this was like more like of
boring stuff about documenting and all now we are getting to a real scene which
I refer to as a usage base its completion before as you could see up
until now we were working with variables that already were created before a hand
but what if we want completion when we are creating an array like you see here
we call a function and we pass an associative array to this function and
what if we want to get completion here I’ll tell you what you hit control space
and you get it you get the completion is that like in looks into this mix up
payload function sees this params parameter it sees that we are querying
his products currency and amount from this parameter and so the plug-in knows
that these keys must be supplied in what you pass to this function the same works
with as you could see earlier with documented keys on a parameter like here
you can see it’s just for example full name because we included it in the
description of these parameters is that itself is not so interesting the
interesting stuff is that this usage based completion not only works with
erase but it also works with functions here one of my favorite examples of the
features of my plugin here you see we have a function called is old and it
takes an argument notice that there are no any type hints around these arguments
and yet the plugin knows the type of this argument why do you think it does
I’ll tell you why because we are using this function in other place in this
file and the plugin sees what gets passed to this function is an
element from the PCC records variable which holds an array of associative
array having GDS PCC and the year keys so the plug-in
knows that there are these three keys in this PCC Dirac argument in the function
small function do you get how awesome this is you don’t have to keep
everything in monstros hundred lines long code a block or have resilient
documents on every function to keep the track of all the types you can freely
split your code to however many internal functions you wish and every one of them
we know what the type its argument will be based on what you pass to this
internal function by internal function I mean the function that is defined that
in a class and gets use it inside this same class usually these these functions
are private local functions sorry local functions not internal and that is the
stuff that even the most marked a statically typed languages like
typescript are not capable of doing defining can function in having the
compiler knows the type of its argument without explicitly specifying them and
the last thing for today another one small nice feature not so cool is local
function argument inference but still pretty useful stuff is string value a
completion I don’t know how about you but I often got into situations while
writing PHP codes that I have had something some kind of data that may
mean different things base it on some keyboard constant that it holds for
example here we have some sort of lisam variable called some keys one of which
is the key named kind and as you can see from the implementation the the kind is
a constant depending on on the value of this constant the meaning of this record
we’ll be different usually when you’re processing an array of such records you
would write a long if LC chain to process different kinds of records
differently and the plugin suggests use values that this string may have when
you’re pressing control space in the string literal as you can see here it
suggests both plain strings as well as constants and same works when you are
passing this drink to a function like here we have function named evaluate
licks m and since it’s written here that what it takes is an associative array
which much as Val returned by the parcel exam function the plug-in knows that
this lick same parameter must have keys kind context and attributes and when you
types a kind field you get completion of what values does this kind field can be
yeah and go to works as well and the important part like ha ha ha okay
I know what you are currently thinking you want to know how to turn this stuff
on right when you just open phpstorm these smartest typing doesn’t work from
out of the box you’ll need to install the plugin first so in order in order to
do that you open file settings switch from installed tab to marketplace type
the the sauce completion and here you will have the
green install button you hit it and restart the phpstorm
and you have end after that you should have the completion like such completion
with a nice bluish icon ok thats it for this video there
much more features in this plugin much more specific features like completion
from SQL selects from database Kiba schema if you have database configured
it has support for some and come prepared documenting formats and many
more things I’ll provide a link to the page that
describes them in detail so that’s it thank you for watching hope you enjoyed
it your feedback is much appreciated so if
you have some sort of bug report or feature request you’re welcome to leave
it out in the issues page on the github Croce goodbye

How the progress bar keeps you sane | Small Thing Big Idea, a TED series

How the progress bar keeps you sane | Small Thing Big Idea, a TED series


Translator: Camille Martínez
Reviewer: Krystian Aparta How many people are bored at their desk for how many hours every day and how many days a week
and how many weeks a year for how many years in their life? [Small thing. Big idea.] [Daniel Engber on
the Progress Bar] The progress bar is just
an indicator on a computer that something’s happening
inside the device. The classic one that’s been used
for years is a horizontal bar. I mean, this goes back
to pre-computer versions of this on ledgers, where people would fill in
a horizontal bar from left to right to show how much of a task
they had completed at a factory. This is just the same thing on a screen. Something happened in the 70s that is sometimes referred
to as “the software crisis,” where suddenly, computers
were getting more complicated more quickly than anyone
had been prepared for, from a design perspective. People were using percent-done
indicators in different ways. So you might have a graphical
countdown clock, or they would have a line of asterisks that would fill out
from left to right on a screen. But no one had done
a systematic survey of these things and tried to figure out: How do they actually affect
the user’s experience of sitting at the computer? This graduate student named Brad Myers, in 1985, decided he would study this. He found that it didn’t really matter if the percent-done indicator
was giving you the accurate percent done. What mattered was
that it was there at all. Just seeing it there
made people feel better, and that was the most surprising thing. He has all these ideas
about what this thing could do. Maybe it could make people
relax effectively. Maybe it would allow people
to turn away from their machine and do something else
of exactly the right duration. They would look and say,
“Oh, the progress bar is half done. That took five minutes. So now I have five minutes
to send this fax,” or whatever people were doing in 1985. Both of those things are wrong. Like, when you see that progress bar, it sort of locks your attention
in a tractor beam, and it turns the experience of waiting into this exciting narrative
that you’re seeing unfold in front of you: that somehow, this time you’ve spent
waiting in frustration for the computer to do something, has been reconceptualized as: “Progress! Oh! Great stuff is happening!” [Progress…] But once you start thinking
about the progress bar as something that’s more
about dulling the pain of waiting, well, then you can start fiddling
around with the psychology. So if you have a progress bar
that just moves at a constant rate — let’s say, that’s really
what’s happening in the computer — that will feel to people
like it’s slowing down. We get bored. Well, now you can start
trying to enhance it and make it appear to move
more quickly than it really is, make it move faster at the beginning,
like a burst of speed. That’s exciting, people feel like,
“Oh! Something’s really happening!” Then you can move back into a more
naturalistic growth of the progress bar as you go along. You’re assuming that people are focusing
on the passage of time — they’re trying to watch grass grow, they’re trying to watch a pot of water,
waiting for it to boil, and you’re just trying
to make that less boring, less painful and less frustrating than it was before. So the progress bar at least gives you the vision of a beginning and an end, and you’re working towards a goal. I think in some ways,
it mitigates the fear of death. Too much?

Unreal Engine / UE4 Basic Blueprints Tutorial: Common Terms and Concepts

Unreal Engine / UE4 Basic Blueprints Tutorial: Common Terms and Concepts


Okay, as you know we’re gonna dive into
making some interactions with our scene, but before we do that I know we’ve gone
over blueprints a little bit in previous sections I’ve demonstrated how to do
some things but I want to talk more about the basic building blocks of
blueprints so that it is not so intimidating as we move forward so in
this section we’re gonna talk a little bit about the blueprint basics here and
then we’re gonna go on and do some more demonstrations about how to make things
work if you don’t have any knowledge of computer programming blueprints can seem
daunting but have no fear here are some of the basics we will discuss in this
lecture blueprint classes variables arrays how to control an object from the
blueprint of another object first blueprint classes any object in ue4 that
you attach a blueprint or script to creates a blueprint class in the ue4
documentation the definition is this a blueprint class often shortened as
blueprint is an asset that allows content creators to easily add
functionality on top of existing gameplay classes so we’ve seen that
we’ve taken a basic actor in our scene a static mesh a light whatever it is and
we’ve hit the add blue print button and added functionality to it that is
actually creating a blueprint class when we do that and it’s named whatever we
name the blueprint when we created now each blueprint has a parent class
all blueprints fit into a parent class which determines what kind of behaviors
that blueprint has what we are mostly concerned about in this course is the
actor parent class because most blueprints we’re using our attach to in
actor in our scene this is the parent class we will be mostly concerned with
when we take an actor in our scene a static mesh to light etc and click
blueprint slash add script button this is creating a new actor blueprint class
and you can see in this image that’s attached here from the documentation
that there are other types actor is the top one there’s also a pond a character
a player controller and game mode and you can read their what those different
ones do and you’ll see that those are in our scene already
based on our template and we don’t really need to adjust them
so when we’re creating new blueprints it’s going to be with the actor parent
class variables if you’re not familiar with programming you might not know what
variables are but we’re going to use them quite a bit in our scripting
variables are containers that hold information they are used to label and
store data in memory so they can be used throughout your blueprints from the
documentation again variable types variables can be created in a variety of
different types including data types such as baleen integer and float as well
as reference types for holding things like objects actors and particular
classes arrays of each of each variable type can also be created each type is
color-coded for easy identification so the thing I want to make you aware of is
that it says that reference types for holding things like objects actors and
particular classes can be variables so if you’re familiar with programming you
know there’s various different kinds of variables but in ue4 the unique thing is
that you can turn objects or any kind of actor or any of those blueprint classes
that we’ve created into variable types so what really does that mean here’s
some of the variable types okay we’ll go over them there’s abilene which is
basically just a true or false piece of data that boolean that variable equals
either true or false there’s an integer which is whole numbers without decimals
and you can see examples there on the right there’s float which is numbers
that need decimals after it such as 0.05 5 3 ok there’s a string which is just a
group of alphanumeric characters such as hello world that will be magenta there
is text vector okay a vector is basically a collection of three
different numbers okay like it says their numbers consisting of float
numbers or three elements or axes such as XYZ or RGB information so you notice
when we use materials we create a constant three vector that’s basically
just three numbers and they are controlling the are G and B channels of
that to give us a color the red and blue channels of something to give
us a color also like the location of an object in the 3d scene is three axes
right XY and z axis that’s also a vector three different numbers that represent
where an object is placed in the scene there’s also rotater variables which is
a group of numbers that define rotation in 3d space
there’s the transform variable which combines translation the 3d position and
also rotation and scale so that is basically a group of three different
three vectors right because the position is a vector is three vectors well is a
vector of three numbers the rotation is a vector of three numbers and the scale
is a vector of three numbers all three of those combined together gives us the
transform variables and then there’s the object variable which is basically like
it says here represent objects including lights actors static meshes cameras and
sound cues so basically all the stuff in our scene that we’re one and two
adjust can be a variable type and that’s the blue ones and they’re object
variables okay that might not make a lot of sense now but when we get into our
blueprints and start creating things you’ll see how this all comes together
so keep these terms in mind and these different variable types an array is
just a collection of variables all put together into one group and they’re of
the same type so all the variables in that array are all of the same type of
data so if you’re collecting a blueprint class of let’s say can light B P then
you would create an array of data type can light be P and it would collect all
the all the objects of that type in your scene so any can light B P that you’ve
copied around in your scene and will collect that into that array a raised
from the documentation just as with variable values blueprints can store
data within arrays if you are not versed in programming terms you can think of an
array as a collection of variables all housed within a single unit so those
little nodes you see there like my bool array is a collection of both of boolean
values and it can like like it says on the
right the top right my actor array can just be a collection of various
different actors in your scene that all fit into the same type same types of
data but stored in groups instead of single into entries any variable can be
turned into an array a group or collection of the same variable type so
if you had a variable in your scene that you’re using that was Abilene you could
right click next to it where that you see that little grid of boxes and that
would turn it into an array and I’ll show you how to do that which means that
it can now hold multiple boolean values instead of just one okay now what does
all this mean well it gives us for one thing an ability to access other actors
within our scene from the blueprints of a different actor so like when we’re
taking a light switch and we want to trigger an event on that light switch
but it will access all the lights in our scene and turn them off we have to be
able to access those lights somehow so what we could do is reference it in our
blueprints using arrays and variables the first example I have written here
through arrays and variables we can reference other actors in our project by
setting up a variable or array of the data type that we want to access so this
would be can light be B or clean light blueprint then setting the value of that
variable to the specific objects so that you would collect all the can light
blueprint objects in your scene and put them into that variable or array we can
then use a get function in order to grab a reference of that object so then it
will be referencing those specific objects of that type also using the same
example still say we’re using a switch to turn off all the lights we kid within
the switch blueprint we could use a command to get all actors of a class and
I’ve showed you this we’ll talk about it more and we’ll do it more this is a
standard blueprint command and it will grab all the actors that belong to a
certain blueprint type or a class and create an array of them all from there
you can perform actions on them so again with the example within switch blueprint
you grab all the actors of a can light blueprint and set their visibility to
off when an event is true ok so these are the different ways which
we can access other objects in our scene via blueprints this will become
important when we want to interact with one thing and it affects a bunch of
other things in the following lectures you’ll see all this put into action and
it will start to make sense feel free to come back here and review the terms if
necessary and you might learn some new ones as we’re going along and you can
also go and check out some of the Yui for documentation for more about
blueprints and some of these programming terms but if you stick with me you’ll
see it all coming together and it’ll start to click for you and you have a
good basis now with some of these terms so you’ll know what I’m talking about

Generating a Voxel Blueprint in ICE

Generating a Voxel Blueprint in ICE


One of the big challenges in voxel-based games is how to build smooth, curvy structures. Some guidelines exist on how to build spheres of varying size, but more complex designs require careful planning. In this tutorial, we’ll look at how to use ICE to generate a layer-by-layer plan of a voxel structure, starting from a closed mesh. To follow along, you’ll need to download the Voxelizer compound, which we’ve provided as a zip file in the description section of this video. You’ll also need a closed mesh representation of the structure you want to build. We’ll be using the default T-Rex mesh as an example. Create a new pointcloud in the scene. Set the point cloud’s parent to the same null as the mesh Open the ICE Tree Editor Select “Create>ICE Tree”. Under the Compounds menu, select Import Compound. Import the Voxelizer compound Connect it to the ICETree. Add a Get Data node. Double-click on it, and select “Explorer”. Select the polygon mesh. Connect the Value port to the Geometry input and connect the Out Name to the In Name input. In the viewport, some voxels should appear inside the mesh. Here, the voxelizer compound’s default values have been set to work with the T-rex. To see how to configure the compound to work with your own mesh, reset all its inputs to zero. Make sure you’ve also disabled the “Enable” checkbox. Set the viewport to “Shaded” mode, and enable the headlight so we can work with solid boxes instead of wireframes. To start off, set the Box Size to 1. Set the Grid Color to a light gray. Increase the number in X, Y, and Z as follows. A grid of boxes should appear under your mesh. Decrease the box size to reduce any overlaps along the X axis. Change the number in Z to close the gaps along the Z axis. Your boxes should now be evenly spaced. Set the Box Color to an opaque white. Set the Top Layer Color to transparent turquoise. Increase the Visible Layer number. Increase the number in Y to reduce the gaps along the Y axis. You may also need to adjust the Visible Layer Number to accomodate for your change in the number of boxes on the Y axis. Your model should now be completely surrounded by evenly spaced boxes. Check “Enable” to display the boxes within your model. Toggle your model’s view and render visibility. Back in the ICE Tree, add a Current Frame node. Connect its output to the “Visible Layer Number” port. The current frame will now drive the top layer’s visibility. To render top-down snapshots of each layer, add an orthographic camera into the scene. Set the viewport’s camera to Ortho. Set the camera mode to “Shaded”, and turn on the headlight. Use the ViewCube to place the camera on top of the model, and rotate it such that the model occupies the length of the frame. To reduce our voxel resolution, we’ll increase the box size, and reduce the number of boxes along the X, Y, and Z axes. When we scrub the timeline forward, the blue squares represent the boxes to place at the current level. We’ll be using the hardware renderer to render our voxel plan, so we’ll need to hide all the nulls in the view. Open the render manager. Set the pass renderer to Hardware Renderer. Set the format to jpg. and set the Pass Frames to Frame Range. Set the Pass Camera to “Ortho”. Select Hardware Renderer on the left, and set the Background Color to white. We can now render each frame of our voxel plan. Use the sequence of jpeg images in your Render_Pictures folder as your guide to know which boxes to add at each level of your structure. If you’re interested in how the voxelizer compound was built, expand it and consult its commented sections. We’ll conclude this video with a timelapse of the t-rex’s construction, accompanied by smooth jazz.