<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>News zur Spieleentwicklung &#187; Datenbankstruktur</title>
	<atom:link href="http://www.gamux.net/tag/datenbankstruktur/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gamux.net</link>
	<description>Alles rund um die (Browser-)Game Entwicklung</description>
	<lastBuildDate>Thu, 25 Jun 2009 14:41:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mitglieder Datenbankstruktur in einem Browsergame</title>
		<link>http://www.gamux.net/browsergame-tutorials/mitglieder-datenbankstruktur/</link>
		<comments>http://www.gamux.net/browsergame-tutorials/mitglieder-datenbankstruktur/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 14:49:13 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Browsergame-Tutorials]]></category>
		<category><![CDATA[Datenbankstruktur]]></category>
		<category><![CDATA[Mitglieder]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.gamux.net/?p=21</guid>
		<description><![CDATA[Jeder weiß, dass Browsergames sehr schnell wachsen können, wenn man nur die richtige Idee hat. Aus diesem Grund ist es wichtig, dass man gleich am Anfang sehr auf seine Datenbankstruktur achtet. Ist diese einmal am Anfang verpatzt ist es nur schwer möglich den Fehler wieder zu beheben. Hier ist einmal ein kleines Beispiel dafür[...]]]></description>
			<content:encoded><![CDATA[<p>Jeder weiß, dass Browsergames sehr schnell wachsen können, wenn man nur die richtige Idee hat. Aus diesem Grund ist es wichtig, dass man gleich am Anfang sehr auf seine Datenbankstruktur achtet. Ist diese einmal am Anfang verpatzt ist es nur schwer möglich den Fehler wieder zu beheben. Hier ist einmal ein kleines Beispiel dafür:<span id="more-21"></span></p>
<blockquote><p>1000 Spieler * 5 kB = 5000 kB(~5 MB)<br />
100000 Spieler * 5 kB = 500000 kB(~500 MB)</p></blockquote>
<blockquote><p>1000 Spieler * 20 kB = 20000 kB(~20 MB)<br />
100000 Spieler * 20 kB = 200000 kB(~2000 MB)</p></blockquote>
<p>Und genau um diese, am Anfach schwer erkennbaren, Unterschiede geht es in diesem Tutorial. Gleich am Anfang sollte man daher die eigentliche Tabelle, diesem Fall bg_user, möglichst klein halten, da auf sie sehr oft zugegriffen wird.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> bg_user <span style="color: #66cc66;">&#40;</span>
id int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
username varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
password varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Weitere Mitgliederangaben, welche nicht so oft Aufgerufen werden(E-Mail Adresse, Webseite, Signatur, usw..) kommen in eine externe Tabelle.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> bg_user_ext <span style="color: #66cc66;">&#40;</span>
user_id int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
email varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
homepage varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
signatur smalltext
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Als letztes Stelle ich euch noch eine kleine Datenbank zum Handeling von Einheiten vor. Diese kann man gut wie folgt aufbauen.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> bg_user_einheiten <span style="color: #66cc66;">&#40;</span>
user_id int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
einheit int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
stufe int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
anzahl int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
verfuegbar int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Hier wird genau gespeichert, wie viele Einheiten von welcher Einheit noch leben und gerade verfügbar sind. Nicht verfügbare Einheiten greifen beispielweise gerade an. Außerdem kann auch noch die Stufe gleich mit aufgerufen werden.Diese kann man beispielsweise durch Entwicklung der Pfeile oder erreichen eines neuen Zeitalters erreichen.</p>
<p>Ich hoffe, dass euch mit dieser kleinen Anleitung schonmal ein Einblick möglichst ist.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamux.net/browsergame-tutorials/mitglieder-datenbankstruktur/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
