Sign in to follow this  

OfficeGames announcement

Recommended Posts

@jerome There is a bit I need to do still, but I am almost to the point of setting up the full gameplay.  Then I need to do a bunch of optimizing and set it up to build the assets in async (which I have the script in place I just need to shift to the async functions).

Im hoping by the end of this week, or beginning of next it should be playable.

I am like one or two days from turning on all the basic features to be able to play a game.  Are there any "rules"  I need to follow when doing this development for you?

Share this post

Link to post
Share on other sites

well I did not realize the link I posted was broken... I will fix it when I get into work this morning and that above post will make a lot more sense.

@jerome, *UPDATE* I fixed it and it is "playable" now.  Just gotta finish up some rule logic with winning/losing and drawing new cards.  Then its activate the async features to stop the DOM from hanging on initial compile.  Then make it look nice and start adding what ever flair.

If you don't know the game rules are: 
don't go off the edge of the board,  don't run into another player (same path other paths that cross are ok).

you can rotate a tile if you have it highlighted and use the arrow keys.


Share this post

Link to post
Share on other sites

Just enabled the ASYNC build, so it should not hang when compiling the assets now.

Also you can choose the number of players now.

Just need to add the win/lose logic and work on the dragonToken logic for who draws first when new tiles become available.

Some sort of UI to help the user know whats going on and how many tiles are in the deck still/how many are in other players hands.  How and when do I submit this?

Share this post

Link to post
Share on other sites

When you want (no rush) :)

Just send me a zipped folder so that I unzip it on the web server (or tar.gz, or whatever you want). It's better that you use the UTF-8 encoding what is the web server default encoding and it's better that you refer cdn or legacy versions of BJS and PEP js

example :

<script src=""></script>
<script src=""></script>
<script src=""></script>


Share this post

Link to post
Share on other sites
On 1/26/2018 at 7:48 AM, aFalcon said:

Mr Andrew, V...???. Cool game!

Yup my last name is Butt ^_^... 
and I wish I was cool enough to claim the game design but :

I just enabled the UI, and will finish it up and then activate all the win/loss calculations be the end of this week I hope.  Then it will technically be "done".

Share this post

Link to post
Share on other sites

Yas ^_^, Ok so after the path was placed, I baked their positions.  Then I set the values that I was comparing to a fixed decimal of 4 places (to fix for error margin). Then I test the players position to the available paths, skipping any paths that are on the tile the player was last on.  I need to go back and fix some of the paths here to cause the way I am animating them requires the straight lines to have intermediary points but that's another topic.

Here is the function that is doing it and some comments to explain whats happening.  Let me know if you have any questions.

_identifyPaths : function(){	
	var results = [];	
		for(var y=0; y<6; y++){
			for(var x=0; x<6; x++){

//Iterate through all map tiles

			var _t =[x][y];

//If no tile on that map position skip.            

	            for(var i=0; i<[x][y].paths.length; i++){
//Iterate through all paths on the tile		
                    for(var j=0; j<this.players.length; j++){
//Check all player positions for the paths on the tile						
						this.players[j].lastTile.x == x &&
						this.players[j].lastTile.y == y	
//If it was the last tile the player was on skip it.
//Otherwise get the players position and the path you are testing then I converted the lineMesh
//to a standard 3 step array. Get the start point and the end point.						
						var playerPos = this.players[j].mesh.position.clone();
						var path =[x][y].paths[i];
						var pathPoints = TSO.ConvertLineSystem2Array(path);
						var sp = new BABYLON.Vector3(pathPoints[0],pathPoints[1],pathPoints[2]);
						var ep = new BABYLON.Vector3(pathPoints[pathPoints.length-3],pathPoints[pathPoints.length-2],pathPoints[pathPoints.length-1]);

//Do the rounding to fix for slight variations in position values.
//and make sure they are a number.

						playerPos.x = Number(playerPos.x.toFixed(4));
						playerPos.z = Number(playerPos.z.toFixed(4));
						sp.x = Number(sp.x.toFixed(4));
						sp.z = Number(sp.z.toFixed(4));
						ep.x = Number(ep.x.toFixed(4));
						ep.z = Number(ep.z.toFixed(4));
//these are kind crappy, but if its on the start point they are on the forward version of the path,
//If they are on the end point they are on the reverse of the path.
//Create animation data, and push that to a stack.
						if(sp.x == playerPos.x && sp.z == playerPos.z){
							results.push({'player':this.players[j], 'path':pathPoints, 'dir':'forward', tileID:{x:x, y:y}, sp:sp, ep:ep});							
						if(ep.x == playerPos.x && ep.z == playerPos.z){
							results.push({'player':this.players[j], 'path':pathPoints, 'dir':'backwards', tileID:{x:x, y:y}, sp:ep, ep:sp});

//Process that stack

		this.turnPathInfo = results;
		this.state = 'run-path';


Share this post

Link to post
Share on other sites

so the path will normally hold its points as a local thing, so even if I move the path the coordinates stay the same because its local.
IE, if point 6 is at vec3(1,0,0); and we move the path 3 units in the x and check the point again it will read (1,0,0).  IF we move it and then bake in the current transformations with lineMesh.bakeCurrentTransformIntoVertices(); and then check point 6 it after moving the three units and baking it will read as (4,0,0).

This is just to simplify things because after the tile is placed it will never move again, but in the case that your paths constantly move, just add the linemesh position to the point position and it should be good unless you rotated or scaled, then there are other steps.

We did just kinda Hyjack @jerome's thread though and should move this conversation to a different post perhaps?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.