# Blogs

## I Am Overburdened, saving my soul

Certain item skills with persisting effects (e.g.: Fear, Cripple) could get stuck or be triggered on recently summoned/resurrected monsters in rare cases. These were not visible, but could affect how well you did, so my apologies for the occasional unfair (de-)buffs.
The positioning of hallucinations from toxicity effects (e.g.: Toad monsters, poison in potion) were not correctly randomized. These hallucinated monsters were always placed in the upper-left quarter of the map, breaking the illusion. Now this is fixed.
A while ago I added item-slot notifications to item pickups and chests when standing nearby. It did not occur to me though, that with this modification the treasury pickups and chests triggered unnecessary ones too. Oops, fixed!
In balance With this update balance tweaks found their way into the game too. There were still some complaints regarding this aspect, so I made normal mode a tad bit harder and nightmare difficulty a tiny bit more forgiving. These are not substantial changes, only slightly affecting the pickup and chest spawn rates. Another extra is “near death” detection. Simply put if you end up in a really bad situation at some point, the game tries not to punish you even harder on the next dungeon level These changes are subtle, so they keep the game challenging, but they were introduced to make it more fair at the same time. Boss confusion Some people found the boss level corpses confusing. I don’t know if the new version will work out better (this is not the first time I change this ), but now the number of corpses (below the one serving as the story hint) are tied to the unlock progress of the boss entry in the monster book. I know some other unlocks still need more and better hints too. I’m going to work on these problems in the near future… Am I still alive? Yes, pretty much. Due to personal and financial reasons I had to put full-time game development on hold for a long while, but I’m back now and I will be working on my projects in the upcoming months. Before I vanished from the face of the INTERNETZ I teased possible ports and a bigger content update for I Am Overburdened. These are not forgotten and progressing well In a week or two I will reveal more details about my plans. Until then, have a fun-filled time.
Thanks for reading and take care!

## Frogger GameDev Challenge - Part 4 - Frog Jump

I haven't touched this project since my last update on October 24 2018, motivation is a bit shot with this one... but I'm still going to try to complete the challenge. This project is really just an excuse for me to try out Unity as I've never used it before. I've spent a few days in the engine and must say it's pretty straight forward and thanks to @lawnjelly for helping me out with a few questions I had. I did a quick animation for the frog jump in Blender, then loaded it into Unity, and added in the movement to work with parts of the animation. Nothing outstanding animation wise but it will work for now. Movement will stay 4 directional with animation lock. I'll need to edit the move value once I figure out spacing. GIF Below: Later today I'll workout my "game plan" for how to put everything together then post back. I haven't really consider scales yet for objects, or environment textures. Anyhow, that is all for now.

## It's NOT a Simulation! :D

I think I've finally put my finger on the button(s)(quite a few apparently) that may explain my project.  It's helping me to clarify my vision anyhow, so just play along okay? I'm not building a game simulation....  I've been trying to use that term because it's what everybody else uses, and it really just doesn't fit my project at all. There is no single starting point and there is no single ending point.  The story elements are to be primarily interaction based and not strictly tied to highly specific locations or circumstances.  The visual synchronicity of the experience is only dependent on entity proximity, which in effect makes it more of a relativistic kind of synchronicity than the absolute kind anyhow.  All gaming entities(players,npcs,mobs,bosses..etc) will be autonomous actors in the gaming environment, regardless of what controls it.  e.g. Each NPC will essentially be their own entirely isolated behavioral code(running on a server OR client node somewhere).  This code will generate a game entity that is just as actualized in the environment as any other object or player character, it will just behave according to its "script".  All in real-time, with client controlled physics. So, I'm building a "Multiple Entity Gaming Environment".... It's a working title..   In essence, instead of streaming data that has been aligned to a unified simulation out to many many clients, I'm streaming data about many many ongoing semi-synchronous real-time "INTERACTIONS" from game clients into a massive, fast, circular buffer.  From which, the servers shall draw conclusions and route corrective actions to multiple endpoints simultaneously, and hopefully in many cases, preemptively. When we're worrying about things in a game becoming out of sync, it's usually in relation to some kind of fast motion or relative positioning, a gun-shot or a left hook, something that is moving/has moved/will move and the event needs to have the same outcome on multiple gaming clients.  Users in most games with this kind of action, don't generally care if their team-mate was .5 meters closer to them then they looked like they were when they helped shoot down the boss.  They only care that the shots they saw coming from that team-mates gun were hitting the mark that the team-mate was aiming at, which was hopefully the boss, if the team-mate is any good. This may be something of a contrived example, but it more or less illustrates my point.  As long as the servers can provide the appropriate real-time adjustments to certain aspects of the entity interactions to make the synchronicity fall into a zone of acceptability, then nearly all the heavy lifting can be done by the client without running every client input into and back out of a tightly wound server controlled simulation.  Then, how do we control anything?  The major change here is how Authority is implemented, in a standard server-simulation, the policy is trust nobody.  Here, it is trust everybody, but also verify and cross-check everything.  In this paradigm the authority is purely corrective in nature, with designs on preemptive corrective abilities(where applicable), but primarily relying on minuscule corrective actions that steer the simulation variances into a zone of acceptability. Another fairly extensive level of control comes from the decoupled nature of the system.  Since all entities are autonomous components, they can each be turned on or off at will.  So, that pretty much gives us all the control, never heard of before.  Each entity can be rewritten, debugged, uploaded and instantiated into the game.  Without a single system restart, or change to the game code(goals, I got em).    So, since we aren't wasting all of our server horsepower on a massive interactive simulation, we can use it to play cop, crossing-guard, mail-carrier and chauffeur all at once. We can implement heavy-handed position and relative distance checking into the entity data feeds that are being streamed INTO the servers, we can correlate those patterns with known good behaviors and known cheat behaviors/known out of bounds behaviors.  We can implement corrective actions that will steer the entities back into synchronous path(s) when necessary.  And we can allow certain entities to become out of sync for longer periods without risking the integrity of any one game-wide "simulation".  Generally speaking, entities that fall too far out of sync can either get dropped like a laggy player, or will be re-instantiated from a node of the network closer to the action, depending on it's level of importance to the current branch of the narrative/network or game conditions. Haha, well I hope that this rambling mess helps you understand what I'm doing better.  The more I write it down the clearer it becomes to me.  I started building this beast before I even knew what it was going to look like.

