MagiMas [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=39684 Swing It! <p> <table><tr><td> <a href="/bbs/?pid=81372#p"> <img src="/bbs/thumbs/pico8_dupararodi-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=81372#p"> Swing It!</a><br><br> by <a href="/bbs/?uid=39684"> MagiMas</a> <br><br><br> <a href="/bbs/?pid=81372#p"> [Click to Play]</a> </td></tr></table> </p> <img style="margin-bottom:16px" border=0 src="/media/39684/rope_2.gif" alt="" /> <p>Controls:<br /> Z/C to jump and let go of the rope<br /> X/V to attach the rope (only works if the connecting line is white, otherwise you're too far away)<br /> Left/Right to swing on the rope (and run on the ground)</p> <p>To disable music, press X/V on the title screen.</p> <h2>Update 01.09.2020:</h2> <p>Uploaded a new version, now with two game modes and three difficulty settings for each mode. Highscores are saved individually for each mode and difficulty combination.</p> <p>Game Modes:</p> <h4>Normal</h4> <p>The failure line is locked to the score line and always a fixed distance away. The harder the difficutly, the closer the failure line to the score line</p> <h4>Speed</h4> <p>The failure line moves upwards every frame. The harder the difficulty, the faster the movement.</p> <h2>Original Post</h2> <p>Hey everyone,<br /> I started this cart nearly a year ago but finally had the time to bring it to a state where you could actually call it a publishable game with a start screen, high score (including saving the high score between sessions), music and sfx.<br /> Originally, I just wanted to try to get a good physics code working for rope swinging for some hypothetical sidescroller but then turned the test into a small arcade game.<br /> The highscore saves the highest point you reached, you lose if you fall below the striped yellow line. The screen loops around in the x-direction, so you can exit on one side and enter on the other. The anchor points are randomly generated each time you start a new game.</p> https://www.lexaloffle.com/bbs/?tid=39436 https://www.lexaloffle.com/bbs/?tid=39436 Sun, 30 Aug 2020 15:27:08 UTC PicOrbit <p> <table><tr><td> <a href="/bbs/?pid=67900#p"> <img src="/bbs/thumbs/pico8_hofusewoni-9.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=67900#p"> PicOrbit 1.0b</a><br><br> by <a href="/bbs/?uid=39684"> MagiMas</a> <br><br><br> <a href="/bbs/?pid=67900#p"> [Click to Play]</a> </td></tr></table> </p> <p>You are the god of this planet, unfortunately your powers are limited to the control of gravity in this patch of the galaxy. Do everything in your might to keep the planet at temperatures that can sustain organic life. To guide you, the habitable zone of each system is shown in green on the playing field.</p> <p>Remark: the solar systems are auto-generated from the seed given at the start of the game. I tried to make it so all generated solar systems have a good starting position, but if you encounter a particularly bad system just restart with a different seed.<br /> Also: After hitting start in the menu, the game may take a while to actually start. The calculation of the habitable zone is not very optimized and takes a while, so just be patient, there's nothing wrong with your browser. ;)</p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/39684/planets_9.gif" alt="" /> <h2>Controls</h2> <p>in-game:<br /> up/down - Zoom in/out<br /> left/right - increase/decrease force of gravity<br /> x - turn gravity on/off</p> <p>menu:<br /> up/down - change active menu items<br /> left/right - change value of active item<br /> x - press button</p> <h2>Post</h2> <p>Hey everyone, a few days ago I posted here in the WIP section a basic gravity simulation. At that point I wasn't sure if I'd progress much further on that, but since I'm on holiday at the moment, I actually got the time to sit down and turn it into an actual small game.</p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/39684/planets_7.gif" alt="" /> <p>The goal is simple: keep the planet at temperatures where organic lifeforms can thrive for as long as possible. If your planet gets too cold or too hot, you fail and the game will tell you how long your planet survived.<br /> To give orientation, the habitable zone of the solar system (where you essentially receive as much power as you're emitting and thus your temperature should stay stable) is calculated dynamically at the beginning of each game and plotted via green points. Keep the planet outside of the habitable zone and your planet will slowly cool down, keep the planet too close to the stars and it will heat up.</p> <p>There are two main UI elements:</p> <ul> <li> <p>The slider in the bottom indicates the current strength of gravity via the red indicator. Left means low gravitational constant, right means high gravitational constant. It also doubles as an indicator whether gravity is active at all or not (gravity can be toggled via x), if the planet reacts to gravity then there is a blue background, if not then not.</p> </li> <li>The &quot;thermometer&quot; in the bottom right indicates the current temperature of the planet. If it goes all the way to the bottom, or all the way to the top, you lose. To the left of the thermometer, there's a second scale that shows your current heat up/ cooldown rate. If the red indicator is at the green position, you're essentially keeping your current temperature, if it goes below, you're cooling down and if it goes above you're heating up.</li> </ul> <p>Additionally, the planet itself also kinda acts as a UI element, as it will change color based on how cold/hot it is.</p> <p>In case you're curious: the &quot;ideal temperature&quot; in green is within the code calculated as 300 Kelvin (approx 27&deg;C, no idea how many Fahrenheits, sorry), you lose if the planet gets hotter then 375 Kelvin (102&deg;C, so basically the point where the water on the planet would boil away) or colder then 225 Kelvin (-48&deg;C, no real reason why exactly at this temperature, I just wanted it to be symmetrical on both sides).</p> https://www.lexaloffle.com/bbs/?tid=35391 https://www.lexaloffle.com/bbs/?tid=35391 Thu, 19 Sep 2019 18:58:24 UTC Gravity Simulation <p> <table><tr><td> <a href="/bbs/?pid=67709#p"> <img src="/bbs/thumbs/pico8_hofusewoni-2.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=67709#p"> Gravity Simulation 0.25</a><br><br> by <a href="/bbs/?uid=39684"> MagiMas</a> <br><br><br> <a href="/bbs/?pid=67709#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Controls</h1> <p>up arrow/down arrow: zoom in/zoom out<br /> left arrow: show/hide debug information<br /> z: multiply gravity by 10<br /> x: turn off gravitational influence on player</p> <h1>Post</h1> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/39684/planets_5.gif" alt="" /> <p>So, this is my second post. This time I'm posting some WIP of a gravity simulation I'm writing.<br /> I'm not sure if this will ever turn into a game, maybe I'll just keep it as a &quot;toy&quot;.</p> <p>If you read &quot;The Three Body Problem&quot; by Cixin Liu and ever wondered how the trisolaran solar system worked, then take a look at the orbit of the planet in this simulation and imagine what it would be like, living on this planet. ;)</p> <p>This cartridge implements a gravity simulation using a kind of modified newtonian gravity to make the simulation more stable for a simple toy like this.<br /> Right now, the cart starts in &quot;debug&quot; mode and draws the field lines of the gravitational field as well as the current field line at the player position and the current acceleration of the player onto the screen. If you press left arrow, this debug layer is hidden.</p> <p>The simulation coordinates and the drawing coordinates are decoupled via a global scaling factor. This makes it easy to implement a zoom function just by changing the scaling factor.</p> <p>If you're interested in seeing different situations, you can easily add more gravitational bodies by calling 'create_body(x_position, y_position, mass, color)' in the _init function. The cart will automatically add this new body to all calculations.</p> <h2>The simulation</h2> <p>Okay, so there's a lot to talk about here, so I'll split this one up into subsections</p> <h3>Gravity Algorithm</h3> <p>I'm using the <a href="https://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet">velocity Verlet algorithm</a> to compute the gravitational acceleration that acts on the player. The advantage of using velocity Verlet is, that it is a symplectic solver. This means that energy, momentum and angular momentum are actual conserved quantities like in real life even over long simulation times. That's an advantage over the simple Euler methods as well as over more complex Runge Kutta methods, making the whole simulation much more stable.</p> <p>I am however only applying this gravity to the player character, the other stellar bodies are fixed in place and are not updated using this algorithm. It would be easy to implement a full n-body simulation, but for stability and simplicity, I opted to make only the player a dynamic body.</p> <h3>Modified Newtonian Gravity</h3> <p>You might be familiar with Newtons law of gravity. If you're not then just know that according to Newton the gravitational force between two objects is proportional to the distance squared of the two bodies. So if x is the distance, then the force/acceleration will go with 1/x^2.<br /> The &quot;problem&quot; for a toy model like I'm programming here is, that for small distances x&lt;&lt;1 this force/acceleration becomes huge. At that point you're not only running into floating point errors, you're also bound to get a very unstable system where the player planet will be slung out of the &quot;solar system&quot; because the force was so big. To get any kind of stable system, you would have to really carefully tweak the starting parameters of the simulation.</p> <p>In real life this &quot;problem&quot; is solved because everything on unstable orbits got either slung into the sun or out of the solar system, so now only planets with stable orbits remain. In the simulation I really don't want anyone to wait around for billions of years to find some stable orbits.</p> <p>So how do you make the simulation more stable while mostly adhering to Newtons law of gravity? The answer is simple: replace the 1/x^2 Newtonian gravity with a modified 1/(b+x^2) with a small b (if you know a bit of math: the shape of this function is the shape of a Cauchy-Lorentz distribution curve). If x is much bigger then b, then this is approximately the same as 1/x^2 but for very small x this b prevents the force from becoming too big (as the biggest possible value for the force is 1/b for x=0).</p> <h3>Field Lines</h3> <p>In analogy to field lines in electromagnetism, I decided to draw gravitational field lines to depict the gravitational force. This is trivial to do, every celestial body added to the simulation also adds 16 points along it's surface as origins for field lines. At those points the direction of the gravitational field is checked, a scaled unit vector along the same direction is drawn with a line command and at the end of said drawn line, the field is check again etc.pp.</p> <p>To save on resources, this calculation is only done whenever a new celestial body is added. The field lines are static afterwards, so no need to calculate them each frame.</p> <p>I also thought about representing the gravitational field via equipotential lines, but the computational expense to solve the implicit function would be much bigger, so I decided against it.</p> https://www.lexaloffle.com/bbs/?tid=35363 https://www.lexaloffle.com/bbs/?tid=35363 Sun, 15 Sep 2019 21:40:05 UTC Race 1.0 <p> <table><tr><td> <a href="/bbs/?pid=67699#p"> <img src="/bbs/thumbs/pico8_fewefimugo-8.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=67699#p"> Race 1.0</a><br><br> by <a href="/bbs/?uid=39684"> MagiMas</a> <br><br><br> <a href="/bbs/?pid=67699#p"> [Click to Play]</a> </td></tr></table> </p> <h2>how to play</h2> <p>Use z to accelerate and the arrow keys to turn.</p> <h2>Post</h2> <p>Hey everyone,<br /> this is my first post here, so hopefully I'm doing everything correct.</p> <p>I discovered PICO-8 around two weeks ago and was intrigued by its design philosophy. As someone who is only interested in Game development as a hobby, I love that basically all tools needed for developing a small game.</p> <p>So I've been playing around with the program for the last two weeks and decided that the best way to learn how to use PICO-8 (and Lua, as I never used that language before) was to develop a small game.</p> <p>The result is this small racing game against the time (as I don't have any idea how to write an AI for a racing game) with two tracks. The gameplay is nothing to write home about but I'm still quite fond of the end result.</p> <p>In principle it's pretty easy to add more tracks, just &quot;draw&quot; them on the map screen with the sprites. However, I didn't bother to write a code that automates the finish-line or the creation of checkpoints along the track, so those have to be set in code.</p> <p>Some small things I personally find neat:</p> <h3>Animated audience</h3> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/39684/game01_1.gif" alt="" /> <p>Upon loading a track, the game checks for any audience sprites set in the map editor and replaces them with animated audience objects.<br /> The animated audience will slowly bob up and down if the player is far away and will bob up and down fast and throw confetti if the player is close by. The confetti is done using a simple particle system, randomly spawning in particles with a random velocity and a fixed acceleration along the y-direction to make the particles &quot;fall to the ground&quot;.<br /> The distance to the player is checked using a modified Euclidean norm (basically n(x,y) = sqrt(x^2 + (a*y)^2) with 0&lt;a&lt;1) that deemphasizes the distance in y-direction. As long as the audience is mostly setup along a horizontal line along parts of the track that go along x-direction this means that the audience only reacts to the player as he's/she's driving past them but the player doesn't have to be super close to the curb in y-direction.</p> <h3>&quot;Destructible&quot; barriers</h3> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/39684/game01_2.gif" alt="" /> <p>When the game detects a collision with one of the barrier sprites, the corresponding sprites are are replaced by &quot;broken&quot; versions of the object.</p> <h3>Tire tracks</h3> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/39684/game01_3.gif" alt="" /> <p>I used the particle system to draw tire tracks behind the car. Unfortunately handling the tire tracks this way it was too much of a drain on the performance to have them permanent.</p> https://www.lexaloffle.com/bbs/?tid=35359 https://www.lexaloffle.com/bbs/?tid=35359 Sun, 15 Sep 2019 18:03:40 UTC