<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for James Edgeworth</title>
	<atom:link href="http://jamesedgeworth.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamesedgeworth.com</link>
	<description>Development notes.</description>
	<lastBuildDate>Mon, 05 Apr 2010 14:54:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>Comment on One more step along the road I go by James</title>
		<link>http://jamesedgeworth.com/2010/04/one-more-step-along-the-road-i-go/#comment-31</link>
		<dc:creator>James</dc:creator>
		<pubDate>Mon, 05 Apr 2010 14:54:04 +0000</pubDate>
		<guid isPermaLink="false">http://james.black0ps.com/?p=100#comment-31</guid>
		<description>Regarding the game - yes, there is not real state keeping. The script would get called, would do exactly what it is scripted to do, then when it&#039;s done, it&#039;s done. It won&#039;t, by, default, keep anything in memory like you would have for a Flash application, or a desktop application, Which is where MySQL comes in.

The first thing you need to do is load all the required data, process it, then dump it back. This approach lets the script handle the data for the game without flooding the class with smaller queries to get small amounts of data, to load, then another query to save that small amount. Effectively there was no stage in the game where the class would only need a small amount of the entire data, so one big load, and one big save at the end handled the data in one big go. Note that it is still a very heavy number of queries, considering that potentially 9 players are hitting the server every 2 seconds (and not exactly in time either - it depends when they first enter the game&#039;s page). With that said, don&#039;t worry about the number of queries, but as a rule, you really should try to keep it sensible - e.g, don&#039;t select from one table, then use an ID from that select to select from another table - obviously here, select from them both in one query. The server is not going to overload and blow up because it ran 1000 queries per minute. The biggest worry, as far as I can see, is that it is doing a lot of I/O operations on the hard disk.

If you wanted to go a step further, you could:

- See if the game is running, if so, copy the data to a MySQL memory table (stored in RAM)
- Use that table until there are no players left in that particular game instance
- Sit there happy that the hard drive should last another few years :).


If you are using PHP because you don&#039;t know other languages, then I really do recommend you try other languages. It sounds like you are trying to jump into the deep end, as you would be trying to do something with PHP which would be easier in other means. With that said, I am not a &quot;master&quot; - unless 90% of the people I speak to say I am, and with good reason, I won&#039;t believe it.</description>
		<content:encoded><![CDATA[<p>Regarding the game &#8211; yes, there is not real state keeping. The script would get called, would do exactly what it is scripted to do, then when it&#8217;s done, it&#8217;s done. It won&#8217;t, by, default, keep anything in memory like you would have for a Flash application, or a desktop application, Which is where MySQL comes in.</p>
<p>The first thing you need to do is load all the required data, process it, then dump it back. This approach lets the script handle the data for the game without flooding the class with smaller queries to get small amounts of data, to load, then another query to save that small amount. Effectively there was no stage in the game where the class would only need a small amount of the entire data, so one big load, and one big save at the end handled the data in one big go. Note that it is still a very heavy number of queries, considering that potentially 9 players are hitting the server every 2 seconds (and not exactly in time either &#8211; it depends when they first enter the game&#8217;s page). With that said, don&#8217;t worry about the number of queries, but as a rule, you really should try to keep it sensible &#8211; e.g, don&#8217;t select from one table, then use an ID from that select to select from another table &#8211; obviously here, select from them both in one query. The server is not going to overload and blow up because it ran 1000 queries per minute. The biggest worry, as far as I can see, is that it is doing a lot of I/O operations on the hard disk.</p>
<p>If you wanted to go a step further, you could:</p>
<p>- See if the game is running, if so, copy the data to a MySQL memory table (stored in RAM)<br />
- Use that table until there are no players left in that particular game instance<br />
- Sit there happy that the hard drive should last another few years <img src='http://jamesedgeworth.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>If you are using PHP because you don&#8217;t know other languages, then I really do recommend you try other languages. It sounds like you are trying to jump into the deep end, as you would be trying to do something with PHP which would be easier in other means. With that said, I am not a &#8220;master&#8221; &#8211; unless 90% of the people I speak to say I am, and with good reason, I won&#8217;t believe it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on One more step along the road I go by Michael</title>
		<link>http://jamesedgeworth.com/2010/04/one-more-step-along-the-road-i-go/#comment-30</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 05 Apr 2010 13:19:11 +0000</pubDate>
		<guid isPermaLink="false">http://james.black0ps.com/?p=100#comment-30</guid>
		<description>Thanks for continuing with your blog! I liked the post about the PHP Security, although its not the answer to all problems - helpful though.

Can you go into more detail about the poker game? I cant imagine how it keeps a continuous state throughout the game, as when a page has been ran, the data is &#039;lost&#039;? Im not a PHP master, but Id like to create a game out of PHP as its the only language I can use for now :).</description>
		<content:encoded><![CDATA[<p>Thanks for continuing with your blog! I liked the post about the PHP Security, although its not the answer to all problems &#8211; helpful though.</p>
<p>Can you go into more detail about the poker game? I cant imagine how it keeps a continuous state throughout the game, as when a page has been ran, the data is &#8216;lost&#8217;? Im not a PHP master, but Id like to create a game out of PHP as its the only language I can use for now <img src='http://jamesedgeworth.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
</channel>
</rss>

