Anonymous
Am lost lol
Jussi
The game engine under fortnite is called Unreal Engine (UE)
Anonymous
Can we chat privately please?
Anonymous
Please
Nikita
C++ is the best for that
Nikita
Bur it costs too much efforts
Anonymous
Anonymous
Nikita
Try cocos2d
Nikita
Please
Anonymous
Anybody here using npp?
Shirosacid
Games like fortnite ?
Fortnite is based on the Unreal Engine 4 , which is basing on C++ you can also use their blueprints (graphical coding ) i would say it is a little bit easyer than c++ and there are a lot of tutorials for that too
Shirosacid
Ս
Who have time to review a small code in C++?
Anonymous
Anonymous
Ибраги́м
_̸̡͝͝This
Hi !
_̸̡͝͝This
I wanted to as ask a noob question
_̸̡͝͝This
What are optimal ways to reduce the main() function lenght in lines of code ?
_̸̡͝͝This
I wanted to create external functions that would be accessed from main in order to modularize the code, but I might require too many variables from the local scope of main, and there's no way to set the scope of a function to be the one of another function ( in this case, main() )
_̸̡͝͝This
Although I could pass some of this local variables from main by reference with arguments, there are too many : /
Ariana
It's generally a better idea to just have different processes in different function, instead of all being clumped into main
Ariana
like
void main(){
dothing();
dosecondthing();
dosomething();
}
_̸̡͝͝This
Yes yes, I have many functions in main()
_̸̡͝͝This
but I still have big chunks of code which rely on many local variables, are there any ways to "modularize" those ?
Manoj
You can make variable as global also
Ariana
If it's just going to be ditched in a day, should be ok to write hackathon-style code(unreadable after a day), else have proper functions that do different tasks like
zeta();
Gamma();
digamma();
eucliddiv();
int main(){
while(something){
do something with the functions
}
return 0;
}
_̸̡͝͝This
Thanks @Ariana1729
Manoj
Ariana
i almost never use global variables tbh, I'll just set them as input to functions
Manoj
Manoj
It can help in complex multi function problem
Ariana
I'm mainly just using global variables as problem parameters, most of the time I prefer local variables, less dangerous and easier to play with
Ariana
Most of the time I do weird pointer stuff that are basically global variables
Manoj
Manoj
Ariana
How dangerous?
Well you gain access to almost every function(from an attack viewpoint)
Manoj
Anonymous
olli
In most cases I would suggest against using non-const global variables, in many cases they make the code more defect-prone. By using a good software architecture you barely need them
Ariana
Also multi-threading
Manoj
Ariana
Most of the time the global variables dont change
many
Global variables work like a charm if you don't care the executable size
Manoj
Bilol
Guys, I need UE4(Unreal Engine4), please Give it to me If You can please
Stanislav
many
I don't know why people avoid global variables. Executable size ? memory? security?
Bilol
Can't you load it?
olli
Because global are visible throughout the compilation unit. Any code in it may modify non-const globals.
olli
Furthermore globals tend to decrease the code's maintainability. Working on large code bases, the wrong usage of globals can introduce several problems
Ariana
many
I googled it and it is all about defensive style
_̸̡͝͝This
Hum, code-style question... should main() be the first function of the code ?
Manoj
It's not necessary it can be later
_̸̡͝͝This
Yes, but, is it more professional ?
Bilol
It doesn't matter where it is, even if it is at the end of the code it is the first function that is done
Bilol
I think so
Ս
Is there C++ gurus))?
many
I came across with some close source code from vendor and it is not possible to find the main function
_̸̡͝͝This
So if I declare "int black = 10;" outside the main function, I can access that variable from inside the main()
_̸̡͝͝This
But it seems that I can't access that variable from a function called from main()
_̸̡͝͝This
Is that normal ?
Ariana
Ariana
Ariana
Look up global and local variables
_̸̡͝͝This
Uhm... is it possible to declare a "super-global-variable" ?
Ariana
as in?
Alignant
Is that normal ?
The only way to access a variable from the "parent function" is closures.
_̸̡͝͝This
_̸̡͝͝This
So... there's no way to give access a function called from main() to the global variables in the code ?
Zorrito
_̸̡͝͝This