#code-talk
2 messages · Page 9 of 1
Any modification at all would not be allowed regardless of what it is.
Anyone know how to define the gravitational constant in C. I’m stuck on the power portion of it.

Looks like blade is offering a cookie for it!
@chilly marlin drop a weight from a meter snd time it
No I know the equation i need to use I just need to define it in C
As a constant
@chilly marlin just put it as 9.8
I can’t it has to be the equation for the gravitational constant (9.8 is only on earth) I have the equation but it is 10 to the -11 and I’m stuck on writing that portion in code
I’m gonna start working on it again in a half an hour. Fingers crossed on figuring out what is wrong with my syntax
Just put it as 10 with-11 zeroes
Lol I just might at this point
huh ok thanks, not they way we were taught but should work
I misread the problem, it needs to be a #define but I should be able to do it.
oh right, const is c++ huh.
i meant to point out how to do the scientific notation, i guess
hey, out of curiosity, does anyone know if the in game chat filter is made by the devs or do they use other software
text chat is devs voice chat is vivox
i suspect by the words that are flagged it was for a different purpose, like to prevent sexual solicitation of minors
printf("enter a character.\n");
//prompts user for a character. I personally prefer dwight from the office but T works as well.
scanf("%c%d", &PlainTextChar, &offset1);
// records the previous user pressing a button. Yay buttons!
EncodedChar = offset1 + (PlainTextChar - 'a') + 'A';
// basic math done by the computer while refering to the ascii table.
//acsii's included, table sold as downloadable content.
printf("Encoded Character: %c\n", EncodedChar);
// show the user the new character that has been encoded. Can it pass the turning test however?
``` anyone know what is wrong with this bit of C? i'm attempting for it to throw out a Character but it give the same Char every time then crashes the rest of my code after
@chilly marlin might be easier to debug if you remove all the commentary in it first
@timber onyx ended up figuring it out. Combination of a missing & and a missing _ on the mod C, Underscores prevents enter as being used for the character. Learn something new everyday.
Honestly i dont use pure C enough to have been much help anyways lol
Also im on mobile so the commentary looks all bunched up to me
Does anyone know what code is Foxhole written in?
It’s in the C family, don’t remember which one specifically though @woven plover
Ok, thanks
Yup, do not worry. I won't.
and java? jeez where does that venn diagram intersect!
the engine is cpp, but foxhole itself is java? it was on some devstream at some point dont remrber when. been around a while ya know?
it might be javascript
javascript more plausible
I know that there are two coding languages at least. One is in the c category and one is in the java category. After that 🤷♂️
Pretty sure it’s cpp and JavaScript
I desperately hope this wasn’t made with JavaScript

It might not be I don’t remember
if it was java the game would have to ship with jre which i dont see that happening and if it was js then it would have to ship with nodejs which would be a complete nightmare to implement with a game engine
c++ is for the engine yes
they were talking about the actual code of the game
and java and javascript would make no sense
now they might use js as the server back end
thats probably where you heard that
actually unity uses c++ as runtime and c# as scripting language they use to have unityscript but it was based off the boo language as a implantation of java script
also unreal engine had unrealscript which was similar to java but was taken out in in ue4 in favor for c++ and visual scripting
sounds legit
derp i want to hear you nerdgasm over code @long raft
are you one of those old coders that's too salty about new languages to say anything good about them
what language you like the most
c#
nice
sometimes i really wish i had high level programming classes
what about clojure
derp how old are you
right now i'm learning about registers and how to use them
36
hell i use the arduino API for most my programming classes
python is the best language change my mind
python is basically everything i hate combined into a single language
how do you hate simplicity
i dont hate simplicity
python is quite high level and such makes it very easy to understand
why do you hate python
oh man off the top of my head, holy shit python has no engineering to it. just the transition from 2.7 to 3 is busted
type safety issues, performance, capability, i dont particularly love white space scope (even tho i come from BASIC), case sensitivity, the absolutely horrible dependency hell ecosystem
well ya there is major changes you cant simply translate it from 2.7 to 3
php is the language i hate most, tho
i like whitespace as it makes sense and forces the dev to make indents
meaning it actually looks good
yah but tab vs space
i used to write delphi, then some pascal, then c++, then c#, and now javascript
and makes it easy to understand
java and assembly can die in hellfire thank you very much
delphi was really fantastic
wait derp if you're so code wizer how have you never heard of verilog and VHDL
as many problems as i have with java, would much rather work in java than c++ or C
assembly is for chumps you gotta write in machine code
im a software guy, disk, not hardware
most of my background is in database and graphics programming, i dont do a lot of low-level stuff
i honestly though most code wizards could handle low level in a heartbeat
experience is very valuable
the more low level the less it makes sense
coding is like math, yes you can learn the rules, but the tricks are what make you good at it
i find it's the opposite
i have a lot of background in assembly tho
the more directly i speak to the hardware the more i feel in control
and the less that can go wrong
exactly
damn
roller coaster tycoon
lol
even pong would take at least a year lol
nah
you would be looking at opcodes the entire time
well you use an assembler...
no if you wrote directly in machine code you dont need a assembler
frankly even assembly had become rather high level by the time i was using it, it was closer to C
and you begin to laugh at the idea that C was considered high level
jeez
c is probably the lowest level you can run in windows
delphi was just as capable as C in low level stuff
i touched C for the first time last session after a year of C++ and i felt like i had safety harnesses removed
people are using rust now in lieu of C
oh man i learned C after i learned c++ and it was a wakeup that i had been doing c++ wrong for several years
my god i know the feeling
now i declare my constants correctly instead of int or float everything
using the right kind of casts, throwing exceptions, templates, so many c++ programmers are just C programmers and dont know it
C master race
i made this awful test pattern. thought id share my pain. does anyone else get macular degeneration from this?
Why
Does it have squares
It hurts my brain
You can support this channel on Patreon! Link below
This video discusses the color brown. Seriously.
That Aging Wheels playlist:
https://www.youtube.com/playlist?list=PLmBDJoIaNRGiK2BgCwz2ALDnNanKBSOgO
And, of course, the Weird World in RGB for those of you who I couldn’...
@long raft but since you sre working with colour, this might be interesting to watch 😉
You mean dark orange
I did xD
i suppose i knew these things about color, but its an interesting presentation
im dealing mostly in YUV colorspace tho, not rgb
i must admit i dont find brown to be that weird
so really our shit is just a dark orange
J o i n. C4. Today. Check cult listings for more info
Just read what derp said. Glad I’m starting with C now.
When your computer hogs the serial port you’re using for something
oof imagining using a serial port in 2020
damned blue-billed rebels!
derp my school still teaches us with stuff made in 2011
one of the boards i have to use isn't even supported by its manufacturer anymore
hell the same board im using is using an arduino mega 1280 as an interface
you can't even buy those anymore
I don't think you can ever except any computer/electronic education to be up to date. And even if it is up to date then it'll probably be obsolete in a few years
not true as a lot of networking stuff has been set in stone since 1990
ip tcp udp subnets nat dns
all still relevant today
actually most of this
a lot of that stuff has changed
dns insecure, people switching to dnssec, ftp dead, http dead, http2 is replacing https (assuming 1.0), is RIP still a thing? tls version 1.3 now? ipv6 never really happened... isdn wololo, 802.11 wireless stuff has changed
i use ftp all the time as well as any game hosts
in europe they have no more ipv4 addresses left so they must switch to ipv6
dns is far far from going away as most cooperate use dns to control the sites people visit and dnssec is encrypted so they cannot control that anymore
http is used by all routers for local connections as well as most internal networked servers
http2 is an extension to https so most the knowledge for https applies to http2
you really use ftp all the time? im surprised by that. and skeptical.
we supposedly hit ipv4 exhaustion years ago, and yet we havent really, and neither has europe.
my router uses https
http2 is not an extension to https, its a new version, just pointing out these are not static technologies, http2 is very different than 1.1
ftp is ... really awful, it just has such trouble with routers and NAT and in general the modern internet
i have been seeing we are about to run out of IP addresses for over 10 years, thecuz1
its like running out of oil. it will never happen
but now they have actually run out
theyll just get more expensive
frankly they may run into the exact same problems with ipv6 as they did with ipv4
"Any of the IPv4 addresses that are recovered by RIPE NCC after this point will be allocated via a waiting list. However, this is expected to be only a few hundred thousand per year and nowhere near the many millions of addresses required by networks today."
they tout it as if there are hundreds of addresses for every square meter of earth but thats not how theyve created the routing tables
they will just employ NAT more, and re-use more addresses
hell no ipv6 is a 64 bit address
its 128
how would nat help
well very few internet connections need a dedicated IP address for listening
theyll just stuff most traffic behind shared addresses as theyve been doing for decades
nat is mainly used for translating public addresses to private ones
no nat has nothign to do with public or private
yes everything to do with it
i shouldnt say nothing. little to do with public and private
you can use nat with all private or all public addresses
NAT simply records which outgoing connections can be used to receive and how to route to them
"The majority of NATs map multiple private hosts to one publicly exposed IP address."
The majority of NATs map multiple [private] hosts to one [publicly exposed] IP address.
private refers to 192.168, 172, 10
class A does not mean private
then why is there class A B and C in the private networks?
because classes are a letter way of representing subnets
a class A network can have different sized subnets. they are not all /8
they can be 8 to 32 bit masks
point is 10.x.x.x is private
its class A
theres nothing magical that makes an address public. all that matters is if there are routes to it
these are all special addresses
10.0.0.0/8 10.0.0.0–10.255.255.255 16777216 Private network Used for local communications within a private network.[4]
hence /8 so class a
from the chart above
class a does not mean only /8
it means thats the minimum
point being, NAT has slowed down ipv4 address exhaustion. it will continue to
none of the damn ISPs are implenting ipv6, they probably never will, nor all the government agencies that promised to do it by 2012
yes that means that you can do anywhere from /8 to /32 on 10.x.x.x
and ipv6, just because it has a lot of addresses does not mean it has a lot in the places where they are needed
it will likely run into the same problems, and people have been relying on NAT as their firewall for decades now
i dont know about all the protocols you listed that you said are static, but the ones i do know about have pretty much all changed or become defunct
it doesnt matter how many ip addresses it has if you only route 10 addresses to china. theyre gonna run out. distribution is the problem, and the routing tables are complicated for the hardware
but thats not how many there are for ipv4 because of the reservations
ive pointed out like 3 times, the number of available addresses is not the problem
so it took use about 30 years to fill up 4,294,967,296
its the distribution and routing
no there are way less than 4 billion ipv4 [allocated] addresses
that how many that are mathematically possible to distribute
According to Reserved IP addresses there are 588,514,304 reserved addresses and since there are 4,294,967,296 (2^32) IPv4 addressess in total, there are 3,706,452,992 public addresses.
youre forgetting all the reservations, special addresses, and gateways/broadcast addresses
there 3,706,452,992
thats accounts for that
In the Internet addressing architecture, the Internet Engineering Task Force (IETF) and the Internet Assigned Numbers Authority (IANA) have reserved various Internet Protocol (IP) addresses for special purposes.
and heres another fundamental problem - fragmentation of IP blocks. for every block of ip addresses you have to have a gateway and a router
so if you were to give 1 address to each individual it woudl take up 2x as many
that accounts for everything on here
but it only works if 1 ISP gives out all the addresses and everything goes through 1 router
which is ...impractical
possible IPs doesnt mean useable IPs
how this 3,706,452,992 is how many all the isps of the world have to distribute
that how many that are mathematically possible to distribute
there are organizations that hand out these addresses to isps
youre forgetting all the reservations, special addresses, and gateways/broadcast addresses
i just said 3,706,452,992 is the true number after those special addresses are taken into account
In the Internet addressing architecture, the Internet Engineering Task Force (IETF) and the Internet Assigned Numbers Authority (IANA) have reserved various Internet Protocol (IP) addresses for special purposes.
and heres another fundamental problem - fragmentation of IP blocks. for every block of ip addresses you have to have a gateway and a router
no, still not
thats 588,514,304
thats 588,514,304
that sounds more plausible, is it accounting for usable? you know what i mean by usable, not just possible?
588,514,304 thats how many special addresses that ipv4 has so you subtract that from how many ipv4 can mathematically have 4,294,967,296 - 588,514,304 = 3,706,452,992 that can be used as public addresses and that handed out by the corporations to isps to distribute through out their network
nat is pretty must only used to go to/from public to/from private
isps can use nat for internal networking to cut down on the amount used but that fact is the corporations that hand out these ips are out of addresses and can no longer supply the amount of ipv4 that isps as for every year meaning they are forced to switch to ipv6
well you can hold your breath for ipv6 then
at least in europe
its only widely being used in cases where ipv4 with NAT could be used
ipv4 is 32 bit and ipv6 is 64 bit
ipv6 is 128 bit
no ipv6 is a 64 bit address
ok whatever lol
nvm The main advantage of IPv6 over IPv4 is its larger address space. The length of an IPv6 address is 128 bits, compared with 32 bits in IPv4.[2] The address space therefore has 2128 or approximately 3.4×1038 addresses (340,282,366,920,938,463,463,374,607,431,768,211,456, which is approximately 340 undecillion, or 340 billion billion billion billion, addresses). As with IPv4, some of these addresses are reserved for special uses.
the subnet is 64 bit thats where i got that from
if it takes us 30 years to use 3,706,452,992 how long will it take us to use 340,282,366,920,938,463,463,374,607,431,768,211,456
@long raft i thought the internet had exceded its maximum physical mass for a second there earlier
yes of course that includes special addresses but still look at the difference
thats not what im referring to
then what are you referring to
wfym
you can just say everybody gets 10 ip addresses. you cant say each country gets X addresses. you cant say each meter of ground gets N addresses
because the routing tables would be too large to fit in a non-super computer router
but thats only 128 bits
to store a ipv6 address you can use as little as 1 bit or up to 128
a 128 bit number can produce 340,282,366,920,938,463,463,374,607,431,768,211,456
well you have to use 128 bits per address. so thats 64 bytes per address
on the computer side they dont even know the number all they see is a 128 bit long number
16 bytes *
per address/route
compared to 4 bytes
computers can easily handle that
well they cant, actually.
x4 x the number of routers x the number of routes
you got to realize its not one computer running this
you should read up on the problems with ipv6
that would be distributed through out so many different routers and computers
you need to read it for yourself because you just take the opposite of whatever i say
im afraid ill never be able to convince you, but perhaps someone else could
can you link me to something that explains this
because i dont see it
IPv6 addresses are assigned to organizations in much larger blocks as compared to IPv4 address assignments—the recommended allocation is a /48 block which contains 280 addresses, being 248 or about 2.8×1014 times larger than the entire IPv4 address space of 232 addresses and about 7.2×1016 times larger than the /8 blocks of IPv4 addresses, which are the largest allocations of IPv4 addresses. The total pool, however, is sufficient for the foreseeable future, because there are 2128 (exactly 340,282,366,920,938,463,463,374,607,431,768,211,456) or about 3.4×1038 (340 trillion trillion trillion) unique IPv6 addresses.
they assign ipv6 is must must larger chunks to cut down on routing tables
nah, i suppose its irresponsible for claiming something without offering specific proof, but these are just speculation because its not a problem yet. anything i will find and post you will pick out something about it to argue
and im just not interested in arguing it. ill even concede because i just dont care strongly
but ipv6 will not be switched over to just allocated when necessary meaning more efficient forms of tables can be developed and more powerful computers will continue to expand meaning that we can handle ipv6 efficiently
you say that ipv6 grown exponentially but technology grows way way faster
we can, if we treat it like ipv4
how so
probably just going to skip over ipv6 anyway...
it was a giant disappointment that discarded some of the best features that existed in the draft
how would we skip it
just make a new better ip standard...
that would literally require new hardware all over the world
i switched to ipv6 15 years ago but it went nowhere and now im just back to ipv4
you realize how catastrophic that would be to any economy
thats not what happened with ipv6...
because ipv6 was developed a long long time ago and mostly is supported by all hardware now a days
it didnt break the internet before it was commonplace on hardware
because ipv4 and ipv6 can work together
how?
meaning when ipv6 was rolling out on hardware they also support ipv4
you can tunnel ipv6 over ipv4...but they dont interact
well what i mean is they are both supported by the hardware
if you want to make a new standard then you would need new hardware that supports the standard
and why would we need a new one
also There are ways that a company can work with the two protocols. It's possible to use 'dual stack' devices – routers programmed to work with both protocols – and use 'translation' in which the device the accepts requests from a host on IPv6, converts it to an IPv4 datagram (a self-contained packet of data) and sends it to an IPv4 destination, or vice versa.
dual stack can translate ipv6 to/from ipv4
no Dual-stack IP implementations provide complete IPv4 and IPv6 protocol stacks in the operating system of a computer or network device on top of the common physical layer implementation, such as Ethernet. This permits dual-stack hosts to participate in IPv6 and IPv4 networks simultaneously. The method is defined in RFC 4213.[50]
no tunneling
literally both on the same pc
well then, there should be no problem with a new protocol
there would be plenty of a problem just because the software supports both doesnt mean the hardware does
dual stack only works if you actually have a ipv6 connection and ipv4
so if you want a new standard all hardware in the chain must support it or at least translate it to ipv4
but if translation occurs you wouldnt get the benefit of the protocol
so making a new protocol is pointless
when ipv6 which can virtually never run out of addresses is already supported by most hardware
and also looks like teredo isnt even used The Teredo relay is an IPv6 router that mediates between a Teredo server and the native IPv6 network. It was expected that 6to4 and Teredo would be widely deployed until ISP networks would switch to native IPv6, but by 2014 Google Statistics showed that the use of both mechanisms had dropped to almost 0.
yah people have given up on ipv6, the only place ive seen it widely used in the US is on mobile networks, and they are for sure using some sort of 6to4 protocol
`A significant percentage of ISPs in all regional Internet registry (RIR) zones have obtained IPv6 address space. This includes many of the world's major ISPs and mobile network operators, such as Verizon Wireless, StarHub Cable, Chubu Telecommunications, Kabel Deutschland, Swisscom, T-Mobile, Internode and Telefonica.[53]
While some ISPs still allocate customers only IPv4 addresses, many ISPs allocate their customers only an IPv6 or dual stack IPv4 and IPv6. ISPs report the share of IPv6 traffic from customers over their network to be anything between 20% and 40%, but by mid-2017 IPv6 traffic still only accounted for a fraction of total traffic at several large Internet exchange points (IXPs).`
yes of course its not used because there is no need but thats going to change in europe
for sure
set yourself a reminder for a couple years in the future, compare reality to your prediction.
im skeptical about all of it
few to nobody would ever use ipv6 only for hosting a public IP address, as a server
and thats the only case where ipv4 exhaustion matters
yes but for what benefit. everybody on ipv6 can reach ipv4
so servers have to be on ipv4
not if you are given an ipv6 address exclusively
that would cut out 80% of the traffic of the world or more
i suspect what you are seeing with greece is high ipv6 in mobile phones
nobody on a mobile phone cares about having a public IP address
yes but not servers.
they can scam you on ipv6 now
so it doesnt matter if they use ipv4, they could all be behind a NAT without a problem
what does a nat have to do with it
there is no benefit for 95% of ipv6 users to use ipv6 instead of ipv4
because they could just use an ipv4 NAT instead...
this is why ipv4 wont run out
ok so lets say you are a customer of a isp in europe and they do not have a ipv4 address to hand out what do they do now just deny service
They just buy addresses from another isp
no addresses are handed out by the rir A regional Internet registry (RIR) is an organization that manages the allocation and registration of Internet number resources within a region of the world. Internet number resources include IP addresses and autonomous system (AS) numbers.
I know for a fact Singapore buys addresses from other countries
actually for europe its The Réseaux IP Européens Network Coordination Centre (RIPE NCC) serves Europe
Holy shit you guys are still talking about this
its better than which languages we like or dislike
this is a map the the rir's of the world
basically isps get their addresses from them
if they are out then how could you get a ipv4
watch and find out
im willing to bet ipv4 wont drop off a cliff in the next year in europe
but they cannot assign any more ipv4 addresses
interesting looks like in turkey everyone has ipv6 native support with very few having ipv4
@long raft i legitimately take offense to that response
? Which
its better than which languages we like or dislike
@long raft
I can't imagine how that's offensive
i dont know shit about this, i actually find it useful to know which program is what
ah but opinions on languages are so ... religious. ive been in a thousand discussions about why languages are better or worse and it kind of gets old and leads nobody to any different conclusions
everybody sticks with what they know already
well in case i havent told you all i know is C++ and barely at that
every programmer has a golden hammer
well if you hadnt told me that visual basic was old i would still be trying to learn it
i legit learn stuff from this
i didnt mean dont learn visual basic. it has changed a lot since its inception. c++ is ...older
c++ is 1983?
maybe its not older, im not sure. 🤔
now im extrenmely confused
all i mean was visual basic is not a good language, but visual basic.net is, which is totally different
i think visual basic 1.0 is some time in the 90s, so c++ is older
also today i talked to somebody in an computing related program and they told me that they're learning more and more java instead of python which is what the course used to be mainly about
but frankly knowing c++ makes learning all these other imperative languages easy. because c++ is probably one of the biggest languages of all time
i thought python was new
yea i ... want to say python is like the 90s
im not sure the age of a language means its good or bad tho
you learn the language for the projects youre gonna work on shrug
age doesnt tell you how good the language is
what about pascal
pascal is 5 star language. but dead
different languages can work better or worse for a project
that's pretty much why im trying to not be a one trick pony
C has been really useful for hardware stuff but im scared that if i need to learn something else in the future i'll be shit out of luck
like realistically if you are just handling http requests you dont need c
no need
cant really go wrong with java or javascript or (eww) python
if your metric for measuring python is "do i already like python?", and you do, then yes its great
realistically i think people learn python solely for the libraries. and here we are arguing about the merits of a language again
well its a easy high level language with massive community support
so is java and c#
java has one of the largest communities tho
i think python is more welcoming to non-computer science majors
but ya know R has a big community and its awful
php has a big community, also awful
well when you go to a lower level language people expect you know more
due to the more complex nature
ironically C is less complex than python
how so
much smaller language, easier to learn
ha last time i delt with c i had to manage memory crap
you have to pay attention to memory in every language, really
Hey im figuring out memory crap right now at school
never had to in python
if thats true, then youve never built a big enough program in python
garbage collected languages are implicit memory management, and C is more explicit
well yes i am sure you have to at some point but if you do then it wont be as in depth as c
Is python a heavy program. How small of a ram does a device need to use it
memory management is sometimes more complex with garbage collection
python isnt really heavy
the language definition for python is more complicated than C, like the actual BNF
Yes but is it “i need every single octet i can use” light
so much of C is done with the external libraries
I legitimately have no idea what i would do if i used C before the internet
books
Heresy
they still are
Stack overflow is the new world order
a lot of times stack overflow people will not give you the direct answer without you putting in some work
Pretty amazing to get free answers tho at all
I do take for granted how easy it is for me to look up a specific chip im using and know everything about it from the plastic it’s made of to how well it can handle heat
you can get anything from online
Not the vivox api documentation...
💢
i bet they dont even give it to their own customers and they just have to guess the api
thats why it breaks all the time
i suspect everything about it is licensed, including the instruction manual
imagine licensing a manual
it sounds plausible to do, especially if they had proprietary info in there they wanted to keep secret

licensing a manual sounds like something google would do for its magical algorithms that keep fucking up
@barren quarry thats #off-topic
@strong pawn sure m8
what
I am welkitends
added
By any chance does anyone know how the #648664327292846090 channel works?
@viral terrace One of my bots. Uses Eris (JS). Listens for reactions and then assigns appropriate role based on the reaction. ReactionRoles or Zira would be a similar bot.
Its hidden between the few hundred thousands of people 

Hi guys can anybody fill me in on why they still havent added clan tags am I underestimating the effort involved (seems like a simple String concatenation)
Other priorities
@hard ivy devs have said that its because currently the game runs of steam name so making it run of custom names will take some work, but your right you would think they could add a simple option in the settings the prefix your steam name with something
add in them then having to do customer service type tasks when someone uses anything they consider forbidden for a name
Imagine the dozens of customer service requests they would receive!
Subscribe to Escapist Magazine! ►► http://bit.ly/Sub2Escapist
Yahtzee continues work on The Magic Poo Machine, his 10th Dev Diary game.
Want to see the next episode a week early? Check out http://www.escapistmagazine.com for the latest episodes of your favorite shows.
-...
yahtzee's dev diary series is a godsend
to be fair the only 4 things we ever needed (and still need) were transistor logic, assembly, C and C++
all the other stuff relies on runtimes because people don't want to actually learn how electronics work and care about stuff like memory management
that's why so many games can barely host 20 players, while EVE can have 4000 player battles all in one screenshot... and it's not a problem with graphics, since you know, EVE has some of the best graphics, in fact it comes down to how well you optimize things like data storage and transmission ... 1 kilobyte multiplied by 20 players is 20kilobytes, and of course transmitting that data, it now becomes 20KB*8 bits per byte = 160 kilobits, and if you need to transfer that in one second, all your players must be able to download at a constant rate of at least 160kbps each and your server must be able to send data at at least 20 players x 160kbps= 3.2mbps constantly
that has no baring on runtimes
I can tell you right now voice chat uses 30-100kbps, you're better off allowing people to just disable it completely if they want to use an external voice chat
and just because the server needs to handle that much doesnt mean the clients need to
ya if i sent that much data on a server i would not be able to host it
with a program like murmur, I can configure it to use high definition audio which is better quality but perhaps more bandwidth, or telephone quality which is very low bandwidth, but in foxhole for example, there's one hard coded setting and it's not possible to make that more efficient or sound better
i have 5 down .4 up and can host a gmod server fine with 6 people
also in discord i can change the bitrate
discord can do 8kbps
yes bitrate affects quality but you can turn it down if someone like me for example, who has a throttled internet connection wants something low profile
and yes in fact it is a numbers game, servers have to relay data to every client, that's why like I said, your servers are taking a huge performance drain on every bit of data you need to relay to the clients
it's why voxel games were fail right from the start
not everyone has massive data limits; if you're in canada, most of the country has 20-100GB data limits and if you love voxel games, well you're going to blow that limit in a week or less
i live in canada and have unlimited
well you are probably in a city I guess
small towns or more isolated areas have some pretty strict data limits
very small town with 0 competition
running on good old dsl
look at that data being buffered on upload
amazing isnt it
it's great to run a small IRC network if you want to test how data relaying and traffic works, it's actually a great way to learn
i mean i have worked with the rcon protocol
and sniffed the packets being sent and how everything works
there are so many things involved, like for example, how to relay data to clients - you can use the dev/poll, kqueue, select
some servers like the dovecot mail server uses time based data, so if your server time changes, the server literally cannot work and it core dumps lol
that is a massive pain in the rear, that's why most people don't put mailservers on a box with other services
are you confusing this for https?
as with https if you change the time everything get screwed up
it's a mail service not webserver
does it use encryption
usually does, yeah
well then its probably the encryptions fault
as the certificate would be invalid if time is messed with
it's literally just a few minutes off that can cause dovecot to core dump
if the new time is in the future, it's ok but if set to the past, it thinks all the mail already in the box is there at the wrong time and then can't work
that seems like a limitation of just how the software marks time on the emails
yeah there has not been a lot of better ways to synchronize servers other than time based synchronization
what do you mean by synchronize servers
well dovecot works with a different service, like courier-mail for example, which is the underlying mail client that handles the socket and all that, whereas dovecot is the mailbox front end of the server
so in courier for example you can set up imap or pop mail
just apply a unix time stamp to the email
that way it wouldnt matter on the time of the server
it would read exactly how it is
the alternative is just to use microsoft exchange server if you want everyone (well, everyone as in whoever buys data from microsoft) to read all your mail
well all your emails are stored unencrypted anyways so anyone can read them if they knew where to look
like google
same goes with anything with google or any other service
they can see it all
the point is when you run your own mailserver, unless you give people access to the unix server, those mails are not accessible by google or anyone else
only service that i know of that encrypts is protonmail
unless of course it's a microsoft server, lol
ez just do drive level encryption
or just encrypt all emails coming in
microsoft cant read it then
all mailservers pretty much these days have encryption on the connection, but on a windows server the problem is backdoors
that why you dont use windows
linux is way better
for server stuff
and way more secure
the great thing is you can use self signed certificates, since it's literally just encryption and no authentication part is needed
well yes you can
using encryption for authentication was the worst idea of the 20th century, but that's my opinion
certificates are generally for connections where mitm can happen
the problem is you really can't trust CAs even though they pay lots in donations to mozilla and others to have their root certificates trusted by browsers
for just data encryption there is no need for a certificate
the public key is essentially a certificate
the only real difference is some extra attributes are added and there's a format done to it
of course it also holds the signature
public and private keys are used to verify the message
you still have to use the private key to make a signature and the public key to make the certificate, but openssl (assume you are using this) just does some of the functions automatically
you encrypt a message with someones public key and only their private key canm see it
yeah that's essentially how openssl functions
veracrypt i dont think uses any form of keys just encrypts and decrypts data using the password
the certificates are really just used for authentication (the signature and fingerprint), but since they contain the public key inside them, you can use them to encrypt as well
but certificates are only used to very the source
it's essentially that part that to me is basically the most insecure part of PKI
why is it insecure?
the only way you can actually trust a certificate is if it's signed by a root CA which costs a lot of money generally, and a lot of root authorities have allowed hackers access to make certificates and they abused it a lot
certificates verify the source while the encryption is different
the google CA is the worst one, unfortunately everyone uses it now because it's free
you do know that you can add your own certificates to anything right
I have a big book on it so yes
i mean i wouldnt say its that bad
one of the best resources that explains exactly how it works and why authentication with openssl is really bad
The root certificate is usually made trustworthy by some mechanism other than a certificate, such as by secure physical distribution. For example, some of the most well-known root certificates are distributed in operating systems by their manufacturers. Microsoft distributes root certificates belonging to members of the Microsoft Root Certificate Program to Windows desktops and Windows Phone 8.[2] Apple distributes root certificates belonging to members of its own root program.
so root certificates are distributed at a operating system level
it's kind of misleading as an explanation, because it's basically a group of companies that paid to have their root CA added to each OS and each web browser so that any certificate signed by them is trusted
it's kind of like allowing mcdonald's to run canada because they have a lot of money
but they should have been tested by the companies that add them
as long as root has not been compromised there is no way a hacker can any foot hold
there used to be a nonprofit org called StartCom based out of Israel that offered cheap signatures for like 60 bucks a year to have your certificate signed and backed by your passport and driver's license... unfortunately, the bigger companies didn't like it and made sure they were taken off the root CA list of everything, and then they sold their operation off to chinese
these days if you want a good trusted signed certificate I think the last price I saw was about $200
and that company did not even ask for your passport or anything
google's CA is bad because they don't require any of your personal information
the whole idea behind a trusted CA is that every certificate they sign is trusted, especially if it's going to be used to authenticate something like your bank account
at least with StartCom, any hacker who tried to do anything bad, since they have your passport and driver's license they can track you down quite easily if you try to use their root CA to sign a bad certificate
but that cant effect you google signed per certificate meaning only that certificate is to 1 server or company
meaning that you cant just spoof it
google practically opened the door to a millennia of hackers to sign bad certificates and try to break into banks
there is still a way to protect yourself, you can check the certificate signer and make sure it's a good one like verisign
how would a certificate allow you to break into a bank?
and if thats the case why havent i seen any reports of it
the way it works, first they have to poison your DNS server or whatever DNS server you are using
right so now they see the bank site
the way DNS works is when you go to something like foxholegame.com, whatever DNS server you are set to use is contacted, and that DNS server tells your computer what IP address to connect to in order to visit foxholegame.com
yes this is what encrypted dns is supposed to fix but that only allows them to change where you go but to do that they need their own certificate that is signed by the bank
if you wanted to direct someone to a bad website, you would break into that person's router, because every computer now references the router's DNS cache, then they would put in code into the router's firmware that would make foxholegame.com for example resolve to a bad IP address
breaking into a router isnt as easy as it sounds
routers are not perfect, they are very vulnerable and most people have no idea what DNS is in the first place
you would have to have a 0 day
lol
well I am a hardware guy thats why I put together these cool projects from aliexpress
well i am sorry to say but you cant just break into someones router without a known exploit that would be patched or a 0 day
like this one for example
looks more like you would have physical access to the router with that
it doesn't have to be physical access to be able to upload firmware
but you need to break into the router using a exploit
and that's precisely the thing
they are all exploitable unless you made your own system with a raspberry pi cluster and configured it all yourself
as in, instead of using a router, you use raspberry pi with several RJ45's to connect your network
so you are saying every router in the world has a exploit
quite literally, unless you're updating it yourself all the time
and no a raspberry pi would not change anything
oh, you mean, self-updating, that's even easier for attackers
yes theoretically
but making your own system, there's no mass produced system that a hacker can figure out and reproduce his exploit on it
so your logic is flawed to give up a router designed for network communications for a general purpose computer that would also be exploitable
ok but what software would you run
the way they do it is they buy the same hardware everyone else buys off the walmart shelf, and they look for how it works (sort of like what I do) and figure out how to break into it, then they develop a plan to break into others based on that
now the way this ties into root CA's is that the certificate authenticates the domain name to the IP address
so if the IP is a bad server, the certificate should point that out
however, if the hacker can use the root CA to sign his certificate, he can just use your domain for his IP on his certificate
and now your browser trusts it
a certificate proves that the holder uses that domain and if the ip changes as long as the domain is the exact same it doesnt do anything
the only way he could get you to use his bad IP is through DNS poisoning but that is not a difficult process these days
that would mean you would have to click on a bad link in the first place
or the bank has a intrusion
doesnt have to be a bad link
if the DNS is poisoned, you are redirected to the bad IP no matter what
most people get to the ban using google meaning the chances of getting a bad link are basically none
any link you click on will refer to whatever DNS server you're using
but again you are not just changing dns records that easy
routers dont even expose anything to the internet
by default when you connect to a router, your computer automatically sets DNS to the router
every router (there's no router that does not do this) uses DNS caching
yes now how are you going to get into a firewalled router that does not open anything on it wan port to new connections
the modem sends the ISP's DNS info to the router, then the router forwards you to the DNS servers of your ISP and internally has a DNS cache which is like a history list of previous domains you tried to resolve and it gives you an offline sort of resolution
by poisoning the router's DNS you need to store a domain with a bad IP in that cache
yes the hosts file
no thats static ips
it's not technically DNS but I know what you mean
ah yes, windows 10 stuff
most OS don't cache DNS but modern windows versions probably do
extremely old routers from the early 90s also did not have DNS, you had to manually set DNS servers in your connection
actually you can run that on windows 7 as well
the one point that bugs me is I can't force windows 10 to stick to my custom DNS servers, it always ends up changing back to default, even if I change it in the registry
i can just change the adaptor settings
not like it matters tho as again nobody is going to get into your router
windows 10 will keep changing it back to default though no matter how many times you change it
that's a real bad way to look at security, because it does happen a lot
i havent had any issues
i had it set to 1.1.1.1 for the longest of times
never changed
well I guess if you have enough money in the bank that someone wants, it becomes a bigger issue lol
till i set it back to automatic
these days the bad guys buy your data and they know you're wealthy or not and they target the people with money
thats a targeted attack and would require a exploit
also Many cache poisoning attacks against DNS servers can be prevented by being less trusting of the information passed to them by other DNS servers, and ignoring any DNS records passed back which are not directly relevant to the query. For example, versions of BIND 9.5.0-P1[2] and above perform these checks.[3] Source port randomization for DNS requests, combined with the use of cryptographically secure random numbers for selecting both the source port and the 16-bit cryptographic nonce, can greatly reduce the probability of successful DNS race attacks.
also there is dnssec and dns over https
there's a lot of fancy words behind tech that never really worked or never really did anything
dnssec is a great idea to prevent spoofing of a DNS server, but how many computers have a built in system to check if a DNS server is legitimate or not
so are you telling me the specifications behid dnssec are useless
you'd need a DNS trusted list like the CA root list but there is no DNS trusted list anywhere
also dns over https doesnt work
DNSSEC works by digitally signing records for DNS lookup using public-key cryptography. The correct DNSKEY record is authenticated via a chain of trust, starting with a set of verified public keys for the DNS root zone which is the trusted third party. Domain owners generate their own keys, and upload them using their DNS control panel at their domain-name registrar, which in turn pushes the keys via secDNS to the zone operator (e.g., Verisign for .com) who signs and publishes them in DNS.
yeah DNS still uses the old port 53 unencrypted, but from one DNS server to a master DNS server you can have an encrypted link
so there's a whole other topic of DNS servers connecting to each other rather than the issue of DNS clients trying to resolve names
so when you buy a domain name, your ISP asks you for your nameservers, generally like for me, I use one nameserver instead of two, just because
well if not directly a client issue then something is fucked with dns servers and at that point might as well go back to the old days of typing in the ip
I got a letter from circa about my use of only a single DNS server, apparently I was not conforming to the specification, but what do you know, they have little control of what I can do lol
well ya its a specification to have a backup
anyway, so you tell the registrar which IP address you want to list as a nameserver, usually the IP of your server that you will run bind on
its recommended
in my case it was for both ipv4 and ipv6 and I had to explain to them how it works because another client was interested in ipv6 routing and nobody there had a clue how to do it
the registrar's nameserver will point to your server when a query goes out for your domain name or its subdomains
what does that have to do with having one dns server
bind, if it's running (hopefully it's running) should have a master DNS record in it for your domain name, something you must create, which is a zone file and it lists the time to live, who to email if they dont like your domain, and all the cool record lists including your reverse DNS because who does not love the idea of resolving your IP to your fancy new domain name
when you create a sub domain off of your domain it will push the ip to the root servers if someone asks for that domain it first goes to a non authoritative dns server and if no cached then goes to the root
well, generally, you should have two or more, and it's kind of pointless these days because servers are never down except when a tornado hits the datacenter
long ago when the specification was created, it was common for servers to be down for 8 hours up to a week
now people panic if the server restarts on its own or makes a funny noise
thats like saying you shouldnt have a safety net when going on a rope across a cliff
because most people dont fall off
the time to live tells cache servers how long to store the record in cache before deleting it and retrieving it again
well, mostly slave servers but that's kind of a politically incorrect word these days
usually your data center is the slave server, because you want to host the records on your own server and the main data center will have its own server dedicated to providing slave DNS for secondary nameservers
to me it was just extra hassle, I went with single nameserver
secondary name servers are just another dns server that usually runs on a separate server or in a separate datacenter so if the first one goes down then the secondary is used
it has no ties to the primary server
well there can only be one master zone file
the rest are slave zone files and they bascally just contain basic stuff and then a key that is exchanged with the master to authenticate
but the primary nameserver contains the master zone file and the secondary server has to basically copy the records from the primary server, and when the primary server goes down, the secondary one carries on providing the records when someone wants to resolve a domain
zone files just transfer data between the 2 dns servers
but also has its own connection to a root name server to resolve new requests
or expired requests
you can do a sort of round robin but that is a bad idea, where you use multiple master zone files... your registrar will complain about it eventually
if you don't follow spec, they can tell you to fix it or cut off the service, which of course if you make mistakes like I did learned the hard way a lot
as for more than 1 nameserver it's not something most providers care about anymore really
with dnssec, the idea is your connection between the master and slave servers is protected from spoofing
well they are protected yes
it does not protect the end user really, just on the server level
well it kind of does
routers are not really slave servers since they dont store zone files, they just basically keep a history of sites you browse basically, it's a great way for cops to see what you do on your computer
hence why when they raid people one of the things they take for forensics (hardware guys) is the router of course
it's really easy to get the data off those, it's not stored with a password protection, there's no encryption, and it's not mixed with much other data
but you need physical access
if you notice on a PC, your bios/uefi data is basically stored like that
remove the battery even for a second and that data is back to default
it can cause some really bad troubleshooting problems if you are trying to install a new hard drive or something on an older machine with a dead battery
no it would just cause you to reselect the defaul boot device
volatile memory can be saved with a battery if it's wired for that
so if you remember nintendo, the first one, a battery was used to keep your save game files active on volatile memory
on non essential data
I have a hosting on Namecheap now, and all these options are confusing me
Should I turn on DNSSEC?
Anyone here a Java nerd?
i know some java
So I've been trying to make a program using switch case.
However, for some reason, it's not allowing me to scan inside a case.
import java.util.Scanner;
public class Trabalho {
public static void main(String[] args) {
System.out.println("1 para CD, 2 para livro, 3 para software: ");
Scanner leia = new Scanner(System.in);
int valor = leia.nextInt();
double frete;
String nomeb;
frete = 6.50;
switch(valor) {
case 1:
System.out.println("Digite o nome da banda: ");
nomeb = leia.nextLine();
System.out.println("Seu CD da banda "+nomeb+", está no valor de: "+frete);
break;
default:
System.out.println("Número inválido.");
}
}
}
When the console reaches case 1, it doesn't allow me to type the band's name. Due to this, it leaves a blank space where "nomeb" is supposed to be.
Is that a syntax error from me or a "switch case" limitation?
I dont know java, but I am pretty sure a switch can handle that, since its just an efficient way of making if statements
it all looks correct to me...
does it work if you remove the printlns? i cant really imagine any reason for this
i guess you wont know if it worked lol. well maybe if you remove the println right after case 1:
ooooh i see why
nextInt doesnt read the endline character
you just need to slap in another nextLine() or instead do int valor = Integer.Parse(leia.nextLine());
I'm still a beginner. Could you explain with details what I did wrong in the code?
imagine you read from a text file instead of the console
now you are reading the numbers, but not the endline marker (or enter key)
when you try to read a string, it's already at the end of the last line, it's blank
so after reading the number you need to read/consume the endline. in unix its just character #13 and in windows its character #10 (line feed) and #13 (carriage return)
/n
Oh. It's like the scanner already had a value to it and couldn't read the string.
So I needed to either create another scanner or "jump to the next line".
So a scanner has 2 informations:
The value for the switch
The string put in the cases.
So in the last suggestion you put, the code is reading the string and wrapping it in the int variable. Essentially creating 2 lines.
Correct?
uhm like this, input page looks like:
1
test string
after nextInt() the scanner is here:
1|
test string
but you expected it to be here:
1
|test string
Oh okay I get it.
ok can anyone give me a quick run down on ajax?
just trying to touch up my skills and realized that I dont remember much about that
ajax is just a call from the browser to your web server requesting specific data (not a whole page) in json or xml format, and then javascript using that data on the client side
could be done with websockets too
use jquery for you ajax
or just use fetch.
xmlhttp works as well
its useful especially when it comes to requesting api data because i request it very often and need to check etags
i dont think fetch has etags
but ive seen that fetch is really simple to use
Charlie Omega Omega Malibu
anyone familiar with openCV?
int index = GetRandomValue(1, 9);
int card = cards[index];
cards[index] = 0;
if(card == 0) card = Dealer(0);
return card; ```
I am having an isuse with my dealer
how do I fill the array back in to its starting position?
cards[] = {5, 4, 4, 3, 3, 3, 2, 2, 1, 6}; isnt valid code
a for loop seems too complicated
@coral sundial why is your array in curly braces
@coral sundial did you try specifying the number of cases in your array
@coral sundial also arrays start with 0, not 1
make a copy with the starting deck, and then just copy it over...
for (int i=0;i<10;i++)
cards[i] = starting_deck[i];
what language is this even.
C
With raylib as framework
@timber onyx oh shit, good observation
Didnt catch that
altho ıt might just be a compiler thing I just took a quick peek at the code u share but I haven't seen any problems
and @timber onyx array starts with 0 but as far as I recall I don't remember anything about values needing to be starting with zero
he was talking about this Spartan
int index = GetRandomValue(1, 9);
that would cause the cards[index] to never be able to get the first array position
since it could not be 0
and if it where nine, it wouldnt be inside the array
^
this actually caused my program to crash looking back on it
it would return some memory value I think.
im ignoring everything rem says because i learned programming on BASIC
only other BASIC programmers will laugh at that
I always think I am having a stroke reading C because it is like Python but its Not™️
In python.... no strong types, python is interpreted bytecode (not cpu instructions), no concept of a pointer, designed to facilitate OOP. Keywords are largely different other than basic control flow if/else
I guess if you code a lot you become language agnostic except to stuff like clojure/lisp or asm
also whoever said that code was C is wrong, it's C++, which you can tell because there's an object being constructed (Dealer)
no its c
the dealer is a function
that returns a card
I guess you could call it object orientated programming in the literal sense of the word lol
but its using a framework that also accepts c++. I have used structs to define the position of the cards on the screen
@coral sundial did you end up figuring it out? Also interesting aside: in C++ you can overload typecasts such that if you declare 'operator int() const { return foo(); }' in a hypothetical dealer class then Dealer(0) would have a conversion to int to make that code correct in C++, if it were a class and not a function where foo() is a callable function.
A better alternative is to use memcpy(void *, void *, size_t).
E.g.: memcpy(cards, starting_deck, sizeof(cards));
I did
with that information I constructed
{
static int cards[] = {5, 4, 4, 3, 3, 3, 2, 2, 1, 6};
int index = GetRandomValue(0, 9);
int card = cards[index];
cards[index] = 0;
if (init == 1)
{
int startingcards[] = {5, 4, 4, 3, 3, 3, 2, 2, 1, 6};
for (int i=0;i <= 9;i++) cards[i] = startingcards[i];
return 0;
}
if(card == 0) card = Dealer(0);
return card;
}```
I could use sizeof to determine the max random value but I havent been bothered yet
I'd make startingcards static as well, otherwise its provisioned on the stack each time dealer is called unless the compiler optimizes it
I mean I could, but its not that big of an issue since the only time I need to regenerate the deck is if the round ends
oh of course, but it's good to develop good habits/insights ^^
to be honest, I want to move all integers to the main, so I can work more with pass by reference stuff
I see code all the time where people say they'll refactor it later but it goes into production even though it was meant as band-aid fixes
wheezes XD
I mean my previous dealer worked as well
but it was hell to adjust the cards
I had 7 integers, 1 to 5 + bomb, an integer tracking the total amount of cards
and then a switch case selecting a random card
and subtracting that
that was fun
not
but I dont really see why I should refactor this again. its somewhat done as a personal project and I want to move on to 3d vectors
I'd also look into implementing a state machine in C
seems like it'd lend itself well to a dealer-esque thing like what you've got going on
LOL
Thats upsetting
my graphic plotter didnt save
oh there we go its back
how do 3d math functions work anyway
also how does the scope of a structure work
I declared one but I can acces it from literally anywhere. dont have to pass it through functions
you guys all work in programming field or just a hobby?
I thought the scope of a variable, function, method, or object was determined by where it was declared. If it was declared within a method or function, then only accessible within those braces. If defined within a Class, then any object of that class should be able to access it?
If you declare the struct as global in the main function, it should be accessible anywhere.
@hoary dune I just started reading the last bits here. I used to 'code' as a hobby.
I miss-read Rem's previous post.
I declared one but I can acces it from literally anywhere. dont have to pass it through functions
@coral sundial I read 'can' as 'can't'.
@coral sundial can you show an example of how you're using the struct, such that you can 'access it'?
I presume you don't mean it's members, but rather you're able to make a declaration using its type?
@hoary dune Yup, though currently unemployed ;p
ahaha, yes of course
I am going to study mechatronics
I actually already did but dropped out due to math
doing a math course and making silly things with C right now
{
int width;
int height;
int x;
int y;
int card;
} dealer, deck;
void InitDealerCard(card)
{
dealer.width = 160;
dealer.height = 160;
dealer.x = DscreenWidth/2;
dealer.y = DscreenHeight/2;
dealer.card = 0;
}
void InitDeckCard(card)
{
deck.width = 160;
deck.height = 160;
deck.x = deck.width;
deck.y = DscreenHeight-deck.height;
deck.card = 1;
}```
InitDealerCard();
InitDeckCard();```
calling them from the main with that
@gritty nexus You're right, it's about where you declare it. If it's declared on the stack, the intuition behind scope is pretty clear - a stack frame is created and then subsequent required data is put on the registers as needed etc etc) if it's static and declared it gets put in the .data segment where it can be accessed from anywhere, heap = dynamically allocated and doesn't get freed despite losing scope (resulting in memory leaks) which is something to be careful about, etc etc
looks like in your functions, you would need to use card, in place of dealer and deck usage.
because dealer and deck are both 'card' it doesn't throw any errors, assuming it compiles.
it works perfect
the only thing is I can call it from anywhere. as if card is a global variable
good, then when you declare struct card in the main, it is basically global, as far as I can understand.
line 8: } dealer, deck;
^ this line is a declaration, the variables are global (.data segment) and can be accessed anywhere, independent of the stack (and related scoping)
they are zero-initialized
Ya'll dont realize C is practically the same as C++. but C++ is well. C but ++
C++ is object oriented, where as C functions more or less without that specific support for 'classes'
procedural.
All C is C++ code, not all C++ is C code. Lots of abstractions and new concepts to learn in C++
It's certainly much safer to use
thats why C is a good languange to start with, has all the basics. but its just a pain sometimes
the constructors, casting, abstract inheritance, and compiler specific 'catches' is nice.
destructors, move semantics, lambda expressions, templating
^, those too.
that moment when you realize you havent ever needed those
Sorry guys, I need to go move the Squad storage items. See you around next time. Good luck with the dealer.
variadic arguments, parameter packing...
anyway back to structs. line 8: } dealer, deck;
this is the line that makes dealer.stuff and deck.stuff global? how would I not make those global?
ciao ciao ^^
remove "dealer, deck;"
then declare them in the scope you want
struct card dealer;
huh
right, ignore mine
interesting
typedef struct card card;
card dealer;
you'll see stuff like that a lot if you keep dabbling
I took a look at the engine code and I see alot of stuff I dont understand LOL
like this.
float x;
float y;
float z;
} Vector3;```
what is happening here? is vector3 global?
Vector3 is a type, it's not a variable
in your example, it's a zero-initialized variable because it doesn't have the typedef keyword
and how do i acces x, y and z
you need to make an instance of it on the stack, heap or w/e
Vector3 exampleVector;
if you didn't have type def and removed the Vector3 at the end, you'd have to do
struct Vector3 exampleVector;
and that creates a new vector3 with that name?
yup
and then I can acces it with name.x etc.?
yes
can I do the same with my card struct?
you sure can
and it just creates a whole bunch of new variables automatically?
communication error what do you mean xD
like, I dont get what its doing adres wise
if I declare an integer. it reserves a bit of memory with an adress
what the fuck does a struct do
reserves more memory
it feels like handholding
well... first off... it depends on where you're allocating that integer lol
hides
I mean... a struct is just a compound type
it may have different types of data in it's allocation.
similar to an Object
you might want a Phone book struct, for example, that has String,String,Int, etc.
you don't care about addresses unless it's on the heap, generally
so you might pass a Phonebook to a method to create a record of a person's Name, Number, and Street address, or some other data.
in c, you'll want char *'s instead of strings ahaha
oh so its like a friend book. and you pass it to your friends to write in?
it's like a printing press, and you give it blank paper
and you tell them what words you want on it, and they give it back to you, and you can be confident the pages you didn't tell them to print text on will be blank
so to speak in code. they declare their struct friend name. and they get to fill out all the funny variables you put in that struct?
struct myBook { float weight; float height; bool isMyFriend;}
and whenever they declare their struct version. the compiler reserves some memory for all the integers and strings you make them fill out. for every friend filling out their own struct
myBook.weight = 125
myBook.height = 1.2 (meters)
myBook.isMyFriend = true
something like that would be initialized
where as a function might look like this
uhhh
I might be way off
it would if it declared a variable called myBook
right, I forgot the in-line declaration earlier
and Rem, I think your understanding of it is correct
if I'm not mistaken by your word choice XD
yeah me things its correct too xD
its like a friendship book. and every struct friendship yourname is a page.
do you perhaps also now how to enable serial communication between your computer and an arduino?
have you checked the arduino's datasheet?
I got a book for this dont worry
I haven't worked with microcontrollers in a hot minute