## 1943 Plane Game

I am still working on my 1943 plane game. I have got the one plane to move and shoot bullets in all directions. I am going to do the same for the second plane.

## Update 0.19.0

Still just a start, WIP, but finally a new step done.
New assets, new sandbox map…
Isometric and alpha maths has been rewritten but still needs a lot of refactors and reviews. http://game.applicant42.com/

## Gameplay Xilvan Design games for 2018-2019!

Hi everybody, Xilvan Design building 3D games since 2004 in Blitz3D, we now present you our kindly official gaming related pages. (please click on each links, download games & bookmark the pages): Lights of Dreams IV: Far Above the Clouds v9.27. Candy World II: Another Golden Bones v9.47. Candy Racing Cup: The Lillians Rallies v3.01. Candy World Adventures IV: The Mirages of Starfield v7.57. Candy to the Rescue IV: The Scepter of Thunders v7.17. Candy's Space Adventures: The Messages from the Lillians v17.47. Candy's Space Mysteries II: New Mission on the earth-likes Planets v7.47. New Xilvan Design Websites. Xilvan Design's Youtube Channel. Friendly, Alexandre L., Xilvan Design.

## Frogger Challeng - Update #3

This week I looked at having cars properly generated on one end of the level and destroyed on the other. And some adjustments so that I'll be able to tweak frequency and travel speed a little later on. It's hard coded at the moment still and I'm pretty sure it's not all tuned quite how I want it but it's ok while other development is going on. On Wednesday I threw together a turtle sprite with diving and surfacing animations (not shown in video) and I'm quite happy with how it turned out. The turtle almost feels as though it doesn't quite fit with the style of other graphics but I'm going to keep what I have. I started with a copy of the Car class for the turtle so I was able to get the turtle following tracks similar to what the cars do. But I realised that I don't have to set a track of data on all tiles, I just have to set it on corners where I want turns to occur which allows for paths to cross each other. Also, when I was distracted at one point, a turtle collided with the frog and killed it, following the car logic. I figured it might be a good feature to keep in the game. Even if the frog can jump onto the turtle's back, standing in the path of a turtle will kill the frog. The video shows a frog starting off and crossing the street. Cars wait their turn at an invisible traffic light and proceed accordingly. I have one turtle walking on the ground in a clockwise square path and another in the water on a path that crosses over itself in a number of places and is near the shore in a few spots. Near the middle of the video, the frog gets in the way of the turtle on the ground. After that I quickly show a little tile debugging information that drive the directions actors are traveling.

## Getting back to it

I haven't been around alot recently due to my pc deciding not to work and time constraints but I am back! To get back in to it I decided to make a quick game me and my niece used to play with cards. The object of this game is to multiply the cards quickest and the winner gets the cards. Ok so after messing about for a day with it i have got a single player edition playable.   It is not anything pretty by any means but it was a good way to get back into the swing of things. I will add options to it so you can choose the highest card 1-13 and how many decks of them cards. I would like to also make some sort of nice win screen too as at the moment it just takes you back to the Play/Exit screen.

## Hot Potato Minigame

Progress on a new minigame, playable by blind users. To pass the potato you have to jump and when the timer expires, the last one with the potato explodes.  To do: add sounds to indicate which player the potato is on. 2018-11-12_16-28-47.mp4

