• entries
19
39
• views
18166

a browser game with mmorts elements along with a few rpg too.

## Node Loops

Hello GameDev, During my efforts to accomplish the last robust challenge of mine  I discovered a new way, for me, to speed up the processing time to achieve much faster path-finding results.

I created continues node loops,
Every node has information about the loop it's a member of.  Each Node has the following object: { id: 4, loop: 10, loopSize: 8, loopStart: 0, loopEnd: 7 } and the following functions:
left( x ){ if( this.id - x < this.loopStart ){ return ( this.id - x + this.loopSize ); } else { return ( this.id - x ); } } right( x ){ if( this.id + x > this.loopEnd ){ return ( this.id + x - this.loopSize ); } else { return ( this.id + x ); } } getDirection( n , M ){ var m = M || this.id; if( n - m > 0 ){ if( Math.abs( n - m - this.loopSize ) < ( n - m ) ){ return true; // to IDa } else { return false; // to IDb } } else { if( ( n - m + this.loopSize ) < Math.abs( n - m ) ){ return false; // to IDb } else { return true; // to IDa } } } getNodesBetween( n , M ){ var m = M || this.id; if( n - m > 0 ){ if( Math.abs( n - m - this.loopSize ) < ( n - m ) ){ return Math.abs( n - m - this.loopSize ); // to IDa } else { return ( n - m ); // to IDb } } else { if( ( n - m + this.loopSize ) < Math.abs( n - m ) ){ return ( n - m + this.loopSize ); // to IDb } else { return Math.abs( n - m ); // to IDa } } } With information about its parent loop accessible to each node, informed choices are possible about the nodes that should be tested for each subsequent iteration.
The following animated .gif visually demonstrates the logic. 1: Select Origin and Destination points
2: Check for collisions between them and determine node pairs ( Node pairs are nodes that are apart of the same loop )
3: Determine the smallest number of nodes between the node pairs, ( Are there fewer nodes if we travel left? or right? )
4: Check for collisions between Origin node and each incremental node apart of the loop. ( stop once collision is found )
5: Use last successful node tested as the new Origin point.
6: Check for collisions between Destination node and each incremental node apart of the loop. ( stop once collision i found )
7: Use last successful node tested as the new Destination point.
7. Repeat.
The Good,
It is much faster than using the blind search method I was using before, especially if both directions are searched when an obstacle is encountered.  If only one node loop is encountered it will return the shortest path with the addition of a refinement function.

It doesn't return the shortest path.  For that it has to be used in combination with other techniques and two new 'branches' of the function would be required for each unique node loop encountered.

## More Adventures in Robust Coding

Hello GameDev,  This entry is going to be a big one for me, and it's going to cover a lot.  What I plan to cover on my recent development journey is the following: 1 - Goal of this Blog entry. 2 - Lessons learned using Node.js for development and testing as opposed to Chrome console. 3 - Linear Path algorithm for any surface. 4 - Dynamic Path Finding using Nodes for any surface, incorporating user created, dynamic assets. 5 - short term goals for the game. -- - -- - -- - -- - -- - -- - Goal of this Blog entry - -- - -- - -- - -- - -- - -- My goal for this adventure is to create a dynamic path-finding algorithm so that:
- any AI that is to be moved will be able to compute the shortest path from any two points on the surface of the globe.
- the AI will navigate around bodies of water, vegetation, dynamic user assets such as buildings and walls.
- will compute path in less then 250 milliseconds. There are a few restrictions the AI will have to follow, in the image above you can see land masses that are cut off from one another via rivers and bodies of water are uniquely colored.  If an AI is on a land mass of one color, for now, it will only be able to move to a location on the same colored land mass.  However; there are some land masses that take up around 50% of the globe and have very intricate river systems.  So the intended goal is be able to have an AI be on one end of the larger land mass and find the shortest path to the opposite end within 250 milliseconds.

My immediate goals for the engine are as follows: // TO DO's // // Dec 26th 2017 // /* * << IN PROGRESS >> -update path node geometry so no errors occur * -improve path finding alg with new technique * -improve client AI display -only one geometry for high detail, and one for tetrahedron. * -create ability to select many AI at the same time by drawing a rectangle by holding mouse button. * -create animation server to recieve a path and process animation, and test out in client with updates. * -re-write geometry merging function so that the client vertices and faces have a connected Target ID * -incorporate dynamic asset functionality into client. * -create a farm and begin writing AI. * -program model clusters * -sychronize server and client AI. Test how many AI and how quickly AI can be updated. Determine rough estimate of number of players the server can support. * */ see the third last one!  That's the one, oh what a special day that'll be. I've created a Project page, please check it out.  It gives my best description to date of what the game is going to be about.  Originally I was going to name it 'Seed', a family member made the logo I use as my avatar and came up with the name back in 2014.  Then just this week I find out that some studio in Europe is making THE EXACT SAME GAME ! WHA???  http://www.pcgamer.com/seed-is-a-hugely-ambitious-in-development-mmo-that-echoes-eve-online-rimworld-and-the-sims/ I'm being facetious, but they're very close to being the same game.  Anyways, Mine will be better, you read it here first! hahaha.  The project is no longer going to be called Seed, it's instead going to be called what I've always called it and will probably always call it; the game [ edit: 02/02/18
Some new screen shots to show off.  All the new models were created by Brandross.
There are now three earth materials, clay, stone and marble.  There are also many types of animals and more tree types. ] Thanks for reading and if you've got anything to comment on I welcome it all. Awoken

## Ground work complete!

Hello GameDev, It's been awhile.  I decided to take some time away from screens and focus my time on camping, reading and getting outside.  As a result I've come back to this project with fresh ideas, renewed energy, and summer/fall was fantastic. Some big milestones for this project have been achieved:
- 10,000 AI can be simulated moving about a world without major performance issues in Chrome.

## Simulin

Well, here they are. As of right now, I can simulate the movement of 5000 Simulin simultaneously every frame with minor performance loss. ~1 to 4 frame loss every now and then. seems the minor performance loss is there regardless if it's 1000, 3000 or 5000 Simulin. I'm not sure how many can be simulated on screen at once, but both the browser and server can compute the position of 5000 comfortably. I added a bunch of optimisation code to bumb it up from 1500 to 5000. If I tone down the detail of the model I'll be able to display more yet too. Heck if I really wanted to I could just make a box and call it a Simulin, if I did that I could simulate 10000. Of course they don't do anything other than move like mindless drones. Walking over mountains and love to walk into the oceans never to return. I guess now I'll have to code where they can and can't go. Gonna dig up my old dynamic pathfinding alg and put it to work. What does everyone think? Do you like the look of them? They're kind of Roboty in my opinion, not sure if that's a good or bad thing. Cheers

## Rebuild

Rebuilding the project from scratch. Not all is lost though, I have a lot of world generation, path finding and asset creation logic already figured out. Currently I'm upgrading my skills via a website I'm not sure I can mention here, but basically it's called "something"-school. By the time I'm caught up to speed on coding concepts such as Closures, Hoisting, Classes and Modules I'll be better equipped to deliver a higher performing game. I am also going to use THREE.js' new library 84. Already it looks like the build allows for user created content to demand fewer resources. I'm also scraping my old linear approach to development. Previously I stuck to developing a new addition to the project like layers on a cake. Now I'm going to instead approach development like an inflating balloon. Each part necessary to the end game will be available upfront for development purposes and then the complexity of each will expand like the surface of a balloon. And most excitingly, I'm scrapping the old look. It's still going to have a very simplistic look, still lot's of triangles and stuff, but, scrapping the space look all together and focusing more on a world build that adheres to the theme of the game. I'll be incorporating custom shaders. I may not have much to show for a while, but I'll keep the community posted. Thanks for reading and have a great week.

## Z-model

Hi Everyone, so I created a modelling program, really basic, that can run in your browser.
I named it Z-model so that the file appeared last in the containing folder.
here is a zip of everything you need. Chrome works best

Here is a screen shot of the finished product.

There is also some instructions and a sample geometry you can import. It's of a tree.
Basically if anyone is interested in creating content for this game I'm looking for very low poly/face and vertices count models.
I'm thinking MAX face count will be around 48, and MAX vertices should be a round 36. That's for static models like trees and what not.
If you're interested in Designing an animal, it should be no more than 20 vertices and 24 faces. The fewer the better.
Copy the export text and post it here in this thread if you'd like and I'll mention your name or avatar name each time I post future pictures of my game that features your work. For now, I'm thinking I'm not going to get a lot of attention, if you actually take the time to design something for this game, I will include it in all future builds. So there is a degree of trust here on both sides. :D[color=rgb(40,40,40)][font='Helvetica Neue'][background=rgb(250,251,252)] [ EDIT 21/02/17 ] ::: Scaling[/background][/font][/color][color=rgb(40,40,40)][font='Helvetica Neue'][background=rgb(250,251,252)] I forgot to mention anything about the scale of the modeling program. The working area is a 20 x 20 x 20 "foot" zone, I believe I have the camera set up to rotate around out at about 26 feet so to say. So if you're making a 50' tree just make it about half the size relatively speaking and I can easily scale it up on my end. Maybe just let me know your intended scale 1:2 or 1:3.[/background][/font][/color] Feel free to comment or critique my program.

## Weekly update #3: Terrain manipulation and foundation creation.

O.k, so last week I made a post on Thursday detailing the progress I made with regards to terrain manipulation, but I only previewed it and never actually committed to a submit, so I just chucked it up to a bad day. Over the past couple weeks I've been programming a lot, especially this week. I think so far I've logged 20hr of sit down time, which it's quite remarkable what I've been able to achieve in this short amount of time. Some pictures to show what I've accomplished:

In the picture above you can see the world is divided into 68 shapes of proportional size and shape, kinda like a squished cross or something.
in order to maximise the detail and minimise the processing power I divided the world up into these shapes and then depending on where the camera is located determines which shapes are visible at a given time. So as you zoom around the world, very fluidly, it seems as though the whole world is loaded, but nah, just a few shapes. And of course the closer you zoom into the world the fewer and fewer shapes the system has to process. Nothing new in that respect, did this part months ago but, now I've created buffer geometry, not THREE.BufferGeometry, but rather geometry that is buffered into memory with a defined vertices and face count. the total vertices and faces never change, only the location of vertices and faces. Each of the 68 world geometries is paired with it's own buffer Geometry. From this buffered geometry comes dynamic user assets and also plants, minerals and stuff, as it stands, each shape should be able to host about 1000 unique objects of varying complexity, no Notre-Dame but sufficient for what I'm going for. Oh and each buffered geometry currently has two material types, plain and metal, but this can easily be scaled up. Very proud of this.
Now on to terrain manipulation So in the above screen shot we see a plot of land to be edited.
Now we see the land has been curved, it can also be flattened, the surface color has been changed just for reference, I'll likely keep some aesthetic aspect to this, but haven't settled on a color or idea yet.
Here we see a thin foundation laid over top the surface. This foundation has a plane from which all walls will orient themselves if a structure is to be built on this pad, as in all walls will be perpendicular to the surface of the foundation.
And here we see me playing around with the foundation menu and some of the 'solid' structures that are possible. the two shown and many others are possible with my dynamic asset creator. No need to resort to a predefined list of assets, you can make your own pyramid or what ever. Not only that, the AI will dynamically interact with your created assets as well, walking on their floors, climbing up their stairs, maybe even sleeping in one or two of them depending, but first the little buggers will have to build your masterpiece. The little spec in between the two structures, that is the size of an AI, of course you have a better view of it zoomed in more, but right now it's just an stretched box. Please feel free to comment or ask questions.
:D [ added content 27/01/17 ]

## Orientation Vector

The past couple weeks I've been working on a custom class which I call an Ovector, or Orientation Vector. It's builds off of the THREE.js Vector3() class. With the Ovector Class I can identify any three dimensional position in the scene, and then orientate it by giving it a direction to face, and an up axis so it orientates itself accordingly. The beauty of this class is that it has an internal InheritFrom function that acts a lot like lego blocks. Each new Ovector builds off of a previous Ovector. The inheritFrom function asks for the following:[code=js:1]inheritFrom( x , distance , rotation , F1 , F2 , plane )// x: is the direction GP vector for the next position// F1: is the origin GP vector for the next pointAt vector// F2: is the direction GP vecotr for the next pointAt vector// this.position and x draw a line, so do F1 and F2.
In the following pictures each Ovector is displayed with Arrows, Blue for Up, Red for Front, White for Right.
The picture above was generated by the code below.[code=js:1]var vv = new Ovector( $m.rO($m.v( $m.rN() ,$m.rN() , $m.rN() ).normalize().multiplyScalar(11) ,$m.v() , 0 , 10 , TGglobalMesh , 0 ).point.clone() , editorParameters.unitScale /*, undefined , zz */ );var ww = vv.inheritFrom( vv.up , 50 , 0 , vv.front , vv.topFront , vv.normal );var yy = []; yy[0] = ww.inheritFrom( ww.front , 100 , 0 , ww.position , ww.front );for( var i=1; i = yy[i-1].inheritFrom( yy[i-1].front , 100 , (i*i /100)+1 , yy[i-1].position , yy[i-1].front );}
The newly created Ovectors do not inherit an orientation Plane to align themselves to, so they align to the surface to of the sphere instead.

In the picture above the same Ovectors are given a plane which to fix themselves to.
All that is added to the code is the following:[code=js:8] yy = yy[i-1].inheritFrom( yy[i-1].front , 100 , (i*i /100)+1 , yy[i-1].position , yy[i-1].front , vv.plane );
This custom class will greatly speed up my dynamic Asset creating component and will also make it easy to construct stuff.

## Weekly update #1

So this past week I spent some time trying to make the game look more appealing. Though I am dealing with very simple visuals I'd ideally like to come up with an art style, as I move along, that suites the simplicity of what is presented making the simple visuals aesthetically appealing.
So very quickly I've added a bit more world generation code to produce the following.

So as you can see the hills are starting to look a little more like hills, the mountains are a little more obvious by their color and style and there is now sand/beach near the water. Of course still missing from this world is vegetation and wildlife, this will be one of the last elements I add simply because it will be very easy but time consuming do to it being artistic in scope.
Now a bit about the coding logic I developed.
So I'm using THREE.js which is a javascript API which allows me to directly manipulate the HTML 5 canvas element and take advantage of WebGL functionality. Currently Google Chrome is the best browser performance wise which is why I use it. Firefox unfortunately is slow in comparison. I'm not picking sides, just stating the facts.
Now it THREE.js there are 4 classes to make a visual element within the canvas element. I'm sure many of you are already familiar with these as they are probably universal across many languages.
THREE.Vector3() contains the x,y,z position of a vector is 3D space.
THREE.Face3() is comprised of 3 vectors,
THREE.Geometry() faces are then drawn and visual on the, counter-clockwise vector order, plane of each face. The geometry class contains a vector and face array.
THREE.Mesh() is comprised of a single geometry and a material class(). It is the Mesh that you see visible. The mesh can then be scaled and rotated and such but it's basic parts remain intact.
For the world generation I start with a geometric primitive, an Icosahedron.

Then I add a few custom variables to each of the vector and face classes of each of the twenty faces and tweleve vectors respectively.

I'll do my best to try and describe what I've done.
to each of the vector and face classes I've assigned a unique id, just 0 to how many ever vectors/faces there are.
the three most important additions are the l array, s array and cv array. The names of which are kind of arbitrary, I just like short and simple variable names. "L" stands for "draw order" for drawing each face, "S" stands for the "unique id" for each connecting face. "CV" stands for "draw order vector id's".
the most important part is the addition of "L". Because what you don't see in my diagram 'forgot' is that the actual index position of connecting face s and cv arrays correspond to one another. That means if face id:1 has the information about face id:2 in it's 0 index position, so will face id:2 have it's information about face id:1 in index position 0. Then the draw order is preserved via the addition of "L".
A sample of the draw order looks like[code=js:1]var f = g.faces;// to draw a sample facevar F = new THREE.Face3( f.cv[f.l[0]].a , f.cv[f.l[1]].a , f.cv[f.l[2]].a );// in this example F and f are identical but when ever f.s or f.cv is called up// it always contains the f.l[] array for reference. Now to generate a world each of the twenty faces of the original icosahedron, with their respective encoded information about it's surrounding faces, is subdivided into nine pieces twice, then 4 pieces three to four times. The images in this post are three divisions into 4 pieces. While it subdivides the information about each new face and it's surroundings is updated and inherited, like the the case of "S" and "L" respectively. This reduces the number of "if" statements for the initial geometry that is created "a big ball", theoretically I think I could eliminate all 'if' statements, and with my system I can create this big ball of many 100,000's of faces in less than 2 seconds. Then built off of this basic geometry it is very easy to manipulate the ball and contort it as I see fit because so much information is embedded in it. This comes in handy, actually is critical, to being able to display thousands of moving objects across any path along the world later on. But I'll talk more about that once I'm done with the AI generation. Oh one last note, current world generation time with everything included on the last build is 7.5 seconds.
Anyways, thanks for taking the time to read if you did.
Also, I'd love to hear any advice or comments about the look, the art style is my Achilles heal and I'm worried about it.
Thanks and Merry Christmas,
Awoken.

## Priority Number 1

I'm going to do it.
I've always wanted to realize this game, I want to see it through to its completion. Up until this date I've treated it like a hobby, something I did in my casual spare time, when I felt like it. I rarely get a chance to talk about my idea to others, and when I do I self-bash it by prefixing with "It's pipe dream", and "It'll probably be a shitty game nobody likes, and I fully expect that!" But then by the time I'm done talking about the idea I'm all excited and think to myself "What a great idea!". The other day I was thinking about people who just went balls to the wall because they truly believed in what they were doing and asked myself why haven't I?
I will be posting weekly updates on the progress on my game, and I will try to contribute something more to my journals than "Look at this little thing I made". to "This is how I did it!". Thank you for taking the time to read my post.

:) :) :) So I am very please because, fingers crossed, after working on this one function for more than two months I think I've finally got it. The goal was the create a function that would draw a path of white arrows, refer to the pictures for visuals, between any two points selected by either a user or at random on the surface of a dynamically generated world. But not just once, ten times or even a thousand times but every-time, or 99.99999...% of the time. At first errors would pop up after I had randomly picked 10 or 20 paths to draw, but soon I could click, click, click for a good 30 seconds and nothing, no errors. So I decided to create a function that would just randomly make paths for me, right? I know!
And that would return errors after maybe a few hundred paths tested. Then I'd sort this out or that in my code and repeat and soon I could run the function a thousand times before an error would pop up. After a while I'd get a few thousand paths tested with no errors and so I'd up the detail of my world and see if the function would work on a dynamic surface as opposed to a flat uniform surface. And then again back to errors after just 10 or 20 paths. And this cycle continued, and continued... Soon I was running the function to test hundreds of thousands of paths taking hours and hours and only after hundreds of thousands of paths had been tested would and error pop up for me to see and analyse. and now at the time of writing, still testing though, I am pretty confident I have finally met the robust challenge! :cool:
now of course I'm not 100% sure that it's perfect, I can never be certain because their are technically too many paths to be tested to count.
an example of a path to test is as follows
Sx:0.8925261008176053y:-6.462897144580008z:6.1995026343584705Ex:-0.9157777460656384y:6.468354322279517z:-6.190324704587636
but, if it can get to a million that It should be able to get to a billion. This is good because this particular function is key to my game and it will run billions of times over the course of a single game so it only makes sense that it can handle what ever is thrown at it. [side note: the coordinates to the path I listed above were actual the coordinates of the last error I encountered. Interestingly if you look at them the Starting x,y,z's and Ending x,y,z's are almost exactly opposite, thus opposite sides of the sphere, and of course my code up until that error could not handle such an odd circumstance because it threw my distance calculations off ] EDIT: I LIED, IT FAILED,
back to the dungeon with my scrimbly board :blink:

