Jump to content
MakeWebGames

CtrlFreq

Members
  • Posts

    58
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

CtrlFreq's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. If you don't anticipate the answers to the questions to change, there's no reason to store them in a database - files will offer a drastic performance improvement. Caching can be fairly simple to implement if you're enforcing code and data separation within your files already. You just need to write the results of your heavier database queries off to the included file as often as needed to account for changes.
  2. When you retrieve data from a database, the application opens a socket, the service makes I/O calls to proprietary monolithic files, and returns the data to the interpreter extensions which places it into arrays for your application to consume. Directly including files, well, includes a file that's stored on the disk, or if you're really into optimizing your environment, in memory with a ram disk. Files can be thousands or even millions of times faster as there are fewer processes and redundant copies of data, and because inclusion is less taxing on the interpreter - but it comes with the trade-off that you have to plan how and where you'll store and refresh your data while ensuring the cache files are never absent when a user needs them. I hit a wall with mysql years ago because data wait times were impacting performance - even with caching, optimized indexes, and denormalizing. I implemented file caching for repetitive read-only queries using a cli script that runs in a loop, removing better than 99% of the query execution time from each player's execution cycle, which made the game far more responsive even under the heaviest load. A few hints from experience: - files are not for everything, use the database to store, update, and pull real-time values for player actions - store the data everyone uses in the files, and in a useful format (objects and arrays, not just copies of tables) - serialize and encode the data to preserve structures and avoid issues with inclusion (decode and unserialize to rehydrate) - separate your cache files based on how often they're updated (no reason to refresh resource values every few seconds when they're updated once a month) - where possible, update the cache files using a background process to validate changes and ensure proper formatting
  3. Here are the issues that would keep this from working, or at least working as you'd expect it to: 1) Your form doesn't actually send anything useful to the server. Remove the three inputs in the final cell and replace with the following: <button type='submit' name='Delete' value='$select->id'>Delete</button> 2) There's no need for the $x variable - get rid of any references to it. 3) Move the check for deleting records before both the check for Session::exists('home') and the inclusion of the header. You want to finish any database interactions before writing anything to the client. 4) Use the value sent in $_POST['Delete'] to remove the record id you sent, and then immediately reload the page to prevent duplicate posts on refresh. $delete->delete('users', 'id='.mysql_real_escape_string($_POST['Delete'])); header('location: this_page.php');
  4. A couple notes a) In order to serve the widest audience on the most devices possible, begin with the static and mobile implementations and add the fancy bits for more advanced users. A degraded rich experience will always feel like a degraded experience. b) DRY your code out - if you notice you've repeated something several times, encapsulate it. For instance, in the JS, I see 20 or better lines like this: $('.jc_daemon_box_content').css("color","red").text("Username is too long! Max 15chars"); $('.jc_daemon_popup').fadeIn(400); could far better be served with a small function such as: function displayError(text) { $('.jc_daemon_box_content').css("color","red").text(text); $('.jc_daemon_popup').fadeIn(400); } displayError("Username is too long!"); c) Get rid of single use variables - if you're only using a variable twice in a scope, and the first time is to instantiate it, you'd probably be better off just using the function call. The following are identical in operation, but the latter doesn't waste memory or code copying values into single-use placeholders: var username = $('#rname').val(); $.ajax({ url: 'register_check.ajax.php', type: 'POST', data: 'rname='+escape(username), success: function(z){ if(z=="true"){ } ... }); $.ajax({ url: 'register_check.ajax.php', type: 'POST', data: 'rname='+escape($('#rname').val()), success: function(z){ if(z=="true"){ } ... });   d) Make use of the ajax channel to drive those messages - you have a long list of conditions in place in order to interpret the integers and convert them into error messages, where you could simply be passing the message back from the server and doing something like this (in combination with #2): function displayMessage(text, color) { $('.jc_daemon_box_content').css("color",color).text(text); $('.jc_daemon_popup').fadeIn(400); } $.ajax({ url: 'register_check.ajax.php', type: 'POST', data: 'rname='+escape($('#rname').val()), success: function(z){ if(z=="true"){ displayMessage("Registered!", "green"); } else { displayMessage(z, "red"); });
  5. Another item of interest on the subject of ASP.NET would be the new-ish MVC framework which is distributed with .NET 3.x and 4.x. While you lose the ease of drag-and-drop development and the event driven nature of the Web Forms framework, it more than makes up for it with automated tests and clean code separation.
  6. My only criticism of your overview is that it many of these items are not a comparison of C# to PHP, but rather the Web Forms framework to PHP. While WF does automate quite a bit of code generation, it often comes at a price in terms of speed, cleanliness, and request / response sizes (due to view and control states which can become quite large). .NET's modular composition allows almost of all that to be remedied by overriding base system objects, so it's not necessarily a deficiency - and if it were, it would be with WF and not C# itself.
  7. Re: How does Floydian do it?   Wrong again, which makes it obvious you've never actually used it for anything (at least anything beyond amateur dinking anyway). Visual basic is a separate language from basic, and they look very little alike. Microsoft held on to a few basic constructs, sure, but mainly they were cashing in on the widespread popularity of BASIC at the time they were releasing VB.   It doesn't matter what the difference between the three are. Your original statement - that javascript is not a language - is patently false, and you're just backpeddling now.   First, I've never said VB isn't compiled - in fact I went as far as explaining that it can be compiled to either byte code, or with the interpreter embedded so as not to require the ubiquitous vbrun dll files that plagued our lives in the 90's. I will however point out just how wrong your claim is about vb running a program as a script though - it's always compiled, even when debugging. Again, you might know this had you every used it.
  8. Re: How does Floydian do it?   None of which matters, since the original argument was that javascript was not, in fact, a language at all... the rest is just back-peddling. Languages are simply sets of syntax that are used to describe processes in a human readable manner - whether they're interpreted (scripts), run under the context of a VM (ie. byte code like VB, Java, or .NET), or run in a native context (compiled code) doesn't matter - they're all programming languages.   VB is a programming language because it compiles to byte code, which while not native (requiring a vm of some sort), is not human readable and is optimized for the running platform. This is not to be confused with VB Script, which is a VB-like scripting language. The real confusion comes in when the vbrun library itself is embedded in the executable, however it's still byte code even if the interpreter is stored in the exe.   It's still a scripting language - like VB, it can just be archived together with it's interpreter to make it seem self-executing.
  9. Re: How does Floydian do it?   Ok, explain to us how a "scripting language" is not itself a "language"? Since when does the modifying adjective fundamentally change the meaning of the noun it precedes?
  10. Re: How does Floydian do it?   It's usually advisable you at least try to be correct when berating someone. JavaScript is a language - individual units comprised in said language are scripts because they require an interpreter to parse and run them (being stored in a human-readable form instead of compiled machine code).
  11. Re: pacBL - A proxy and cheater black list   Good question - I think AOL and BT both would be a good example of special use proxies that would require a special return code, allowing the game owner to allow those specific address ranges through; for example, a return code of 127.0.10.x could signify a "trusted" proxy, whereas 127.0.9.x could signify the anonymous variety - then game owners could just explode the return value, and allow anything with a third octet of 10, while rejecting those with 9s.
  12. Re: Algorithm of all mafia games   I think it was fairly obvious that I had read your post, and was criticizing you because of it.
  13. A few weeks back, there was a thread here about creating a list that could be used by game owners to identify and reduce the impact of problem users. After discussing this idea with a number of people, I came to the conclusion that this idea was worth at least assembling a proof of concept. The idea is simple - when players register or log-in to your game (or practically any time you like), you run a quick check against their IP address which, if found, will tell you two things: if they're listed as an offender, and what they're being listed for. With these these pieces of information, we as game owners can then decide if the player should be allowed to enter the game, or be sent away. What I'm putting up today is that proof of concept, because I'd like to begin gathering feedback on the various details such an open system requires (types of violations, severity thresholds and weighting, entry life-cycle) to be widely consumed, as well as getting at least a few engine and mod authors busy testing this out for future inclusion or sale respectively. Including it in your app is easy, and since it's based on DNS, it requires no complex remote server calls or bloated libraries, and is fast and efficient. For those wanting to see a basic implementation, it looks somewhat like this:   function ListedInPAC( $ipaddress ) { if (intval(gethostbyname(implode('.', array_reverse(explode('.', $ipaddress))) . '.list.pacbl.com')) == '127') return true; return false; }   Beyond a simple check to see if the host is listed, the return value can be evaluated, allowing you more granular control over who you allow and who you deny. I've put off documenting that quite yet, pending feedback from the community - I feel this to be a more reasonable approach than simply putting out there what I think it should be, and then making everyone change later. As for the question that will ultimately emerge as the elephant in the room - it's free, and will remain so. DNS isn't friendly to profiteers, but it is also extremely efficient, so I have no issues with keeping this online, and acting like a philanthropist for doing so. I apologize for the utilitarian nature of the initial site - it's a work in progress, and to date, I've spent more time worrying about security and functionality than of ease of use - while I won't promise to lay off the security, I'll be working diligently on making it prettier and easier to use. Comments, critiques, and questions are welcome. Feel free to contact me either here or in PM. For those still reading and/or who have just scrolled down and are interested in jumping right in, the url is http://www.pacbl.com/.
  14. Re: Algorithm of all mafia games   Did you really just google the word "algorithm"? He was asking for specific algorithms, not random examples :roll:
  15. Re: [mccodes] 5 Card Draw [10$]   Does the act of blindfolding normally inhibit the ability to spell?
×
×
  • Create New...