## This Week in Game-Guru - 11/12/2018

This week's update may actually make it to the Game-Guru news page, woohoo!

We'll see.  I've been in communication with TGC's marketing person and it's moving forward, albeit a bit slowly.

Official Game-Guru News Well, it doesn't appear they have added anything new as of this writing, though typically news releases seem to be done later today or tomorrow.  In the interim I can say I found this site:
https://www.game-guru.com/news-posts?post_type=guest-authors
Which currently only has one post but hopefully yours truly will see the light of day there soon.

What's Good in the Store This week we've got two entries.  One is a timely turkey, as it were, just in time for the grand American holiday of Thanksgiving were we gorge ourselves on copious amounts of food and then fall into a comatose state.
A little small, by 'murican standards.

Campana productions put this one together and you can find it here: https://www.tgcstore.net/product/32155

Next we have a really nicely done pack of snow-themed assets.

It's got everything from buildings to vehicles.  I'm also happy to see he included a few free models for you to trial as well.  It's well priced at \$8.00 which is a bargain by any standards.

You can get your copy here: https://www.tgcstore.net/pack/11058

Free Stuff
In the realm of free stuff we're getting into the giving time of year and it shows!
Lafette, as mentioned, has a few free things on that pack you should grab.  He also made a train station too though.

You can get your copy of the 'Free old German train station' here: https://forum.game-guru.com/thread/220209

It appears GraphiX is making headway on his new kit, though I'm not sure if it will be free (though he keeps posting updates to the free forum so.. maybe?).  You can watch a video on this interesting sci-fi pack here: https://youtu.be/CToyFLW70d0

Mstockton released some free music over at his site.  Definitely head on over and make sure to like the page for him! https://michaelstockton.net/cartoon-casual-game-tracks-volume-1

Honkeyboy released some Lua code for Game-Guru that allows you to setup chatting NPCs relatively easily.  https://forum.game-guru.com/thread/220225#msg2608076
It's mostly to control the animations though so you'll still need to manage all the other elements such as sound and text.

Third Party Tools and Tutorials I found this ENORMOUS tutorial playlist on Game-Guru related topics on youtube over the weekend while doing book research: https://www.youtube.com/watch?v=HjSBCevTnYI&list=PLot9BTdhKKd4KV91P7WkIKVsybktHu1Za

Random Acts of Creativity(WIPs) This has been an absolutely crazy week for updates so if I missed you, apologies.  I *THINK* I got them all.  So in no particular order....

Schneeky has a fairly well done Medieval project put together.  I'm curious how this will bear out.  https://forum.game-guru.com/thread/220228

Honkeyboy started a new project.  Not so sure about this one, but if he polishes it, maybe it'll take roots for him.  https://forum.game-guru.com/thread/220201#msg2607752

A new user "OPENLOAD" made an italian title that looks very promising "Il mio primo lavoro "Memory of the Hedolan": https://forum.game-guru.com/thread/220223

Of particular note is DVader, who crawled out of the woodwork to deliver a holiday-themed project.  Why this is noteworthy is DVader is actually a fairly competent coder so you can expect some interesting work from a technical standpoint in this project.  https://forum.game-guru.com/thread/220214

Ertlov released a slice of his game 'Into the Ice' for testing - check it out here: https://forum.game-guru.com/thread/206985?page=3#msg2608009

Bonesy continues to update Cyberfi and it's actually starting to look like a real game.  This is a great example of what happens when you focus, buckle down and actually WORK on your projects!

Granada's been working on some guns in Game-Guru and I have to say I love the exaggerated look!

In My Own Works
I'm drawing closer and closer to completing my book, now within striking range of my target for completion.  I'm at 110,000 words and counting.  Once I pass 120k I'll probably keep going to 125/130k and then remove about 3-5k for editing.

This week was all about advanced AI control, sales, marketing, and piracy.  Very preliminary editing work began with chapter reorgs and other things.

Further this week will be mostly Lua oriented as I wrap up the 'intro' chapter to Lua, then do a complete Lua command reference for Game-Guru, and if I have time work on the Advanced Lua chapter (which I will admit I am somewhat dreading).

See you next week!

## New FreeType-based generator

My work on UBFG is still continue, but I decided to go with some important changes: I gave up the original UBFG Qt-native font generator for FreeType-based (looks like nothing left of the original UBFG code - I might change the name of the application in the future as well). This seems to be more friendly to cross-platform and gives me better access to glyphs info (so. eg. I can export svg atlas). I have a plan to finish with the development until the end of the year.

## Spacing in Different Levels

