• What Do You Need Help With? V6
    7,544 replies, posted
Be sure to use the features C++11 has.
This is more of a theoretical question, but is it possible for a type to use less than a byte? Specifically I mean is there a possibility for a perfect boolean type which occupies the memory space of a single bit? I'm guessing not on typical computer architecture which uses 8-bit (1 byte) cells for each address in memory, but is it possible to have 1 bit addresses in memory?
Not on any architecture I know of. Most architectures are byte-addressable, meaning each memory address corresponds to a single byte. You can't get an address to a single bit. It is possible to make your own type that uses bits to store information and you use bit shifting and masks to access the values. For example, in a C-like language you can use (value >> 6) & 3 to access bits 6 and 7 (with bit 0 being the least significant) of value.
[QUOTE=proboardslol;46131905]This is more of a theoretical question, but is it possible for a type to use less than a byte? Specifically I mean is there a possibility for a perfect boolean type which occupies the memory space of a single bit? I'm guessing not on typical computer architecture which uses 8-bit (1 byte) cells for each address in memory, but is it possible to have 1 bit addresses in memory?[/QUOTE] an std::vector<bool> is a bit sized container but I think it still allocytes bytes of memory, other than that I've never heard of anything like that.
Anyone here do any Lua coding for Dota 2? I'm currently working on a custom hero and I'm trying to create an ability that works similar to Earthshaker's ultimate, but works in a line rather than a circle if that makes sense.
[QUOTE=slayer20;46132745]Anyone here do any Lua coding for Dota 2? I'm currently working on a custom hero and I'm trying to create an ability that works similar to Earthshaker's ultimate, but works in a line rather than a circle if that makes sense.[/QUOTE] What have you got so far?
[QUOTE=proboardslol;46131905]This is more of a theoretical question, but is it possible for a type to use less than a byte? Specifically I mean is there a possibility for a perfect boolean type which occupies the memory space of a single bit? I'm guessing not on typical computer architecture which uses 8-bit (1 byte) cells for each address in memory, but is it possible to have 1 bit addresses in memory?[/QUOTE] I don't know of any machines that address less than bytes in memory, but there are architectures that allow bitwise register access.
[QUOTE=ben1066;46132806]What have you got so far?[/QUOTE] The way mine currently works is like this: -Create linear projectile with a fixed distance -Projectile applies debuff to targets hit -Check entire map for enemies with debuff (my code isn't working here, as it counts ALL enemies found, instead of those with the defbuff) -Add together heroes + ability level damage -Add together creeps + ability level damage -Apply damage + extra damage The way I want it to work is like this: -Hero teleports to a distance specified by the player -Get all enemy heroes and creeps within radius from in between Hero's start and end position -Add together the amount of heroes times ability level damage -Add together the amount of creeps times ability level damage -Apply base damage + extra damage (heroes + creeps) + stun enemies
Anyone have any good pointers on a job system in c++ that deals with dependencies? I've made a normal multithreaded job system but it doesn't manage dependent jobs. EDIT: I'm using the C++11 thread library
And it was all going so well. I've hit another .NET vs Mono discrepancy. Mono has decided to run my code just fine, however .NET seems to think I have a null object somewhere. [url]https://github.com/benpye/TCCSharp/blob/496ec1c0dffba98dbb1ec7bdfd8320c2f8d69745/TCC/DelegateWrapper.cs[/url] is being used by [url]https://github.com/benpye/TCCSharp/blob/496ec1c0dffba98dbb1ec7bdfd8320c2f8d69745/TCC/CC.cs[/url] as called in [url]https://github.com/benpye/TCCSharp/blob/496ec1c0dffba98dbb1ec7bdfd8320c2f8d69745/TCC.Examples.SimpleBinding/Program.cs[/url] . Don't suppose anyone has any examples of a similar delegate wrapper or something else?
More of a soft question: should I bother learning Java if I would ever want to code professionally (more in a scientific/engineering environment)? I know some C++, C, Matlab, Python and Fortran (and they're nice languages imho, although I don't like Matlab and Fortran that much) but Java seems like such a bitch, but it dominates every single goddamn course at my university. What do? On a side note, would you prefer knowing a single versatile language really well or rather be okay'ish at several languages? How long do you have to spend to know a language to a decent level? It seems to me that once you have some programming experience, getting started and doing actual useful stuff in any language doesn't take that long. Can you just show up at a company with notions of language X but tell them that you can get up to speed in a couple months? Of course you have to nuance this, knowing some C and then saying that you're able to do heavy OOP in C++ in a couple of months is stretching it... Also, how do you learn collaboration/big projects? Do they train this in CS courses? I can't fathom how you can work on a thing with 100s of other programmers on a project with thousands of lines of code. I'm asking this because although I study physics, I like programming a lot and making a living with it seems like a viable choice. But I don't know how IT companies see physicists, it's a different degree after all...
I'm following some tutorials trying to make a platformer (I just want a simple game to make sprite animations for) How do I control how tight my character is? I'm using unity's first person controller. How do I make it have less friction, is that physics thing?
I'm getting into Android development again, and don't really have any ideas for projects that are simple enough to actually finish. Do you guys have some ideas that could get me started?
[QUOTE=tisseman890;46139717]I'm getting into Android development again, and don't really have any ideas for projects that are simple enough to actually finish. Do you guys have some ideas that could get me started?[/QUOTE] Facepunch app :v:
[QUOTE=tisseman890;46139717]I'm getting into Android development again, and don't really have any ideas for projects that are simple enough to actually finish. Do you guys have some ideas that could get me started?[/QUOTE] make an app that says hello world
[QUOTE=proboardslol;46139870]make an app that says hello world[/QUOTE] I'd buy that.
[QUOTE=Goz3rr;46139848]Facepunch app :v:[/QUOTE] Well, I actually tried when the old API was working, but failed super hard. And I have no idea how to use the new one. If there is a documentation for the new API I would love to try again! [QUOTE=proboardslol;46139870]make an app that says hello world[/QUOTE] Okay, not that simple. :v:
The term 'syntactic' comes a lot when reading about semantics and syntax, what does it mean?
[QUOTE=tisseman890;46140186]Well, I actually tried when the old API was working, but failed super hard. And I have no idea how to use the new one. If there is a documentation for the new API I would love to try again! Okay, not that simple. :v:[/QUOTE] Make a Body Mass Index Calculator :V
[QUOTE=tisseman890;46140186]Well, I actually tried when the old API was working, but failed super hard. And I have no idea how to use the new one. If there is a documentation for the new API I would love to try again![/QUOTE] The joke is that Facepunch apps never get "actually finished".
This might be rather dumb and lame question, but I will try. Lately, I've been thinking about what language I should learn, but every time I end up thinking about that what I am going to do with it after I get basics. Did this occur to you as well?
[QUOTE=Rayiner;46141851]This might be rather dumb and lame question, but I will try. Lately, I've been thinking about what language I should learn, but every time I end up thinking about that what I am going to do with it after I get basics. Did this occur to you as well?[/QUOTE] It sort of depends on what you want to do. No language can do everything, but it's damn near close. The process of how to solve a problem, in my mind is: State Problem -> figure out solution to problem in generic pseudocode -> consider which language is best for this type of problem -> implement code -> solve problem. So if I'm looking to do some low-level stuff, I might use C. but if I'm looking to do some game programming, (Unless I feel like writing my own graphics library and physics engine), I'll probably choose a higher level language like Python or Java which has a lot of libraries available for it already. But the essential part is to go through the steps of problem solving before jumping straight into the code. Otherwise, a stream of consciousness method tends to get sloppy and my projects never get finished that way.
[QUOTE=Rayiner;46141851]This might be rather dumb and lame question, but I will try. Lately, I've been thinking about what language I should learn, but every time I end up thinking about that what I am going to do with it after I get basics. Did this occur to you as well?[/QUOTE] I'm learning C#, and it's a very good language. If you don't know it yet, i suggest you learning it.
[QUOTE=EmilioGB;46142072]I'm learning C#, and it's a very good language. If you don't know it yet, i suggest you learning it.[/QUOTE] Well, since I am an avid Linux user, I don't really it'd work for me at all. However, thanks!
[QUOTE=Rayiner;46142168]Well, since I am an avid Linux user, I don't really it'd work for me at all. However, thanks![/QUOTE] C# works just fine on linux too.
[QUOTE=Rayiner;46142168]Well, since I am an avid Linux user, I don't really it'd work for me at all. However, thanks![/QUOTE] C# works on linux using Mono. [editline]3rd October 2014[/editline] So what are the potential uses of a Union? [editline]3rd October 2014[/editline] Also I figured out how to access a single bit of memory at a time
[QUOTE=proboardslol;46142258]So what are the potential uses of a Union? [/QUOTE] Unions are cool for shit like this [CODE]class Vector3 { union { struct {float x,y,z;}; float arr[3]; } }[/CODE] the vector3 class's members are now accessible by both array access and X Y Z individually.
[QUOTE=FalconKrunch;46142607]Unions are cool for shit like this [CODE]class Vector3 { union { struct {float x,y,z;}; float arr[3]; } }[/CODE] the vector3 class's members are now accessible by both array access and X Y Z individually.[/QUOTE] Don't you need to name the Struct?
[QUOTE=proboardslol;46142622]Don't you need to name the Struct?[/QUOTE] [del]If we're talking C++ then you don't have to, I don't know if there's other languages that support nameless structs/unions.[/del] [QUOTE=farmatyr;46142992]Anonymous structs are not part of the C++ standard, anonymous unions are.[/QUOTE]
[QUOTE=Number-41;46135844]More of a soft question: should I bother learning Java if I would ever want to code professionally (more in a scientific/engineering environment)? I know some C++, C, Matlab, Python and Fortran (and they're nice languages imho, although I don't like Matlab and Fortran that much) but Java seems like such a bitch, but it dominates every single goddamn course at my university. What do? On a side note, would you prefer knowing a single versatile language really well or rather be okay'ish at several languages? How long do you have to spend to know a language to a decent level? It seems to me that once you have some programming experience, getting started and doing actual useful stuff in any language doesn't take that long. Can you just show up at a company with notions of language X but tell them that you can get up to speed in a couple months? Of course you have to nuance this, knowing some C and then saying that you're able to do heavy OOP in C++ in a couple of months is stretching it... Also, how do you learn collaboration/big projects? Do they train this in CS courses? I can't fathom how you can work on a thing with 100s of other programmers on a project with thousands of lines of code. I'm asking this because although I study physics, I like programming a lot and making a living with it seems like a viable choice. But I don't know how IT companies see physicists, it's a different degree after all...[/QUOTE] Java is kinda like a mix of Lua/Python and C++. The syntax is super clean, but it also has some nice stl stuff like bitmaps and fonts. You're completely right though, once you get the idea of variables/functions down it's a fuckton easier to learn new languages. I don't think it'd hurt to dabble in Java a bit, especially considering how popular it's getting lately. If you're interested in game-dev specific stuff, [URL="http://www.youtube.com/playlist?list=PLEETnX-uPtBXP_B2yupUKlflXBznWIlL5"]TheBennyBox [/URL]has some awesome tutorials for 3d rendering in Java, and there are bindings of stuff like assimp, opengl, and bulletphysics. It's kinda nice because you can test ideas without having to worry about as much back-end work.
Sorry, you need to Log In to post a reply to this thread.