landlocked

Members
  • Content count

    188
  • Joined

  • Last visited

Community Reputation

103 Neutral

About landlocked

  • Rank
    Member
  1. [quote name='Washu' timestamp='1310500516' post='4834472'] Frankly, landlocked, I'm not a fan of your attitude. You appear to be rather confrontational. If you have an argument to be made about a particular topic then you should elucidate your thoughts and reasons, generally backed up with references. Furthermore, this is the .Net forum, not the For Beginners forum. Therefore going in depth into the functionality and behavior of various components of the .Net such as the CLR or CLI is hardly "too deep". [/quote] I don't really care what you think of my attitude. About getting "too deep" you should be pushing simple succinct solutions that meet the need rather than trying to be "spiffy" or clever. I write my posts here knowing that someone, anyone, might come along and take what I say and run with it. So, when someone proposes solutions I know to be overly engineered for the problem that was described I will directly counter it and say so.
  2. [quote name='SiCrane' timestamp='1310498660' post='4834457'] The CLR can modify strings if it likes. The prime example is the StringBuilder class implementation from .NET 2.0 to, I believe, 3.5. Internally, that implementation used a string object that got modified. (This got changed - .NET 4.0's StringBuilder uses a char array internally.) If you don't believe me, grab a copy of Reflector and point it at the .NET 2.0 StringBuilder implementation. [/quote] This makes me dubious but I'll check it out. It is my understanding StringBuilder took individual strings and just stored them in an array and then ToString simply did one big concatenation instead of doing it incrementally as you added elements (which is why that class exists in the first place). From day one though everything I've read about .NET has touted the immutability of strings so I can't just take your word at this.
  3. [quote name='SiCrane' timestamp='1310494742' post='4834424'] You see, when you say the post is too deep, and your very next sentence starts with immutability and says nothing about char arrays or StringBuilder (or for that matter, the entire [i]post[/i] says nothing about them), the connotation is that you think that understanding strings are immutable is too deep. Secondly, [b]immutability is not handled in the background[/b]. Immutability is a core principle of the interface of the string class. If anything it's the opposite way around, strings are actually mutable in the background, but you never need to worry about it because the CLR itself is the only thing allowed to muck with them. If you want to say that char arrays and StringBuilder aren't necessary for performance then say that. Also, if those were the only options I mentioned then maybe then you could say that I was "advocating" them, but I also mentioned another option and noted that those weren't the only options. [/quote] No. Strings are immutable. The CLR handles the string creation process, tracking memory allocation and references and collection when all references fall out of scope. "This is a string" is a string that will be entered into the CLRs string tables. Any "change" to that creates a new string. Let's say you want to "add" a period. "This is a new string." is now a fresh new string in the CLRs string tables along side the string "This is a string". As soon as all references to the first string are out of scope the CLR wipes out the string slot and waits for something else to store there. In the following scenario there are 3 strings created and stored in the CLR: [code] string s = "This is a string."; s = s.Remove(s.Length - 1); s = s.Insert(s.Length, ' '); //insert space [/code] However, even though three strings are created the CLR sees that after the first string is modified to remove the last character there are no more references to the string "This is a string." and wipes it out. The same is true for the .Insert line. The CLR creates the new string "This is a string " and wipes out the string "This is a new string" as there are no more references to it. The CLR never manipulates the strings themselves. In this way all strings are immutable and not even the CLR itself modifies strings. You are wrong. CLR handles immutability in that it tracks the references of string locations and as soon as there are no more references to a string it gets wiped out. Doing this you never have to worry yourself with strings themselves and can focus entirely on doing what you need to do.
  4. Problem dealing with float numbers

    Yarr decimal data type
  5. The too deep part was advising the OP to use a char[] or a StringBuilder object when it's just as performant for all intents and purposes say s = s.Replace(args). You were advocating more complexity than is necessary.
  6. [quote name='SiCrane' timestamp='1310491785' post='4834397'] [quote name='landlocked' timestamp='1310480416' post='4834306'] Strings are immutable but the CLR takes care of all that stuff in the background. [/quote] OK, then show me how to modify a string without creating a new one. [/quote] I didn't say you could. I said the CLR takes care of it for you and unless you're storing entire tomes in a single string object that you really won't notice a performance hit doing a few concatenations. You even quoted me saying such. STFU.
  7. HTML5 or Java?

    I haven't played this and can't right now as I'm at work but the screenshot provided alludes to this one have some nifty effects: Missile Fleet http://glimr.rubyforge.org/cake/missile_fleet.html For 3D: http://www.benjoffe.com/code/games/torus/ Several others: [url="http://www.casualgirlgamer.com/articles/entry/28/The-Best-30-HTML-5-games/"]http://www.casualgirlgamer.com/articles/entry/28/The-Best-30-HTML-5-games/[/url]
  8. HTML5 or Java?

    [quote name='mrbastard' timestamp='1310484549' post='4834344'] [font="arial, verdana, tahoma, sans-serif"][size="2"](Speaking as someone who wrote a browser plugin for a shipping game, but who is by no means an expert) Plug-ins are native code and can have their own threads, meaning they only have to care about how 'fast the browser allows' when they synchronise with the browser e.g. drawing or for any javascript API they expose. Sure, you're at the mercy of the plug-in developer. But they probably know what they're doing a hell of a lot better than you do. More importantly, they know more about their own (and your) context than the browser, and they have the language features available to them to do something with that knowledge. [/size][/font] Sure, if you write for a badly written plugin (ahem) you may be artificially limiting yourself. But think for a moment about the vast resources Adobe and Macromedia before them have ploughed into this problem area. Adobe employs some of the best programmers around, with a specialisation in multi-media. I'd love HTML5 and WebGL to take over, and they may do given time. But not yet. [/quote] My performance comment centers more-so around simplicity for the end-user and if I didn't word it correctly to communicate such I do apologize. You're right the plug-ins can take full advantage of native code. However, each successive update claims faster and faster gains. This is typically true for each successive browser release however you'll get a better experience overall if all they have to be concerned about is the browser instead of their browser and all the plug-ins they need to keep updated as well and can ensure a better experience if you stick to a standard specification that is more likely to be supported automatically by browsers released after the specification is published rather than an ever evolving set of features, some good some not so good, and making a crap shoot if your users have the plug-in required by your game and requiring your users to install said plug-in. Given the fact that HTML 5 is supported by the latest version of every major browser I see no reason why new projects [i]should[/i] be written in anything else, assuming all other things are equal. A browser that doesn't have to handle plug-ins is typically a more performant one as well which has direct gains that can be used by native HTML 5 apps. Also, I find Flash to be terrible with performance as it was never meant to be a game platform. All it was meant to do was handle small animations. I find the performance of most flash games appalling but havent' seen an HTML 5 game choke in my browser yet.
  9. [quote name='TheOrzo' timestamp='1310481929' post='4834320'] Also, mentioning usage of StringBuilder is entirely appropriate considering the example given had a string named '[size="2"][color="#1c2837"]sOldMassiveOutput'. You don't need a thousand page book for performance to degrade quickly when performing many operations on a large string, such as building a couple large strings every frame of a game by concatenating a string by 1 character over and over. [/color][/size] [/quote] I did a test one time with StringBuilder, string.Concat and + sign concatenation in loops with a million iterations. While StringBuilder was slightly faster (by mere MS) at the end of the day it really doesn't matter. This is one place where micro-optimization is fail and people worry about it too much. Also, if you keep building the same large string over and over you are doing it wrong. DRY (don't repeat yourself) applies here perfectly. While traditionally when people talk about DRY they are speaking in reference to code but it applies to data as well. If you are constantly generating the same string over and over then you should just store the entire string somewhere and check for the proper conditions with which it should appear. If it's a template string ("You inflicted x damage to y creature.") then use the .NET formatting characters and store the template string instead ("You inflixed {0} damage to {1}") and consume said template using string.Format.
  10. HTML5 or Java?

    [quote name='Antheus' timestamp='1310482592' post='4834328'] This is so completely wrong, I don't know where to start. [/quote] Pick one and tell me how I'm wrong.
  11. HTML5 or Java?

    Go HTML 5, honestly. It's a native framework to the browser and your users won't be bound to proprietary plug-ins. Also, your markup will run about as fast as the browser allows rather than the efficiency of the plug-in developers. With a few AJAX calls to get the objects you need to draw I honestly can't see any cleaner and simpler way to get a game like environment in the browser. Your overhead will increase with the other plug-in languages as well. Basically, for the time it takes to get something on screen, HTML 5 is the best way to go. Only thing flash and Java improve upon is that it's plug-ins are supported on older browsers.
  12. [quote name='SiCrane' timestamp='1310412977' post='4833933'] In .NET strings are [url="http://msdn.microsoft.com/en-us/library/s1wwdcbf.aspx#Immutability"]immutable[/url]. You need to create a new string with the contents that you want. This can be done with dumping the string in a char array and modifying that, using a StringBuilder, using sub string and concatenation operations, etc. [/quote] Dude, way too deep here. Strings are immutable but the CLR takes care of all that stuff in the background. Unless you've got a thousand page book stored in a string and are duplicating said string several times you won't really notice anything performance wise. Moe is right about Trim taking off the trailing space. Remove the call to Trim() and use Remove and Insert to modify the string. These will return strings so you will have to capture the result. Simply calling s.Remove(...) won't really do anything. You'll need s = s.Remove(...) followed by s = s.Insert(...). Or in your case s would be oldmassiveoutput.
  13. Cost of Hosting a Simple Web Game?

    The system requirement of the physical box are easy enough to figure out. What will kill you is bandwidth. Even if you optimize every bit sent back and forth from client to server, if you have a "small" user base playing regularly of, say, 5,000 people, your monthly transfer amount is going to be huge unless it's a text only game. [quote name='Legendre' timestamp='1310464095' post='4834204'] Thanks! Very helpful starting point! I have a question: This page says "unlimited bandwidth" - [url="http://www.dreamhost.com/hosting.html"]http://www.dreamhost.com/hosting.html[/url] I don't suppose they will really allow unlimited bandwidth? I know about web hosting but are the usual web hosting packages suitable for web games? I keep hearing people talk about how expensive bandwidth is...but most web hosting packages comes with unlimited bandwidth? [/quote] Any host offering you unlimited anything is lying to you. If a host can't give you hard limits then don't deal with them because everyone has limits and as soon as the host gets hit with huge transfer bills I can guarantee they'll try to come after you or they'll just disconnect your service.
  14. What do you think about the Revelation?

    [quote name='Binomine' timestamp='1310468564' post='4834232'] Everytime I think about Christians and their end times, I think of pseudo-Wiccans and their burning thymes, and I just can't take it seriously. Why are we always on the cusp of the end times? Why can't we kick it down the road a few thousand years? Why can't Satan just go to a bookstore and read how he's going to fail and change his plan? It's not like it's hard to find the Bible, they give it out on street corners and Satan seems to have enough freewill to rebel, why not to read? [/quote] Why are we always on the cusp of the end times? The Bible contains several passages about Christs return. 1) The last days will be as the days of Noah (lawless). As society progressively seeks to expand its civil liberties there is an every increasing perception that it [i]has[/i] to be right around the corner. 2) The Bible tells us that Christ will return like a thief in the night meaning he will show up when we least expect it. So maybe we think we can prevent his return or even "catch" him if we're always ready?? I don't understand why people stay hyped up over this one reasoning. 3) There is a passage saying his return will be as two men walking in a field when suddenly one of them is missing and only one remains behind. This gives the perception that it could happen at literally any minute. 4) There is another passage that describes how only those who "keep their oil filled" will be allowed in upon his return so this means we have to always be ready for this return. Why can't we kick it down the road a few thousand years? The Bible says no man knows the day nor the hour of Christs return not even Christ himself but only the Father knows. Also the Bible tells us to tarry till he returns meaning just to carry on as usual but to remain ready should it happen. People who get so absorbed in the fact Christ could return any second are actually not doing what the Bible says and may very well be acting out of fear, which the Bible describes to be the first class of people thrown into the lake of fire at the last judgement (the fearful). Why can't Satan just go to a bookstore and read how he's going to fail and change his plan? There is a passage in Revelation that Satan knows he only has a short time on Earth and therefore justifies him trying to do as much damage as possible. Satan knows he can't assume the throne of God. His ONLY goal is to prevent people from knowing God as father and thus being unable to accept salvation. So he's just trying to drag as many people down with him as possible before his ship sinks.
  15. Which should I...?

    C# or Java, if you're the bastard demon spawn of Satan I kid I kid haha