One of the problems we’ve ran into is the amount of space we have for each player playing our game. We’re going to have to create the rooms for small spaces, preferably 2m x 2m walking space and on the outliers We’ve come up with some solutions in traveling through the maps easily. 1.       We would start by separating the rooms into different levels. Simply by touching the doors. Once touching the door, the player would teleport to the other side of the door. 2.       We would leave it in an open concept and hopefully the player has enough space. 3.       The elevator idea, which fixes all these problems and changes the way the levels are constructed. Basically, through using the elevator, once the player enters the door the player would have to turn around to press a button and go to the next floor.     Also, another way of moving through the corridor with small spaces was using a horizontal escalator.   And an update on what the equipment room can possibly look like:     Where those are cabinets where equipment will be placed inside of. Those Cabinets will be able to open and close. Later it will be a lot more detailed with computers and accessories. Past the door is an elevator that will also be detailed in the future.

## 3D FusionIDE W.I.P 1 -

Here is the welcome screen to fusionIDE - it is a multi-state, multi-form custom editor wrote 100% using vivid3d's 3d and 2d capabilities. The UI is called ResonanceUI.  This is all OpenGL based. Here is the video of the welcome screen.

## All Servers Are Now On Linux!

Okay, the servers are now all running on Linux.  I had initially intended to wait until all development was mostly completed to make the transition but now I'm glad I've done it.  And, the more I use Visual Studio Code, the more I appreciate its simplicity and how well it's adopted the Linux environment.  It's starting to feel like home now that I've got a few active projects going in it.  Plus it's nice to clear my Windows development space, I could have 6 or 7 copies of Visual Studio open at one time before this, now I've only got the Unity game client and whatever test projects I need to sort out the next functional leap.   The rest is all in a Linux VM that I can VNC into if I need to use Visual Studio Code, otherwise I can do everything server side with an SSH client. The next step for these servers is to massage them into actual Linux Daemons, which shouldn't be HUGE, but it will take a minor rewrite of some bits of code.  Not a huge issue until I have a real server though.  So, really the next step is to get the base functionality built out in the next 3 Servers(Mob, Narrative, & Social) Here's a quick video of the client(Unity Windows) testing out all 3 current servers running on Linux. Top to Bottom: Avatar Server(Authentication/inventory/etc..), Economy Server(Banking/etc.), Action Server(Online Multi-Player/etc..) First we test the Action Server with the standard Ghost test you've seen here before, but then I mess a little with the banking features(transferring credits to/from inventory), and then I show how the drop item from Inventory and Pickup item(into inventory) works. Enjoy.   As always, more to come soon. linux_3.mp4

## Advice (Updated) Struggling With Remembering What I've Learned.

Well, in my journey (and completion) of learning C#, I've come upon a rather peculiar problem. I don't know if it has to do with having high-functioning autism, which I do, but I seem to struggle to remember anything related to this. If I see it and am given an example I can copy and reproduce results from a simple tutorial, I can do it usually without error (if not too complex). When I attempt to write my own script, my brain completely goes white. I can't remember or figure out how to use different parts of the C# language, and it's like attempting to read Chinese when I look through Unity's Scripting API and look for other tutorials for supplemental learning. I take notes, I pay full attention to the videos and interact along with them, and I do attempt solitary practice. I just can't seem to get anything to "stick" to the point where it makes sense outside of a learning example. I can't seem to apply what I'm learning in reality, and it's becoming a great problem. Does anyone have any advice for getting this stuff to stick? I've always been a visual learner and a hands-on learner, but with logical stuff that isn't within the realms of art has always been something I've had a hard time learning and remembering later on. I appreciate any advice you can give. Thank you. EDIT: Updated on 11/11/2018 because I've been sick and busy AF with stuff outside of coding. I have been making great headway thanks to the set of tutorials made by http://rbwhitaker.wikidot.com. I was recommended this tutor by the user Septopus, and good gods has he been helpful at breaking down the stuff I didn't understand. I've been following along with the beginning C# tutorials, and will move on to MonoGame ones when I am comfortable. I cannot thank you all enough for the support and encouragement you've given. Just another sign I should keep going with this. Take care!

## The 3D book

After a break of several years the 3D book project is back on.   A few short words now on what this blog is about.  I have to deliver my wife to the bus station in a few minutes, then a week alone so may have the time then to explain things.  But the 3D book is something I started in 014 and put several years into, then the break, now on again.  A win32 app with a text window and an ogl window. I just remembered I had something written on this so here it is I write to see if anyone in this community of game developers, programmers, enthusiasts,  may be interested in a project I have been developing[off and on] for several years now. So follows a short description of this project, which I call the 3D-Book project.  The 3D-Format Reader: A new format of media. Imagine opening a book, the left page is conventional formatted text - on the right page a 3D animation of the subject of the text on the left hand page.  The text page with user input from mouse and keyboard, the 3D page with user intput from a game pad.     An anatomy text for a future surgeon, with the a beating heart in 3D animation.

