<?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>Excel | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/excel/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Sat, 25 Jul 2020 13:11:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>Excel | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>Using Excel for level design</title>
		<link>https://learncgames.com/using-excel-for-level-design/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-excel-for-level-design</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Thu, 23 Jul 2020 23:00:48 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Techniques]]></category>
		<category><![CDATA[Excel]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=1036</guid>

					<description><![CDATA[<p>In the asteroids game and shortly in my MatchThree game, I&#8217;ll be creating a level data array of struct. This has a struct for each level containing a count of particular features for that level. This is the struct and array for a level in asteroids. struct level { int nums[4]; // how many of [&#8230;]</p>
The post <a href="https://learncgames.com/using-excel-for-level-design/">Using Excel for level design</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignleft size-full wp-image-1037" src="https://learncgames.com/wp-content/uploads/2020/07/excel.png" alt="Excel level spreadsheet for Asteroids" width="950" height="240" srcset="https://learncgames.com/wp-content/uploads/2020/07/excel.png 950w, https://learncgames.com/wp-content/uploads/2020/07/excel-300x76.png 300w, https://learncgames.com/wp-content/uploads/2020/07/excel-768x194.png 768w" sizes="(max-width: 950px) 100vw, 950px" />In the asteroids game and shortly in my MatchThree game, I&#8217;ll be creating a level data array of struct. This has a struct for each level containing a count of particular features for that level.</p>
<p>This is the struct and array for a level in asteroids.</p>
<pre><code class="language-c" data-line="">struct level {
	int nums[4]; // how many of each size of asteroid
	int aliens; // how many aliens
	float factor; // from 1.0 to 1.5 - multiply asteroid speed by this
};

struct level levels[50];</code></pre>
<p>This is the first 3 levels and level 50.</p>
<pre><code class="language-c" data-line="">#include &quot;levels.h&quot;

struct level levels[50] = {
{ .factor = (float)1,.aliens = 1,.nums = { 0,0,3,3 } }, // Level 1
{ .factor = (float)1,.aliens = 0,.nums = { 0,1,3,3 } }, // Level 2
{ .factor = (float)1,.aliens = 0,.nums = { 0,1,3,3 } }, // Level 3
..
{ .factor = (float)1.5,.aliens = 3,.nums = { 4,4,5,5 } } // Level 50
</code></pre>
<p>I didn&#8217;t type any of this in. Instead, I created that spreadsheet above. It&#8217;s easy to work out difficulty levels in column H.  The formula that calculates this is ins this on row 5. If you don&#8217;t know Excel, the $ in the factors means that as you copy this into successive row, it keeps the $ row value constant.</p>
<pre>=(B5*B$4)+(C5*C$4)+(D5*D$4)+(E5*E$4)+(F5*F$4)+(G5*G$4)   - Row 5

=(B6*B$4)+(C6*C$4)+(D6*D$4)+(E6*E$4)+(F6*F$4)+(G6*G$4) - Row 6</pre>
<p>So you can see its multiplying the values in rows 5 6 etc by the values in row 4.  Having put that in place I could tinker with the values in rows 5,6 etc to make the difficulty level increase roughly at the same pace. The difficulty level for level 50 is 77.5.</p>
<p>This is what the Excel formula looks like to generate the C code, it&#8217;s in cell M5 in the spreadsheet and then copied and pasted down.</p>
<pre>="{.factor =(float)"&amp;G5&amp;", .aliens="&amp;F5&amp;", .nums = {"&amp;B5&amp;","&amp;C5&amp;","&amp;D5&amp;","&amp;E5&amp;"}}, // Level "&amp;A5</pre>
<p>and this is what it looks like. C code that can be copied and pasted directly. It even includes the comment for the level number!</p>
<table style="height: 52px;" width="522">
<tbody>
<tr>
<td colspan="6" width="384">
<pre>{.factor =(float)1, .aliens=0, .nums = {0,0,3,3}}, // Level 1</pre>
</td>
</tr>
</tbody>
</table>
<p>Creating a spreadsheet and C code from it this way saved a lot of typing but let me quantify the numerical difficulty which increases from 17.5 on level 1 to 77.5 on level 50. There&#8217;s no meaning to this value, it&#8217;s just a calculation.</p>The post <a href="https://learncgames.com/using-excel-for-level-design/">Using Excel for level design</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1036</post-id>	</item>
	</channel>
</rss>