## Update

I was going to hold off until I was done most of the components of my game engine, if you can call it a game engine, but am too excited to wait as it will be another year at least. The big 5:
-** Just finished geometry grouping and am able to render a world of over 800,000 faces seamlessly. no performance loss, 60 fps. **
- currently working on updating my asset creator. dynamic and able to create roads/paths, walls and buildings.
-** able to simulate over 1500 on screen actors, actors being simulated people. This was really the projects Achilles heel; I am in theory able to go up to 5000 independently simulated people. With more connected severs perhaps more ??? **
- path finding, currently I created an algorithm that allows all actors to move around dynamically placed assets however it is not efficient( shortest distance ). I have ideas to make it more efficient but it is a processing beast. much work to be done.
- allow up to ? 50 ? players to create and register accounts on a server and influence actor movements, currently have code that would allow testing such connectivity. Well there you have it. most of my efforts are focused on how this game functions not so much how it looks. I figure one could lose themselves in an abyss of endless time if they focus to much on art.

## Progress thus far

Added better stars, moon and sun.
made a simple continent function and made the ocean a bit transparent. Been spending most of my time programming background stuff that makes stuff work rather than making it look pretty.
Soon, very soon, moving things will be able to move around any fixed obstacle dynamically towards its destination. Made a background server which integrates clients.
right now a connected user has a blue box, other connected users are red.
each user can move their box around. But once and awhile when I'm bored I make it look nice-er.
I'm going for a hard edge look, limited by resources available to WebGL and scale of what I'm trying to achieve. Let me know what you think of the style.