A childrens story adventure book with a 3D fantasy world to enter on the right page.
...     Currently 3D-Format Reader consists of a C++ Windows program: Two "child" windows in a main window frame. Two windows: a text-2D rendering window and a 3D-rendering window.  The text-2D window, as its' name implies, displays text and 2D graphics; it is programmed using Microsoft's DirectWrite text formatting API and Microsoft's Direct2D API for 2D graphics.  The 3D-rendering window uses the OpenGL API.     A 3DE-Book page is formatted in one of two possible modes: DW_MODE or GL_MODE.  In GL_MODE both windows are shown; the text-2D rendering window is on the left and the 3D OpenGL window is on the right.  In DW_MODE, only the text-2D rendering window is shown, the OpenGL window is hidden (Logically it is still there, it has just been given zero width).     The 3D-Format Reader reads text files, which consists of the text of the book, control character for the formatting of text, (bold, underline, ...), display of tables,  loading of images(.jpg .png ...), and control of 2D and 3D routines.           3D-Reader programming is based on a Model-View-Controller (MVC) architecture.  The MVC design is modular: The Controller component handles user input from the operating system , the Model component processes the input, and the View component sends output back to the user on the display.  Typical Parent-Child windows programs have multiple "call back" window procedures(winProcs): One for the parent window and one for child window.  The MVC model, simplifies message routing by using a call-back window procedure which receives Windows messages for the main window, the text-2D window and the OGL window.

