• What are you working on? V10
    2,002 replies, posted
[QUOTE=shill le 2nd;22035788]Well, I'm not sure how he's doing it, but if you use [url]http://whatismyip.org/[/url] you don't even have to parse it; it just gives you the IP in text format[/QUOTE] Yeah that's exactly what I'm doing.
[QUOTE=Disfunction;22036073]Programmer art ahead... [IMG_thumb]http://i49.tinypic.com/13zyf5x.png[/IMG_thumb] [IMG_thumb]http://i46.tinypic.com/2zfpbar.png[/IMG_thumb] A deferred renderer I've been working on. 20 completely dynamic lights at the moment but theres no hard-coded limit. I'll be working on adding normal mapping and shadows next.[/QUOTE] incredible first post
My programmer art is a cube or multiple if neccesary.
[QUOTE=CPPNOOB;22036676]My programmer art is a cube or multiple if neccesary.[/QUOTE] Mines just a bunch of tiny blended cubes with different colors :\
[QUOTE=Ortzinator;22035322]Anyone know how to do enums in Lua?[/QUOTE] As strings are interned, the common solution is to use strings instead. String equality in Lua is as fast as comparing numbers. But you can emulate enums doing something like this, if you really want to: [lua] Numbers = { Zero = 0, One = 1, Two = 2 --etc } [/lua]
[QUOTE=Ortzinator;22035322]Anyone know how to do enums in Lua?[/QUOTE] Read post above.
[img]http://filebox.me/files/a7ibqti8e_albino.png[/img] Not much to show, but we have been implementing bullet physics and I've been binding all our shit to Lua. The scene is completely created and ran in Lua. [QUOTE=jA_cOp;22038476]As strings are interned, the common solution is to use strings instead. String equality in Lua is as fast as comparing numbers.[/QUOTE] Interned? what does that mean?
[QUOTE=r4nk_;22038504] Interned? what does that mean?[/QUOTE] Two equal strings are always stored at the same memory location, saving memory and speeding up equality comparison. A string in Lua is the same as a symbol in Ruby (if you know their semantics). I think .NET strings are also interned.
[QUOTE=jA_cOp;22038540]I think .NET strings are also interned.[/QUOTE] What I think you mean is that strings in .NET (not sure about Lua) are immutable classes (classes are reference types) That means when you type: [cpp] var foo = "hey"; var bar = "hey"; Console.WriteLine(foo == bar); [/cpp] All it has to do is compare memory addresses.
[QUOTE=turb_;22038648]What I think you mean is that strings in .NET (not sure about Lua) are immutable classes (classes are reference types) That means when you type: [cpp] var foo = "hey"; var bar = "hey"; Console.WriteLine(foo == bar); [/cpp] All it has to do is compare memory addresses.[/QUOTE] Yeah, that means they are interned. Immutable just means they're not mutable, it says nothing about pooling in itself. But yes, .NET strings are interned.
[QUOTE=turb_;22038648]All it has to do is compare memory addresses.[/QUOTE] I don't understand this. Wouldn't both vars be different memory addresses?
[QUOTE=CPPNOOB;22038764]I don't understand this. Wouldn't both vars be different memory addresses?[/QUOTE] I think what is being said is because both strings are exactly the same they have the same memory address. This way, you can have the identical string used any number of times without a noticeable increase in memory usage, and you can check for equality simply by seeing if the variables both point to the same memory address.
[QUOTE=CPPNOOB;22038764]I don't understand this. Wouldn't both vars be different memory addresses?[/QUOTE] Instantiated classes in C# are basically pointers to the object. So by memory address, I meant the value of the 'pointer'.
[QUOTE=turb_;22039146]Instantiated classes in C# are basically pointers to the object. So by memory address, I meant the value of the 'pointer'.[/QUOTE] Yeah I don't think you understand string interning at all really. [url]http://msdn.microsoft.com/en-us/library/system.string.intern.aspx[/url] for the basics.
[QUOTE=blankthemuffin;22039330]Yeah I don't think you understand string interning at all really. [url]http://msdn.microsoft.com/en-us/library/system.string.intern.aspx[/url] for the basics.[/QUOTE] I do understand, I just failed getting the idea from my head to the text box [editline]08:04PM[/editline] Ok fuck it, I was getting the wrong idea. What I thought ja cop meant was the string literals and all strings are immutable. This is fine in C#: [cpp] while(true) { string str = "test"; } [/cpp] While the same in Ruby will incur a significant performance penalty because strings are mutable meaning a new string object must be created each iteration. I just thought interning was a fancy way of saying that. My mistake.
[QUOTE=turb_;22039358] While the same in Ruby will incur a significant performance penalty because strings are mutable meaning a new string object must be created each iteration.[/QUOTE] You'd use a Ruby symbol in this kind of situation, though. I don't like the inconsistent nature of this in Ruby, but it is necessary for how strings work in Ruby right now. Personally I'd rather have Ruby strings immutable, interned and with copy-on-write semantics just to keep it simpler for beginners.
Um, I'm pretty sure str1 == str2 in C# does a lot more than check memory addresses.
[QUOTE=nullsquared;22039523]Um, I'm pretty sure str1 == str2 in C# does a lot more than check memory addresses.[/QUOTE] It's an overloaded function which checks the address of the interned string against that of the other. edit: blank's explanation is actually more accurate.
[QUOTE=nullsquared;22039523]Um, I'm pretty sure str1 == str2 in C# does a lot more than check memory addresses.[/QUOTE] Of course it does a lot more than check memory addresses, but I'd assume they'd first check if the objects were the same instance before running an expensive string comparison. Would I be right, or no?
[QUOTE=nullsquared;22039523]Um, I'm pretty sure str1 == str2 in C# does a lot more than check memory addresses.[/QUOTE] It compares references to the intern pool. Provided the String.IsInterned method returns true.
[QUOTE=blankthemuffin;22039585]It compares references to the intern pool. Provided the String.IsInterned method returns true.[/QUOTE] Right, but surely, not every string is interned? I would think that interning every used string in the program would be slower than just evaluating the usual comparison when needed.
What if I read a string from the users input? Will it actually check each string in memory so that it can set that string-variable to that memory?
Well I was reading some java documentation before because I was interested in whether or not java had interned strings. I THINK in Java, only string literals are automatically interned, and any other ones you have to call intern on. I wouldn't be suprised if it was the same way in C#.
[QUOTE=nullsquared;22039629]Right, but surely, not every string is interned? I would think that interning every used string in the program would be slower than just evaluating the usual comparison when needed.[/QUOTE] Interning a string isn't really slow, a string pool is basically just a hash table. And it does indeed intern every string unless your assembly specifically says not to. [QUOTE=ZeekyHBomb;22039631]What if I read a string from the users input? Will it actually check each string in memory so that it can set that string-variable to that memory?[/QUOTE] Interning a string is almost O(1) because of the hash map. Long strings naturally take slightly longer to hash, but it's a negligible difference. From the MSDN: "The common language runtime conserves string storage by maintaining a table, called the intern pool, that contains a single reference to each unique literal string declared or created programmatically in your program. Consequently, an instance of a literal string with a particular value only exists once in the system." (Only applies when interning is enabled, which it is by default)
I'm currently working on my tile system/engine thing for löve. [img]http://www.abload.de/img/fin2egol.png[/img] Works fine, but i want Super Mario like physics, so that the collisions only work from above and you can jump through it from below. Not that sure how to do that >:
[cpp] if( other.velocity.y <= 0 ) //do collide [/cpp]
Nothing crazy yet, got everything working and running together. No data synchronization issues. :haw: [img]http://filesmelt.com/dl/zephyr_engine.png[/img] Have physics working, I need to get collisions tonight so that I can have blocks you can be on. :P
[QUOTE=Disfunction;22036073]Programmer art ahead... [IMG]http://i49.tinypic.com/13zyf5x.png[/IMG] [IMG]http://i46.tinypic.com/2zfpbar.png[/IMG] A deferred renderer I've been working on. 20 completely dynamic lights at the moment but theres no hard-coded limit. I'll be working on adding normal mapping and shadows next.[/QUOTE] Correct me if I'm wrong, but that scene is from some SSAO tutorial. [url]http://xnacommunity.codeplex.com/wikipage?title=SSAO&referringTitle=Home&ProjectName=xnacommunity[/url] So what you did, you just changed the shader?
That's not the same scene model.. And even if it was it wouldn't mean anything, he could just be using that as a test model for rendering. Also that tutorial is about SSAO not individual dynamic lights in a deferred renderer.
But all the really cool kids are rabid about picking people up on using a tutorial :(
Sorry, you need to Log In to post a reply to this thread.