## Update and a bit more about the idea

Hello

So I literally just finished up synchronizing all of the clients so that when one client moves a cube or 'actor' all other connected clients see the movement.
The picture I posted is of three separate clients all moving their own respective actor 'the blue one' to the same spot on the world.

Next step will be to program a dynamic path finding algorithm so that each actor can navigate around obstacles as they travel around the world.

After that I program fish and lions. The actors will then hunt for fish and run from lions. Fish will just randomly swim around and lions will keep an eye out for actors and try to catch one and eat it.

## List of things done and things to come

So this game has been a hobby of mine and I've set certain goals over the year and have achieved each one so far. We'll see how long this can go on for. Accomplished goals - create algorithm to generate an icosahedron of any number of faces (divisible by 80): with my own algorithm I figured that I would be better able to manipulate the icosahedron and thus better able to use the algorithm to create dynamic worlds.  future goal: create a more realistic dynamically generated worlds - allow camera to move around world/sphere freely. Thus no real 'UP' direction other than that which is relative to the cameras view.
- allow something similar to a camera hot key. Basically allowing the user to assign views(camera zoom and location) and retrieve them with ease.
- create a box and have the box move along the sphere while sticking to the terrain of the sphere. Kind-of simulating gravity I guess.
- select starting and ending points and generate a 'wall' of some size that contours to the surface of the world.
- create server and client sides. client in browser, server in terminal and have the two of them talking with each other successfully.
- create many servers all talkin to each other.
- synchronize the experience of any browser with the server when the browser regains focus.
- come up with potential name and logo for the game. As you can see some pretty basic stuff. But I'm teaching myself as I go. Future Goals (short term ~ early new year) - box collision detects with walls and other world obstacles (this part should be easy as the box already collision detects with the sphere.)
- box uses a combination of dropping nodes and pathfinding between nodes to learn and navigate around its world. (I've already created a simple pathfinding algorithm for a different game I made and now just need to feed it up.)
- develop user registry/login and game session retrieval. To allow users to participate in my game of course.
- and then much much more. Check out my first album with some pictures and little blurbs about each.

## Gotta start somewhere

Hello curious dwellers of gamedev, I'm much like you

I'm making a game that will run in a web browser, chrome for the best experience, and the game's going to try to be a lot of things.
the game wants to be cool, awesome and wicked, basically one of those games that you would be excited to tell your friends about.
It's this excitement I speak of that fuels my creativity.
There is a lot to this idea and writing about it, boring you with pages of reading material, will put me to sleep. Me... I like big ideas, especially if they're my big ideas, unless of course your idea is bigger.
I have a cat, he eats a lot.

------------------------------------------------ THE GAME ------------------------------------------------ For now I just refer to it as the game. I have a title in mind, but it's written on a piece of paper locked in a safe somewhere. The entry image is suppose to be a world. As of right now you can pan around it, rotate your view and zoom in and out of the world. A box moves along the surface, and you can make what I call 'walls'. nifty. I'm using Three.js and node.js,   I'll have more in the future. Thanks for taking a peek.

×

## Important Information

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!