A sample MVC program by Song Ho Ahn was used as a template for the 3DE-Reader. Rushed for time now, so a hasty sign off and thanks for reading. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8 - 21 -18 I spent the last few days working on procedural mesh generation.  First looking to find a bit of code to do what I had in mind.  Which begs the question: What
did I have in mind?   I just wanted a cube mesh generator such that...   Requirements Input:    An integer  n = units from origin to cube face. Output:  The vertices for a unit cube centered on the origin.                                                                     8n² triangles per cube face. 3 times 8n² verts in clockwise winding order (from the outside of the cube) ready for the rendering pipeline. Screenshot of some cubes generated with the procedural cube mesh generator.                              That was about it for the output requirements.   I did not want to hand code even a single vertex and did not want to load a mesh file.   I was sure the
code was out there somewhere, but was not finding it.  So, a bit reluctantly at first, I started coding the mesh generator. I started enjoying creating this thing and stopped searching for the "out-there-somewhere" code; although still curious how others did this. Analysis First question: How do we number the verts?  It would be great to conceive of some concise algorithm to put out the cube face verts all in clockwise
order for the outside faces of the cube directly.  That seemed beyond me so I plodded along step by step.  I decided to just use a simple nested loop to generate the cube face verts and number them in the order they were produced.  The hope(and the presumption) was: The loop code was in some order, running thru the x y and z coordinates in order, from -n to +n, therefore the output would be a recognizable pattern. The simple nested loop vert generator did not let us down: It gave us a recognizable pattern, at least for this face. It turned out (as expected now) that all six faces have similar recognizable patterns. Plotting the first row or two of verts you can easily see how to run the rest of the pattern.  Plot of the first(of six) cube faces verts output by the vert generator:  Input of n:  There are (2n+1)² verts per cube face, or 25 verts for n = 2.                                                          This is looking at the x = -n face from the outside of the cube.  To simplify the math it helps to define s = 2n.  Then there are                                                                                       (s + 1)²  verts,  or 25 for s = 4                                                                                       s²  cells on the face, or 16 for 4 = 2. We are going divide each cell into 2 triangles, so there are 2s² triangles per face, or 32 for s = 4. Second question: What pattern for the triangles?  How to number the 2s² = 32 triangles? What we want in the end is a bit of code such that... for triangles T[0] thru T[2s²-1]  or T[0] thru T[31]( for n = 4), we have T[N] = f0(N), f1(N), f2(N).  Where f0(N) gives the first vertex of T[N] as a function of N. and f1 and f2 give the second and third verts, all in CW winding order looking into the cube of course.  Here the choice is a bit arbitrary, but it would seem to make things easier if we can manage to have the order of triangles follow the order of verts to a degree.   Numbering the triangles.                                                   And now the problem becomes: Look at the triangle vert list,  T0 - T8...T31 in the image, and try to discern some pattern leading us to the sought after functions f0(N), f1(N), f2(N) where N is the number of the triangle, 0 thru 2s²-1. This really is the holy grail of this whole effort; then we have T[N] = f0(N), f1(N), f2(N) and that list of verts can be sent directly to the rendering pipeline.  Of course we want these functions to work for all six faces and all 12s² triangles to cover the cube.  But first let's see if we can just do this one face, 0 thru 2s²-1.. Thru a bit of trial and error the 32 triangles(T0 - T31) were ordered as shown.   Now we have an ordered list of the triangles and the
verts from our loop. T0 = 0 5 6
T1 = 6 1 0
T2 = 1 6 7
T3 = 7 2 1
T4 = 2 7 8
T5 = 8 3 2
T6 = 3 8 9
T7 = 9 4 3
T8 = 5 10 11 ... T30 T31. If we can find a pattern in the verts on the right side
of this list; we can implement it in an algorithm and
the rest is just coding. Pattern recognition: It appears T2 = T0 with 1 added to each component
Tetrahedron The tetrahedron is the platonic solid with the least number of faces(4),  edges(6),  and verts(4).  In antiquity it was associated with the element of fire due to its' sharp vertices.   The algorithm for the tetrahedron mesh was developed in a similar way to the cube, but here it seemed simpler to get a routine for just one face - an equilateral triangle - and use matrix translations and rotations to form the complete tetrahedron.  So more like origami or tinsmithing than blacksmithing.   Procedural tetrahedron screenshot.   The n = 4 and the general case  To get an routine for the general case, n an integer > 0, a bit of what I think is known as mathematical induction was used.     PSUEDOCODE Spin = glm::rotate(  PI/3, zaxis ); //matrix: rotate 60 degrees around z axis for(int row = 0; row < n; row++){ // go row by row         count = 0; // set first triangle in the row = 0     for(int i = 2*n*row - row*row; i < 2*n*row - row*row + 2*n - 2*row - 1; i++){  // the magic happens here                      if (count % 2 == 0 ){ // triangle is even in the row -just translate              x_Lat = glm::translate((count+row)/2n, row*height, 0.0f);             for(int i = 0; i < 3; i++){                 triangle[n].vert[i] = x_Lat*triangle[n].vert[i];                         }                                 }         else{ // triangle is odd in the row -  rotate then translate             x_Lat = glm::translate(count+1+row)/2n, row*height, 0.0f);                             for(int i = 0; i < 3; i++){                 triangle[n].vert[i] = x_Lat*Spin*triangle[n].vert[i];             }                             }     count++;     } }   This is the psuedocode version of the routine which generates the verts for the n² triangles in a face.  Getting this algorithm was a bit of a brain drain but looking for patterns in the image of the face allowed it to happen.  We use a "seed" triangle, which is triangle 0 on the lower left of the figure.  The verts of this one triangle are input; the rest of the n² triangles verts are generated by translating and rotating this seed triangle. Notice: There are n rows, every row has 2 less triangles than the row below.  If we number the triangles from 0 to 2n - 2*row - 2, where the rows run 0 to n; the even triangles just need to be translated ...                                                       in the x direction by (count + row)/2n  where count = their  position in the row 0 to 2n - 2*row - 2.                                                      in the y direction by row*height.  height = height of seed triangle. The odd triangles need to be rotated pi/3 = 60 degrees around the z axis then translated ...                                                       in the x direction by (count + row + 1)/2n  where count = their  position in the row 0 to 2n - 2*row - 2.                                                      in the y direction by row*height.  height = height of seed triangle. Now we have a single face for the tetrahedron, to join the four faces together we need the angle between the faces called the dihedral angle. Dihedral Angle Each of the five platonic solids has a characteristic called the dihedral angle. This is the angle between the faces. For the cube it is 90 degrees or pi/2 radians. For the tetrahedron it is 70.528779° = arccos(1/3). The tetrahedron, with just four faces, is the simplest of the platonic solids. The simplest way I can think of to build it: Start with the four face stacked one on another,  edges aligned. Imagine the top three faces each hinged to the bottom face along one edge.  Then rotate each face around then hinged edge by arccos(1/3), the dihedral angle. That is the method of the bit of code shown below.   PSUEDOCODE struct Triangle { glm::vec3 vert[3]; // the three verts of a triangle ... add other attributes, normals, colors }; /* std::vector<Triangle> tetrahedron(int n) Input: integer 'n'; the number of triangles along an edge of the tetrahedron. Output: vector<Triangle> ; container for the 4n² triangles covering the 4 tetrahedron faces. */ PSUEDOCODE vector<Triangle> tetrahedron(int n){ float tetra_Dihedral = acos(1/3); // --- Second face --- // We take the equilateral triangle face we generated above // which consisted of n² triangles. This face sits on the xy plane // with its lower left corner at the origin. // // Now we bend it -70.528779° = -arccos(1/3) around the // the X - axis. (Its' bottom edge) Spin = glm::rotate( -tetra_Dihedral, xaxis ); //just rotate for(int i = 0; i < n*n; i++){ for(int j = 0; j < 3; j++){ // This is the second face so triangle indecies // run from n² to 2n² tri_Angles[n*n + i].vert[j] = Spin*tri_Angles[i].vert[j] } } // The previous rotation gives CCW verts looking in from the // outside so need need to make them CW again for(int i = n*n; i < 2*n*n; i++){ swapVerts(tri_Angles[i].vert[0], tri_Angles[i].vert[2]); } // --- Third face --- // We take the original equilateral triangle face. // Now we bend it 70.528779° = arccos(1/3) around its left edge.. Spin = glm::rotate( tetra_Dihedral, glm::vec3(0.5f,0.866025f,0.0f)); for(int i = 0; i < N*N; n++){ for(int j = 0; j < 3; j++){ // This is the third face so triangle indecies // run from 2n² to 3n² tri_Angles[2*n*n + i].vert[j] = Spin*tri_Angles[i].vert[j] } } // The previous rotation gives CCW verts looking in from the // outside so need need to make them CW again for(int i = 2*n*n; i < 3*n*n; i++){ swapVerts(tri_Angles[i].vert[0], tri_Angles[i].vert[2]); } // --- Forth face --- // We take the original equilateral triangle face. // First we translate it so its' lower right corner is at the origin // Then we bend it -70.528779° = -arccos(1/3) around its right edge.. x_Lat = glm::translate(glm::vec3(-1.0f, 0.0f, 0.0f)); Spin = glm::rotate( -tetra_Dihedral, glm::vec3(-0.5f,0.866025f,0.0f)); for(int i = 0; i < n*n; i++){ for(int j = 0; j < 3; j++){ // This is the forth face so triangle indecies // run from 3n² to 4n² tri_Angles[3*n*n + i].vert[j] = Spin*x_Lat*tri_Angles[i].vert[j]; } } //need to make it CW again for(int i = 3*n*n; i < 4*n*n; i++){ swapVerts(tri_Angles[i].vert[0], tri_Angles[i].vert[2]);v } // We now have the complete tetrahedron but its' base is not horizontal. // Lets set it flat in the xz plane and center it at the origin. // put the base in the xz plane: Rotate: 90 - dihedral angle around the // X - axis. Spin = glm::rotate( tetra_Dihedral - half_PI, xaxis); for(int i = 0; i < 4*n*n; i++){ for(int j = 0; j < 3; j++){ Spin*tri_Angles[i].vert[j]; } } // Put the center at the origin, y axis passing through the apex // sqrt(3/8) = 0.6124 is the distance from "top/apex" vertex to center // of a tetrahedron with side = 1 // // 1/2(sqrt(3)) = 0.28867 is the distance from the mid-point of an edge // to the center of a face.a vertex to the center of a side. x_Lat = glm::translate( glm::vec3(-0.5f, -0.6124f, 0.28867f)); for(int i = 0; i < 4*n*n; i++){ for(int j = 0; j < 3; j++){ x_Lat*tri_Angles[i].vert[j]; } } return tri_Angles; } Notes: Oops: Left out std::vector<Triangle> tri_Angles(4*n*n);  Should be the first line of the function body!  Those last two for loops could and probably should be combined to do a translate*rotate*triangle in one statement, but I have not tried it. All distances are for a tetrahedron with unit side. The sign of the dihedral angle in the rotations was usually determined by trial and error.  I.e.; I tried one sign, compiled the code and rendered the tet.  If it was wrong I just reversed the sign. The end result is a tetrahedron with its' center at the origin, its' base in the xz plane, and one edge parallel to the X axis. Of the five platonic solids; three (tetrahedron, octahedron, icosahedron) are composed of equilateral triangle faces. One of square faces (cube).  And one of pentagon faces (dodecahedron). Two tetrahedrons fit nicely in a cube.

## And the Messages are ROUTING!!!

I have succeeded in creating a cross-platform, custom combination MQTT Client/Broker or "MQTT Router" that can Route messages to other MQTT Brokers/Routers.  They dynamically build connections to each other and test route latency.  They currently do NOT do any best route calculations.  But that is only a small behavioral ability that I can add at a later date and still feel like it's totally functional right now. In the below images you will see 3 windows, TOP = PRIMARY Router(Kinda like a DNS server, it distributes the Router hellos around so everybody knows where everybody else is. MIDDLE = PEER Router #1 on Linux BOTTOM = PEER Router #2 on Windows   Here you see the three servers connecting and subscribing to each other's publications and whatnot.   Here the Route-able message is submitted to the PRIMARY, Routed Through PEER#2  for  PEER#1   Submitted to PRIMARY, Routing Through PEER#1  for  PEER#2   And Submitted to PEER#2, Routed Through PEER#1  for  PRIMARY   Not the most interesting screen shots, maybe I'll put together a little video showing it in ACTION! haha.. Either way, a few days of hacking and I now have the core of my Content Delivery Network, at least ready for the next phase of integration and testing. Time to get back to writing the actual GAME SERVERS!!  hahaha I've got some serious refactoring and whatnot before I post any of this code though, so please be patient if you're actually interested in seeing it.

## Deck Selection Dialog

In my last post, I gave an overview of the Solitaire project that I am working on, along with an explanation of the features that I have currently implemented, and the feature that I was to work on next. The next feature of Solitaire that I wanted to implement is the deck selection dialog, where you choose from a list of predefined deck images, the image you would like to use on your deck backside when playing the game.  Here is what my dialog looks like. The goal of this dialog is to try to mimic the original Solitaire deck selection dialog.     Here is a list of features that were required for me to implement for this task. 1. I had to implement the initial dialog window along with its dimensions and specifications, such as making it a modal window, not allowing the window to be resized, and other options like that. This was pretty straightforward as I have done this many times before, and was simply a matter of testing the old dialog to see what I could and could not do. 2. I had to create the skeleton of the dialog, so I used a BoxLayout with a Y-Axis alignment, this is where I added two panel types, one that holds the deck button images, and the other that holds the OK and Cancel button. The first panel within my BoxLayout was a JPanel that uses a GridBagLayout with two rows and six columns. The second JPanel uses a FlowLayout centered about the x-axis. Note: The 2 row 6 column deck images that you see are actually JButton components. Here is how the dimensions of a button looks like from up close.   The button size is 45px in width by 74px in height. The border is removed by default on all buttons except for the one that was last selected. Within the button is the icon image, this is 39px wide by 68 px in height. When the button is selected, a 2px blue border is rendered around the button, leaving a gap of a few pixels between the button image and the border itself, similar to what was done in the original Solitaire game, or at least what I thought was implemented based on my research. I also disabled some events such as hovering your mouse over a button to prevent the background image from changing color because the mouse hovered over the button. I also disabled that same effect when clicking on the button. 3. Clicking on a button should show a border, and deselect any other button that was previously selected. This was very straightforward to do. 4. Fetch the deck images and load them into the button. 5. Adding events to the button such as double-clicking on a button to choose a deck image, or pressing on the enter key in the dialog to simulate an OK button click. 6. Update the deck images of all the cards in the game, including the image of the Stock view (the card at the top-left of the game) when a selected took place and the OK button was selected. To get this done, I had all my CardModel objects register to an event that I created called EVENT_UPDATE_BACKSIDE public static final String EVENT_UPDATE_BACKSIDE = "EVENT_UPDATE_BACKSIDE"; Here is the code that the CardModel uses for registering this event addSignalListener(EVENT_UPDATE_BACKSIDE, new ISignalReceiver<EventArgs>() { @Override public void signalReceived(EventArgs event) { OptionsPreferences preferences = new OptionsPreferences(); preferences.load(); _cardEntity.setBackside(preferences.deck); refresh(); } }); So I look at the options preferences, and based on what was saved from the deck selection dialog, I go into my card entity (a reference that each CardModel owns) and I set the deck to be whatever was saved. I then issue a refresh on the model that causes all the views that are data-bound to my model to perform an update(), which will then render their backside which will show the updated deck image. Here is how I make the call so that the registered event above gets fired // Update all the backsides of all the cards in the game EventArgs args = new EventArgs(this, CardModel.EVENT_UPDATE_BACKSIDE); AbstractFactory.getFactory(ModelFactory.class).multicastSignalListeners(CardModel.class, args); So what I do here is I create an EventArgs which is a base class for passing arguments around in my game. I indicate the sender and the signal name which is the same signal name that was used to register the event listener in the CardModel from above. I then perform a call onto all CardModel type objects that have been registered by my ModelFactory. This will dispatch my EventArgs to all the CardModel types that were created with my factory, that are listening in to the specified message. From there, the information is updated within each CardModel, and the view(s) that are bound to those models are updated accordingly, very straightforward stuff. The code that I wrote above comes from my own take on a much friendlier version of the Observer design pattern. I first started using the Observer provided to me by the Java SDK about two years ago, however over time I found it to be very limiting, so I eventually wrote my own version of it, and one day I will write an article outlining what I did and why I like it a lot more, but for now this is what I have been using in it's place for two years and it has worked out great for me. 7. Persist the selected deck image for future games played.  So that's all that there is. My next task is to implement the Draw Three feature, where every time you click on the Stock view (top-left card), three cards come into play instead of one. You can always follow my progress by following the game located at https://github.com/danielricci/solitaire, and if you have any questions I will do my best to answer them. Take care, until my next blog post.

## Unreal Fifth Entry - November 10, 2018

Hello all! This is the fifth entry of my development blog for my project 'Tracked Mind'. Since last post I've been taking care of the system that controls how the Player character moves and how stamina effects movement, and of course some bugs that appeared while I implemented it . The new version of the movement system will be able to keep a better track of the Player's stamina and different movement speed depending on the Player's stance etc. I am also creating the first draft of a couple of new maps. I'm uploading a few new screenshots of the game, one of them shows one of the new maps, let me know what you think!    Some changes this month: - The movement system has been updated. - New maps (first draft of them).
Bug fixes - Fixed a bug that would prevent reloading of the shotgun. - Fixed a bug that caused the Player to be able to sprint even when stamina was at 0.   Thank you once again for reading! /Mikael Henriksson