Jump to content
  • Advertisement

Search the Community

Showing results for tags 'Javascript'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • Game Dev Loadout
  • Game Dev Unchained

Categories

  • Game Developers Conference
    • GDC 2017
    • GDC 2018
  • Power-Up Digital Games Conference
    • PDGC I: Words of Wisdom
    • PDGC II: The Devs Strike Back
    • PDGC III: Syntax Error

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Critique and Feedback
  • Community
    • GameDev Challenges
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Topical
    • Virtual and Augmented Reality
    • News
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical
  • GameDev Challenges's Topics
  • For Beginners's Forum

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams
  • GameDev Challenges's Schedule

Blogs

There are no results to display.

There are no results to display.

Product Groups

  • Advertisements
  • GameDev Gear

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Website


Role


Twitter


Github


Twitch


Steam

Found 76 results

  1. Greedy Goblin

    State Changes

    Games usually (if not always) require some way to manage state changes... and I'm sure most of you (if not all of you) know far more about State Machines than I do. And I'm certain that I could learn a heck of lot from reading up about the subject to build a state machine that works beautifully and makes my code look amazing etc etc. Pfft.. never mind all that... I'm building this game 'off the cuff' as it were, making it up as I go along and following the principle of 'I build what I need when I need it and only insofar that it adequately fulfils the requirements at that time'. I don't try to plan ahead (not in any granular sense anyway), I'm not building a reusable one-size-fits-all game engine, I'm not trying to make the code beautfiul, or win any awards or even make any money from the darn thing. It just needs to perform well enough for what I want it to do. So my immediate requirement is that I have a way to manage the player switching from walking to running to whatever. If I can use it elsewhere for other things then great... and I'll be honest, I do like reusable code so I tend to naturally sway toward that. What I'm trying to avoid is getting myself stuck in a rut, spending weeks/months deliberating over the smallest details because it's got to be 'perfect' and then realising I've still got 99.5% of the game to build! Quick and dirty is OK in my world. I often approach things from a top-down perspective. This boils down to: 'How do I want to instruct the computer to do x, y or z?' So for this particular requirement, how do I want to instruct the game that the player can change from walking to running and running to walking, or walking/running to falling (assuming I make that a player state - which I do), but not from sleeping to running for example? Hell, I don't even know all the states that I want yet, but these are the ones I have a feel for so far: Walking Running Skiiing Driving Falling Drowning Sleeping Eating Introducing 'When' I thought it might be nice to be able to write something like this in my player setup: // Configure valid player state transitions When( this.playerState ).changes().from( PLAYER_STATES.WALKING ).to( PLAYER_STATES.RUNNING ).then( function () { } ); When( this.playerState ).changes().from( PLAYER_STATES.RUNNING ).to( PLAYER_STATES.WALKING ).then( function () { } ); When( this.playerState ).changes().from( PLAYER_STATES.WALKING ).to( PLAYER_STATES.SKIING ).then( function () { } ); When( this.playerState ).changes().from( PLAYER_STATES.SKIING ).to( PLAYER_STATES.WALKING ).then( function () { } ); When( this.playerState ).changes().from( PLAYER_STATES.WALKING, PLAYER_STATES.RUNNING, PLAYER_STATES.SKIING ).to( PLAYER_STATES.FALLING ).then( function () { } ); There's probably a library for something like this out there, but heck, where's the fun in that?! So I create a new 'Stateful' object that represents a state (in this case the playerState) and it's allowed transitions and a 'When' function so I can write the code exactly as above: const Stateful = function () { } Stateful.isStateful = function ( obj ) { return obj.constructor && obj.constructor.name === Stateful.name; } Stateful.areEqual = function ( v1, v2 ) { return v1.equals ? v1.equals( v2 ) : v1 == v2; } Stateful.prototype = { constructor: Stateful, set: function ( v ) { let newState = typeof ( v ) === "function" ? new v() : v; for ( let i = 0; i < this.transitions.length; i++ ) { let transition = this.transitions[i]; if ( transition && typeof ( transition.callback ) === "function" ) { let fromMatch = Stateful.areEqual( transition.vFrom, this ); let toMatch = Stateful.areEqual( transition.vTo, newState ); if ( fromMatch && toMatch ) { // We can only change to the new state if a valid transition exists. this.previousState = Object.assign( Object.create( {} ), this ); Object.assign( this, newState ); transition.callback( this.previousState, this ); } } } }, transitions: Object.create( Object.assign( Array.prototype, { from: function ( vFrom ) { this.vFrom = typeof ( vFrom ) === "function" ? new vFrom() : vFrom; return this; }, to: function ( vTo ) { this.vTo = typeof ( vTo ) === "function" ? new vTo() : vTo; return this; }, remove: function ( fn ) { this.vFrom = this.vFrom === undefined ? { equals: function () { return true; } } : this.vFrom; this.vTo = this.vTo === undefined ? { equals: function () { return true; } } : this.vTo; for ( let i = 0; i < this.length; i++ ) { let transition = this[i]; let fromMatch = Stateful.areEqual( this.vFrom, transition.vFrom ); let toMatch = Stateful.areEqual( this.vTo, transition.vTo ); let fnMatch = fn === undefined ? true : transition.callback == fn; if ( fromMatch && toMatch & fnMatch ) { delete this[i]; } } } } ) ) } function When( statefulObj ) { if ( !Stateful.isStateful( statefulObj ) ) { throw "Argument must be a Stateful object"; } return { changes: function () { return { from: function ( ...vFrom ) { this.vFrom = vFrom; return this; }, to: function ( ...vTo ) { this.vTo = vTo; return this; }, then: function ( fn ) { if ( typeof ( fn ) === "function" ) { this.vFrom = this.vFrom === undefined ? [true] : this.vFrom; this.vTo = this.vTo === undefined ? [true] : this.vTo; for ( let i = 0; i < this.vFrom.length; i++ ) { for ( let j = 0; j < this.vTo.length; j++ ) { statefulObj.transitions.push( { vFrom: typeof ( this.vFrom[i] ) === "function" ? new this.vFrom[i]() : this.vFrom[i], vTo: typeof ( this.vTo[j] ) === "function" ? new this.vTo[j]() : this.vTo[j], callback: fn } ); } } } else { throw "Supplied argument must be a function"; } } }; } } } I drop the aforementioned 'When' statements into my Player setup and remove the old 'If' statements that were previously controlling changes between walking and running and insert the new playerState.set() calls where appropriate. e.g. "run": ( pc, keyup ) => { if ( keyup ) { _this.player.playerState.set( PLAYER_STATES.WALKING ); } else { _this.player.playerState.set( PLAYER_STATES.RUNNING ); } } And it seems to work! (Yes I was actually surprised by that) 😂 TheBerg-StateChanges.mp4 p.s. I've switched to using Bandicam for screen capture as it seems far superior to what I was using previously.
  2. Awoken

    Server(s) Side

    Hello GameDev, I've been busy working on Dynamic Assets. In order to successfully incorporate them this time around I've needed to include a whole host of programming across all the servers for this game and I thought 'why not do a blog about the servers'. I've never programmed a server before this project and really have no idea what I'm doing. I just get stuff working and I'm happy. But seems Node.js is very intuitive and it is so simple that you don't need to be a rocket scientist to figure stuff out. But a quick overview of my servers and why I have 3 so far and will probably have 5 or 6. Relay Server The relay server hosts the website and is responsible for user authentication and what-nots. While users are connected to the simulation the relay acts as a relay ( imagine that ) between all the clients and the back-end servers. It relies on socket.io to communicate with the clients and zeromq to communicate with the back-end servers. Data Server The data server holds a static version of the world and all it's contents. It's purpose is to provide all the information needed to a newly connected client. This way the demand for data isn't hampered by newly connected clients while the simulation is running. Of course it needs occasional updates and the terrain changes and the assets change. And soon too updated Simulin positions. Simulation Server This hosts the path-finding and tiny bits of user functionality that I've Incorporated thus far. But basically the simulation server is the work-horse behind the simulation, or at least will be. I plan on breaking this up into 3 separate servers. My wish list is to have 2 path-finding servers which each host world information necessary to path-finding and then requests are toggled between the two ( cut my pathfinding time in half ). And an AI server which will handle what it is the Simulin are doing. -------------------------------------------------- Now my assumption is that each new instance of a Node.js server will utilise it's own processing core? Am I wrong about this? I sure hope not because I figure that if I break the needs of the project over multiple servers it will make better use of a computers abilities. Maybe each Node.js server will operate in parallel? Because I'm using many different servers to do all the stuff I need to do it's taking a much longer time to program all this. Plus, I recently switched all my THREE.js geometry over to buffergeometry. The servers hold world data information according to vertex objects and face objects, but the clients hold world information according to buffer arrays which require a little trickery to update correctly. Keeps me on my toes. ----------------------------------------------------- Anyways, here's some video's to check out of my website And here is a video of three connected clients. One client is adding stuff to the world, the other two are receiving the updated content. from a different perspective. Thanks for checking it out!
  3. Val Valentino

    Browser Game Fishes

    I've developed a browser game that I do not intend to sell and I'm looking for an investor to help me with advertising and upgrading. Languages: PHP7, HTML, JS, Jquery Database: MySQL FrameWork: Laravel Anyone who wants more information, write on PM
  4. Greedy Goblin

    Slopey McSlopeface (part 2)

    Having played around with the character movement a bit more I realised I was doing many things wrong. Not that I had ever intended to do things perfectly, but the slope handling just wasn't up to scratch. I had acceleration working, but deceleration didn't due to the way I had built things. So I decided to do a little bit of an overhaul of the player movement system. Nothing too major it turns out but I now have both acceleration and deceleration working very nicely and it gives a much smoother feel to the controls. It's subtle but necessary in my opinion. There is one aspect of slopes that I haven't tackled yet though and that is falling, tumbling or sliding on steep slopes. As I'm not using any fancy physics engine my player character is essentially glued to the terrain like it's on rails. It's not really an issue in so far as jumping is concerned because I don't intend to have any jumping ability in the game. However, I decided that I didn't want to artificially prevent the player from walking off the edge of a cliff so I need some form of falling action (and tumbling if you run down a steep slope too fast - potentially injuring yourself). So what I've done is add forces into my CollisionBody class to represent an accelerant force due to gravity. But to keep my brain from imploding over the quirks of simulating physics (and so as not to have to implement a full-blown physics engine) I decided to half keep the on-rails aspect by doing this: if ( obj.collisionBody.position.y <= targetPos.y ) { obj.collisionBody.position.y = targetPos.y; obj.collisionBody.resetForces(); } else { // Apply gravity obj.collisionBody.applyForce( new Force( DEFAULT_VECTORS.down, _this.gAcceleration ) ); } Where 'targetPos' is the ground position. So if the player is in contact with the ground or moves below it, then they player will just snap back to the precise point on the terrain. It's only when the player goes above the terrain (into the air) that gravity comes into play. This helps keep things nice and simple and gives a nice feel to the movement. Oh and I've also added in some 'head-bobbing' to add a bit of realism to the movement. Overall it gives a really nice result.... and I can now fall off cliffs... You may also notice that the camera rotation is now much smoother too as I now 'slerp' between rotations rather than doing absolute movements, although my screen recording software doesn't do it justice in the video above.
  5. Dear Gamedev.net members, I'm sorry to be asking in Javascript, but it is the only language I'm working with currently. I am hoping that the code is simple enough for you to understand what it is doing. I'm trying to rotate a cube so that dragging down always rotates the object around the world X axis, and dragging to the side always rotates the object around the world Y axis no matter the rotation of the object. I've seen this example which achieves the exact behavior I am looking for: https://jsfiddle.net/MadLittleMods/n6u6asza/ And then, here's my jsFiddle code that I'm having trouble with: http://jsfiddle.net/9sqvp52u/ I saw this stackoverflow answer: https://stackoverflow.com/questions/45091505/opengl-transforming-objects-with-multiple-rotations-of-different-axis But I still don't understand what I'm doing wrong. I think I'm still multiplying the rotation matrix to the left side of the object matrix in my code, but the object is always just rotating around its local axis. I learned how the transformation matrix works and how quaternion works but I feel like I am still missing something crucial here. I would really appreciate your help. Thank you.
  6. I am creating an endless runner, please see my code here: https://codepen.io/clownhead/pen/BqyqOm At the moment when the left arrow key is pressed the player moves left, the camera follows him so he does not go off screen and the ground tiles below the player are destroyed as they move out of the world bounds on the right and are recreated just before they move into the world bounds on the left. This allows him to keep running forever without running out of ground and works perfectly, but with one problem: I want the player to be running to the right of the game, NOT to the left. Please note I do not need the player to be able to move both ways. I can make the camera follow the player to the right instead of the left by doing the following: I remove the negative from -this in this.world.setBounds(-this.player.xChange, 0, ...); so it becomes this.world.setBounds(this.player.xChange, 0, ...); Now when the right arrow key is pressed the camera follows the player as he runs right so he does not go off screen, but the ground tiles do not regenerate and he runs out of ground. So basically I need to reverse the direction in which the ground is regenerating but I can't figure out how to do it. As everything is working to the left, I am sure it's a few simple settings, perhaps some negatives that need to be made positive? I have tried all that I can think of but I can't get it to work. I think the key to solving this might be in these lines: this.platforms.forEachAlive( function( elem ) { this.platformXMin = Math.min( this.platformXMin, elem.x ); if( elem.x > this.camera.x + this.game.width ) { elem.kill(); this.platformsCreateOne( this.platformXMin - 70, this.world.height - 50, 50 ); } }, this ); I have tried changing all sorts of settings there, but I can't seem to get it to work. I am new to Phaser and still learning Javascript. Is anyone able to see an obvious solution? I'd be so grateful. Thanks in advance for any help!
  7. I have a background image and a separate ground image that I want to repeat as long as the character is moving forward. When the character stops, the background and ground should not be moving. Basically I am creating an endless runner. For similar games it is often suggested to add this.game.background.tilePosition.x -= 1to the update function. This is not what I am looking for as it makes the background constantly move regardless of whether the character is moving. At the moment my background and ground images are repeating, but they are restricted to this.game.world.setBounds(0, 0, 1280, 800);. Any suggestions would be greatly appreciated as I have been at this for days, and I am sure there must be a simple solution. Please see my code below: function Hero(game, x, y) { Phaser.Sprite.call(this, game, x, y, 'player'); this.anchor.set(0.5, 0.5); this.game.physics.enable(this); this.body.collideWorldBounds = false; this.animations.add('stop', [0]); this.animations.add('run', [1, 2, 3, 4, 5], 14, true); // 14fps looped this.animations.add('jump', [6]); this.animations.add('fall', [7]); this.animations.add('die', [8, 9, 8, 9, 8, 9, 8, 9], 12); // 12fps no loop } Hero.prototype = Object.create(Phaser.Sprite.prototype); Hero.prototype.constructor = Hero; Hero.prototype.move = function (direction) { const SPEED = 200; this.body.velocity.x = direction * SPEED; if (this.body.velocity.x < 0) { this.scale.x = -1; } else if (this.body.velocity.x > 0) { this.scale.x = 1; } }; Hero.prototype.jump = function () { const JUMP_SPEED = 600; let canJump = this.body.touching.down; if (canJump) { this.body.velocity.y = -JUMP_SPEED; } return canJump; }; Hero.prototype.bounce = function () { const BOUNCE_SPEED = 200; this.body.velocity.y = -BOUNCE_SPEED; }; Hero.prototype.update = function () { // update sprite animation, if it needs changing let animationName = this._getAnimationName(); if (this.animations.name !== animationName) { this.animations.play(animationName); } }; Hero.prototype.die = function () { this.alive = false; this.body.enable = false; this.animations.play('die').onComplete.addOnce(function () { this.kill(); }, this); }; Hero.prototype._getAnimationName = function () { let name = 'stop'; // default animation if (!this.alive) { name = 'die'; } else if (this.body.velocity.y > 0 && !this.body.touching.down) { name = 'fall'; } else if (this.body.velocity.y < 0) { name = 'jump'; } else if (this.body.velocity.x !== 0 && this.body.touching.down ) { name = 'run'; } return name; PlayState = {}; PlayState.init = function () { this.game.renderer.renderSession.roundPixels = true; this.keys = this.game.input.keyboard.addKeys({ left: Phaser.KeyCode.LEFT, right: Phaser.KeyCode.RIGHT, up: Phaser.KeyCode.UP }; PlayState.preload = function () { this.game.load.json('level:1', 'data/level01.json'); this.game.load.image('ground', 'images/ground.png'); // I need this to repeat infinitely this.game.load.image('background', 'images/background.png'); // I need this to repeat infinitely this.game.load.spritesheet('player', 'images/player.png', 64, 64); }; PlayState.create = function () { this.game.world.setBounds(0, 0, 1280, 800); this.game.background = this.game.add.tileSprite(0, 0, this.game.world.width, 800, 'background'); this.game.ground = this.game.add.tileSprite(0, 680, this.game.world.width, 166, 'ground'); this.game.physics.arcade.enable(this.game.ground); this.game.ground.body.immovable = true; this.game.ground.body.allowGravity = false; this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this._loadLevel(this.game.cache.getJSON('level:1')); }; PlayState.update = function () { this.physics.arcade.collide(this.player, this.game.ground); this._handleInput(); }; PlayState._handleInput = function () { if (this.keys.up.isDown) { this.player.jump(); } else if (this.keys.right.isDown) { // move player right this.player.move(1); } else if (this.keys.left.isDown) { // move player left this.player.move(-1); } else { // stop this.player.move(0); } }; PlayState._loadLevel = function (data) { this._spawnPlayer({player: data.player}); const GRAVITY = 1200; this.game.physics.arcade.gravity.y = GRAVITY; }; PlayState._spawnPlayer = function (data) { this.player = new Hero(this.game, data.player.x, data.player.y); this.game.add.existing(this.player); this.game.camera.follow(this.player, Phaser.Camera.FOLLOW_PLATFORMER); }; window.onload = function () { let game = new Phaser.Game(866, 520, Phaser.CANVAS, 'game'); game.state.add('play', PlayState); game.state.start('play'); };
  8. Game developers will be able to become pioneers in the development of decentralized games for the gambling industry using DAO.Casino protocol. On September 17, 2018, DAO.Casino is opening Sandbox for developers, independent teams and game development studios that choose to harness the power of the rapidly developing DApp industry. Starting today everyone may submit their application for Sandbox on the official Sandbox page. The Sandbox project is designed by DAO.Casino developers. Participants of Sandbox will learn the basics of decentralized applications development on DAO.Casino protocol. Developers participating in Sandbox will learn to create, design and deploy decentralized games and applications on Ethereum blockchain. DAO.Casino is planning to reward most active developers for their constructive feedback on the improvement and optimization of the SDK and related documentation. The company will separately announce the details of the rewards program later this fall. “We are confident that the Sandbox project will play an important role in our collaboration with studios and independent game developers. We cannot wait to see our product helping developers unleash their creative and entrepreneurial talents and apply those to one of the most groundbreaking technologies of the XXI century. — states Ilya Tarutov, CEO, DAO.Casino. – I am sure that the products we’re developing will transform the online gambling into a fair and transparent industry for all of the involved parties: casino operators, developers, and affiliate marketers. “ “We are launching the Sandbox with the goal of enabling as many developers as possible to learn to create decentralized games. We have achieved an important milestone by starting to accept applications from developers all around the world who share our idea to make online gambling fair and transparent. With our technology, developers can take the whole gambling industry to the next level” – says Alexandra Fetisova from DAO.Casino. DAO.Casino is disrupting the online gambling industry by developing the protocol based on Ethereum blockchain technology. The protocol ensures the automation of transactions and facilitates interactions between all the industry participants: casino operators, game developers, and affiliate marketers. DAO.Casino team is fully dedicated to developing the best products and making the gambling industry a better place. View full story
  9. Game developers will be able to become pioneers in the development of decentralized games for the gambling industry using DAO.Casino protocol. On September 17, 2018, DAO.Casino is opening Sandbox for developers, independent teams and game development studios that choose to harness the power of the rapidly developing DApp industry. Starting today everyone may submit their application for Sandbox on the official Sandbox page. The Sandbox project is designed by DAO.Casino developers. Participants of Sandbox will learn the basics of decentralized applications development on DAO.Casino protocol. Developers participating in Sandbox will learn to create, design and deploy decentralized games and applications on Ethereum blockchain. DAO.Casino is planning to reward most active developers for their constructive feedback on the improvement and optimization of the SDK and related documentation. The company will separately announce the details of the rewards program later this fall. “We are confident that the Sandbox project will play an important role in our collaboration with studios and independent game developers. We cannot wait to see our product helping developers unleash their creative and entrepreneurial talents and apply those to one of the most groundbreaking technologies of the XXI century. — states Ilya Tarutov, CEO, DAO.Casino. – I am sure that the products we’re developing will transform the online gambling into a fair and transparent industry for all of the involved parties: casino operators, developers, and affiliate marketers. “ “We are launching the Sandbox with the goal of enabling as many developers as possible to learn to create decentralized games. We have achieved an important milestone by starting to accept applications from developers all around the world who share our idea to make online gambling fair and transparent. With our technology, developers can take the whole gambling industry to the next level” – says Alexandra Fetisova from DAO.Casino. DAO.Casino is disrupting the online gambling industry by developing the protocol based on Ethereum blockchain technology. The protocol ensures the automation of transactions and facilitates interactions between all the industry participants: casino operators, game developers, and affiliate marketers. DAO.Casino team is fully dedicated to developing the best products and making the gambling industry a better place.
  10. Hello. I'm trying to implement normal mapping. I've been following this: http://ogldev.atspace.co.uk/www/tutorial26/tutorial26.html The problem is that my tangent vectors appear rather obviously wrong. But only one of them, never both. Here's my code for calculating the tangents: this.makeTriangle = function(a, b, c) { var edge1 = VectorSub(b.pos, a.pos); var edge2 = VectorSub(c.pos, a.pos); var deltaU1 = b.texCoords[0] - a.texCoords[0]; var deltaV1 = b.texCoords[1] - a.texCoords[1]; var deltaU2 = c.texCoords[0] - a.texCoords[0]; var deltaV2 = c.texCoords[1] - a.texCoords[1]; var f = 1.0 / (deltaU1 * deltaV2 - deltaU2 * deltaV1); var vvec = VectorNormal([ f * (deltaV2 * edge1[0] - deltaV1 * edge2[0]), f * (deltaV2 * edge1[1] - deltaV1 * edge2[1]), f * (deltaV2 * edge1[2] - deltaV1 * edge2[2]), 0.0 ]); var uvec = VectorNormal([ f * (-deltaU2 * edge1[0] - deltaU1 * edge2[0]), f * (-deltaU2 * edge1[1] - deltaU1 * edge2[1]), f * (-deltaU2 * edge1[2] - deltaU1 * edge2[2]), 0.0 ]); if (VectorDot(VectorCross(a.normal, uvec), vvec) < 0.0) { uvec = VectorScale(uvec, -1.0); }; /* console.log("Normal: "); console.log(a.normal); console.log("UVec: "); console.log(uvec); console.log("VVec: "); console.log(vvec); */ this.emitVertex(a, uvec, vvec); this.emitVertex(b, uvec, vvec); this.emitVertex(c, uvec, vvec); }; My vertex shader: precision mediump float; uniform mat4 matProj; uniform mat4 matView; uniform mat4 matModel; in vec4 attrVertex; in vec2 attrTexCoords; in vec3 attrNormal; in vec3 attrUVec; in vec3 attrVVec; out vec2 fTexCoords; out vec4 fNormalCamera; out vec4 fWorldPos; out vec4 fWorldNormal; out vec4 fWorldUVec; out vec4 fWorldVVec; void main() { fTexCoords = attrTexCoords; fNormalCamera = matView * matModel * vec4(attrNormal, 0.0); vec3 uvec = attrUVec; vec3 vvec = attrVVec; fWorldPos = matModel * attrVertex; fWorldNormal = matModel * vec4(attrNormal, 0.0); fWorldUVec = matModel * vec4(uvec, 0.0); fWorldVVec = matModel * vec4(vvec, 0.0); gl_Position = matProj * matView * matModel * attrVertex; } And finally the fragment shader: precision mediump float; uniform sampler2D texImage; uniform sampler2D texNormal; uniform float sunFactor; uniform mat4 matView; in vec2 fTexCoords; in vec4 fNormalCamera; in vec4 fWorldPos; in vec4 fWorldNormal; in vec4 fWorldUVec; in vec4 fWorldVVec; out vec4 outColor; vec4 calcPointLight(in vec4 normal, in vec4 source, in vec4 color, in float intensity) { vec4 lightVec = source - fWorldPos; float sqdist = dot(lightVec, lightVec); vec4 lightDir = normalize(lightVec); return color * dot(normal, lightDir) * (1.0 / sqdist) * intensity; } vec4 calcLights(vec4 pNormal) { vec4 result = vec4(0.0, 0.0, 0.0, 0.0); ${CALC_LIGHTS} return result; } void main() { vec4 surfNormal = vec4(cross(vec3(fWorldUVec), vec3(fWorldVVec)), 0.0); vec2 bumpCoords = fTexCoords; vec4 bumpNormal = texture(texNormal, bumpCoords); bumpNormal = (2.0 * bumpNormal - vec4(1.0, 1.0, 1.0, 0.0)) * vec4(1.0, 1.0, 1.0, 1.0); bumpNormal.w = 0.0; mat4 bumpMat = mat4(fWorldUVec, fWorldVVec, fWorldNormal, vec4(0.0, 0.0, 0.0, 1.0)); vec4 realNormal = normalize(bumpMat * bumpNormal); vec4 realCameraNormal = matView * realNormal; float intensitySun = clamp(dot(normalize(realCameraNormal.xyz), normalize(vec3(0.0, 0.0, 1.0))), 0.0, 1.0) * sunFactor; float intensity = clamp(intensitySun + 0.2, 0.0, 1.0); outColor = texture(texImage, fTexCoords) * (vec4(intensity, intensity, intensity, 1.0) + calcLights(realNormal)); //outColor = texture(texNormal, fTexCoords); //outColor = 0.5 * (fWorldUVec + vec4(1.0, 1.0, 1.0, 0.0)); //outColor = vec4(fTexCoords, 1.0, 1.0); outColor.w = 1.0; } Here is the result of rendering an object, showing its normal render, the uvec, vvec, and texture coordinates (each commented out in the fragment shader code): Normal map itself: The uvec, as far as I can tell, should not be all over the place like it is; either this, or some other mistake, causes the normal vectors to be all wrong, so you can see on the normal render that for example there is a random dent on the left side which should not be there. As far as I can tell, my code follows the math from that tutorial. I use right-handed corodinates. So what could be wrong?
  11. xaddrian666

    My first RPG game in javascript

    Hello, i want to share my project with others just for not being the only person who knows about it I think i'm not completely beginner, so i decided to try some game. I'm still learning game mechanism so probably this project is for testing purposes. I started as a website developer so i am coding in javascipt. Of course i will learn new real programming languages like C++ or java but probably in near future. For now js is enough for me This is my first video from the game just to show features i've made. It was recorded some time ago, so there's more small features now, just need to record new video Please let me know what you think about it(don't look at rpg maker textures, it's for testing purposes, ofc in official release i will made my own txt) and what features would you like to see in the future. P.s: sorry for my bad english, i'm still learning(and for no HD in video ) Link to video(Youtube)
  12. i have a problem i can make work the verificay if user existe our not i using nodejs ,express,mysql i put my link to project in github the code its to big https://github.com/Kammikazy/project find the soluction to my problem
  13. Hello i try retrive data from a table cidades and show in my express with jade const express = require('express') const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const router = express.Router() //router.get('/Administration', controllerLogin.FindCidades) router.get('/Administration', (req, res) => res.render('Administration/index',{username:res.locals.user.username ,nome:res.locals.cidade.Nome,coordenas:res.locals.cidade.coordenadas,continente:res.locals.cidade.continente })) module.exports = app => app.use('/', router) const authenticateUser = async (connection, req, res) => { const user = await User.findUser(connection, req.body.username) if(!user){ return res.render('login/login',{error: true}) } if(!await bcrypt.compare(req.body.password, user.password)){ return res.render('login/login', {error: true}) } else{ // user.password = undefined req.session.user = user //const nivel = await User.findnivel(connection, req.body.username) if(user.nivel==1){ const cu = await Cidade.findcidade(connection, req.body.username) // req.session.user.nivel = nivel res.locals.user= user req.session.cidade= cu res.locals.cidade= req.session.cidade // console.log(1); console.log("rewr",cu); res.redirect('/Administration'); }else if(user.nivel==2){ // req.session.nivel = nivel console.log(2); // res.redirect('/Users') }else if(user.nivel==3){ // req.session.nivel = nivel console.log(3); // res.redirect('/Administration') }else if(user.nivel==4){ // req.session.nivel = nivel console.log(4); // res.redirect('/Administration') } else if(user.nivel==5){ // req.session.nivel = nivel console.log(5); // res.redirect('/Administration') } else { console.log("banned"); } } } const findcidade = (connection,username) => { return new Promise ((resolve, reject) => { connection.query(`SELECT cidade.cod_cidade, cidade.Nome,cidade.continente,cidade.coordenadas,cidade.ouro,cidade.madeira,cidade.metal,cidade.pedra,cidade.energia, cidade.comida,cidade.petrolio FROM user INNER JOIN cidade ON user.cod_user=cidade.cod_user WHERE user.username='${username}' `, (err, result) =>{ if(err){ reject(err) }else{ if(result.length>0){ resolve(result) } else{ resolve(false) } } }) }) } give this error what i doing wrong i want show for example user maria have athenas and rome
  14. In early 2017 I had this idea, if I can stream an HD movie without downloading the whole thing, I could stream a massive open world game as well without downloading it. Most people are under the impression that a game running in the browser can’t look good because then it takes forever to load it. Well, in game dev the concept of LOD - Level Of Details - exists quite a while now, there is no reason why we couldn’t apply it in the browser as well. The game I developed loads in a matter of seconds. It takes a couple seconds to load the engine itself, then when you press play: - Loads the terrain peaces closer to you first, than what's further away. - Loads the low poly version of the models like trees, rocks and bushes first, then the high poly version when available. - Structures... - Animals... - Sound... - Etc.. you get the idea My point is, it is POSSIBLE to build a 3D version of the Internet, where instead of browsing through websites, we could jump from one 3D space to the next. I “invite” everyone to make this happen. I’ve made a 3D Survival Game with a massive terrain to prove the tech works. I want you guys to build your own 3D spaces implementing your own ideas what the web should look like in the future. We could just link them all together and make this Interconnected Virtual Space happen - yeah, the Metaverse, for the Snow Crash fans out there I would love to hear what you think about the applications of 3D spaces on the Web. Please leave me a comment if you are as exited about the possibilities as I am. Backing up my claims: Live Tech Demo is available on https://plainsofvr.com Watch a the Open World to load instantly, than gradually improving:
  15. Awoken

    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. Currently my path finding algorithm can find the shortest path in anywhere from 10 ms and up, and when I say up, I mean upwards of 30 seconds, and that's because of the way I built the algorithm, which is in the process of being optimised. -- - -- - -- - -- - -- - -- - Lessons learned using Node.js for development and testing - -- - -- - -- - -- - -- - -- As of this writing I am using Node.js to test the efficiency of my algorithms. This has slowed down my development. I am not a programmer by trade, I've taught myself the bulk-work of what I know, and I often spend my time re-inventing the wheel and learning things the hard way. Last year I made the decision to move my project over to Node.js for continued development, eventually it all had to be ported over to Node.js anyways. In hind sight I would have done things differently. I would have continued to use Chrome console for testing and development, small scale, then after the code was proven to be robust would I then port it over to Node.js. If there is one lesson I'd like to pass on to aspiring and new programmers, it's this, use a language and development environment that allows you, the programmer, to jump into the code while it's running and follow each iteration, line by line, of code as it's be executed, basically debugging. It is so easy to catch errors in logic that way. Right now I'm throwing darts at a dart board, guesses what I should be sending to the console for feedback to help me learn more about logical errors using Node.js, see learning the hard way. -- - -- - -- - -- - -- - -- - Linear Path algorithm for any surface. - -- - -- - -- - -- - -- - -- In the blog entry above I go into detail explaining how I create a world. The important thing to take away from it is that every face of the world has information about all surrounding faces sharing vertices pairs. In addition, all vertices have information regarding those faces that use it for their draw order, and all vertices have information regarding all vertices that are adjacent to them. An example vertices and face object would look like the following: Vertices[ 566 ] = { ID: 566, x: -9.101827364, y: 6.112948791, z: 0.192387718, connectedFaceIDs: [ 90 , 93 , 94 , 1014 , 1015 , 1016 ], // clockwise order adjacentVertices: [ 64 , 65 , 567 , 568 , 299 , 298 ] // clockwise order } Face[ 0 ] = { ID: 0, a: 0, b: 14150, c: 14149, sharedEdgeVertices: [ { a:14150 , b: 14149 } , { a:0 , b: 14150 } , { a:14149 , b:0 } ], // named 'cv' in previous blog post sharedEdgeFaceIDs: [ 1 , 645 , 646 ], // named 's' in previous blog post drawOrder: [ 1 , 0 , 2 ], // named 'l' in previous blog post } Turns out the algorithm is speedy for generating shapes of large sizes. My buddy who is a Solutions Architect told me I'm a one trick pony, HA! Anyways, this algorithm comes in handy because now if I want to identify a linear path along all faces of a surface, marked as a white line in the picture above, you can reduce the number of faces to be tested, during raycasting, to the number of faces the path travels across * 2. To illustrate, imagine taking a triangular pizza slice which is made of two faces, back to back. the tip of the pizza slice is touching the center of the shape you want to find a linear path along, the two outer points of the slice are protruding out from the surface of the shape some distance so as to entirely clear the shape. When I select my starting and ending points for the linear path I also retrieve the face information those points fall on, respectively. Then I raycaste between the sharedEdgeVertices, targeting the pizza slice. If say a hit happens along the sharedEdgeVertices[ 2 ], then I know the next face to test for the subsequent raycaste is face ID 646, I also know that since the pizza slice comes in at sharedEdgeVertice[ 2 ], that is it's most likely going out at sharedEdgeVertices[ 1 ] or [ 0 ]. If not [ 1 ] then I know it's 99% likely going to be [ 0 ] and visa-versa. Being able to identify a linear path along any surface was the subject of my first Adventure in Robust Coding. Of course there are exceptions that need to be accounted for. Such as, when the pizza slice straddles the edge of a face, or when the pizza slice exits a face at a vertices. Sometimes though when I'm dealing with distances along the surface of a given shape where the pizza slice needs to be made up of more than one set of back to back faces, another problem can arise: I learned about the limitations of floating point numbers too, or at least that's what it appear to be to me. I'm sure most of you are familiar with some variation of the infinite chocolate bar puzzle So with floating point numbers I learned that you can have two faces share two vertices along one edge, raycaste at a point that is directly between the edges of two connecting faces, and occasionally, the raycaste will miss hitting either of the two faces. I attribute this in large part because floating point numbers only capture an approximation of a point, not the exact point. Much like in the infinite chocolate bar puzzle there exists a tiny gap along the slice equal in size to the removed piece, like wise, that tiny gap sometimes causes a miss for the raycaste. If someone else understands this better please correct me. -- - -- - -- - -- - -- - -- - Dynamic Path Finding using Nodes for any surface - -- - -- - -- - -- - -- - -- Now that I've got the linear path algorithm working in tip top shape, I use it in conjunction with Nodes to create the pathfinding algorithm. Firstly I identify the locations for all nodes. I do this using a Class I created called Orientation Vector, I mention them in the blog post above. When they're created, they have a position vector, a pointTo vector, and an axis vector. The beauty of this class is that I can merge them, which averages their position, pointTo, and axis vectors, and it allows me to rotate them along any axis, and it allows me to move them any distance along the axis of their pointTo vector. To create shoreline collision geometry, and node collision geometry, illustrated above, and node locations along shorelines, illustrated below, I utilise the Orientation Vector Class. Firstly, the water table for the world is set to an arbitrary value, right now it's 1.08, so if a vector for a given face falls below the table and one or two vertors are above the table then I know the face is a shoreline face. Then I use simple Math to determine at what two points the face meets the water and create two OVectors, each pointing at each-other. Then I rotate them along their y axis 90 and -90 degrees respectively so that they are now facing inland. Since each face, which are shoreline faces, touch one another, there will be duplicate OVectors a each point along the shore. However, each Ovector will have a pointTo vector relative to it's sister Ovector during creation. I merge the paired Ovectors at each point along the shore, this averages their position, pointTo and axis. I then move them inland a small distance. The result is the blue arrows above. The blue arrows are the locations of three of the thousands of nodes created for a given world. Each Node has information about the shoreline collision geometry, the node collision geometry ( the geometry connecting nodes ), and the Node to its left and the Node to its right. Each face of collision geometry is given a Node ID to refer to. So to create the path-finding algorithm. I first identify the linear path between the starting and ending points. I then test each segment of the linear path for collision geometry. If I get a hit, I retrieve the Node ID. This gives me the location for the Node associated for a given face of collision geometry. I then travel left and right along connecting Nodes checking to see if a new Linear path to the end point is possible, if no immediate collision geometry is encountered, the process continues and is repeated as needed. Subsequently, a list of points is established, marking the beginning, encountered Nodes and end of the line of travel. The List is then trimmed by testing linear paths between every third point, if a valid path is found, the middle point is spliced. Then all possible paths that have been trimmed are calculated for distance. the shortest one wins. Below is the code for the algorithm I currently use. its my first attempt at using classes to create an algorithm. Previously I just relied on elaborate arrays. I plan on improving the the process mentioned above by keeping track of distance as each path spreads out from it's starting location. Only the path which is shortest in distance will go through its next iteration. With this method, once a path to the end is found, I can bet it will be shortest, so I won't need to compute all possible paths like I am now. The challenge I've been facing for the past two months is sometimes the Nodes end up in the water, The picture above shows a shoreline where the distance the OVectors travel would place them in the water. Once a node is in the water, it allows the AI to move to it, then there is no shoreline collision geometry for it to encounter, which would keep it on land, and so the AI just walks into the ocean. Big Booo! I've been writing variations of the same function to correct the location of the geometry shown below in Red and Yellow below. But what a long process. I've rewritten this function time and time again. I want it to be, well as the title of this Blog states, Robust, but it's slow going. As of today's date, it's not Robust, and the optimised path-finding algorithm hasn't been written either. I'll be posting updates in this blog entry as I make progress towards my goal. I'll also make mention what I achieve for shortest, long time for pathfinding. Hopefully it'll be below 250 ms. -- - -- - -- - -- - -- - -- - short term goals for the game - -- - -- - -- - -- - -- - -- Badly... SO BADLY I want to be focusing on game content, that's all I've been thinking about. Argh, But this all has to get wrapped up before I can. I got ahead of myself, I'm guilty of being too eager. But there is no sense building game content on top of an engine which is prone to errors. 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. The project is no longer going to be called Seed, it's instead going to be called Unirule. [ 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
  16. tobspr

    YORG.io v2.1 release

    Here is a new update for YORG.io! Some small changes here and there and overall just improving the game. Increased Map Size The map is now four times as big as before (200×200 instead of 100×100). This means a lot more space to expand since previously players already had covered the whole map. However, this also means that old savegames are not compatible anymore – Sorry for that! Detailed Minimap View You can now also hold “M” to show a bigger version of the minimap: Invisible Transporters Earlier The skill tree has been changed so that invisible transporters are now available earlier. This was made to encourage expansion. With the previous skill tree layout, the invisible transporters were only unlockable after most of the map was covered. Up To 12 Crystal Mines Per Resource There are now skills to place up to 12 crystal mines per resource: Destroyed Building Indicators When a building gets destroyed, it’s icon is now shown so you can see which type of building got destroyed: Multiple Smaller Fixes Fixed crash when selling invisible transporters Fixed exploit when loading savegames multiple times Bigger numbers (E.g. “5.6b”) are now better formatted Made easy mode easier Increased difficulty of the challenge mode (New modes coming soon!) Minor Fixes & Performance improvements Thanks to everyone who is continuing to support Yorg! If you are interested in streaming Yorg.io or playing it on Youtube, be sure to post links to this in Discord! I really want you all to succeed and so we can work together in Discord to make that a reality. Link to Discord here: https://discord.gg/UdXda9Q
  17. https://www.kongregate.com/games/cardalomim/evo-psy-test You’ve inherited your father’s old plot of land in The Forest. Armed with hand-me-down tools and a some food, you set out to begin your new life. Can you learn to live off the land and turn these overgrown fields into a thriving and safe home? Give me any feedback that you may have. Thanks. Charles.
  18. Awoken

    Finished & Post Mortem

    Please check out my project page to play Shapes Tower Defense You can play it on GameDev! A Huge thank you to all those who've helped me out with this game. There were quite a number of us encouraging each-other along and I thought, and think, that that is just fantastic. POST MORTEM On the outset I was hoping to spend a lot of time on the game play. But I wasn't able to devote as much time to game play as I would have liked. In the future I think at least 50% of development time, if not more, should be spent play testing and tweaking. But Over-all I'm quite satisfied with my implementation of the ideas I set out with in my first blog regarding this project. Came together quite nicely. I think all of my years of experience with THREE.js helped me fast track many of the steps that maybe new-comers to the API would have to learn the hard way. What went Right: Using my own 3D program helped out tremendously, I don't think I could have created all the unique shapes ( over 30 ) if not for that. I think there is value in creating your own 2D and 3D suits. though they would be much much simpler, you can create them to suit you needs. Expected development time and debugging was quite accurate, I'm surprised. I enjoyed making this game a lot, and I think the part I enjoyed the most was looking up Johnson Solids and making them. What went Wrong: Like lawnjelly said, gimp is a nightmare. I'm a bit more familiar with it now but what I've learned about that beast is that it's probably incredibly easy for those who know what hot keys their pressing, but for me, a Microsoft paint wiz, it was terrible. I didn't devote as much time to game play as I was expecting to. And game play is a whole different animal. I'm so used to technical problem solving that switching over your mind set to deal with something as ambiguous and subjective as game play was a challenge, especially since I only gave myself 5 days to do it. But thankfully lawnjelly was a big help and he pointed out a lot of design flaws that I had over-looked. I think I got most of them that he mentioned. My code, It's bad. I documented things as best I could and tried to label things but once the complexity of this project grew I could no longer keep things tidy or orderly. Sure I named variables 'vectorOne' instead of 'v' but the code lacks coherent structure. By the end I was confused as to where I had put things. Clearly much work to be done in this area. All and all I enjoyed the experience a lot, and I became closer with some members. Win / Win Have a great weekend. Awoken
  19. Hello! I'm working on an online turn based multiplayer game as a hobby project. My game is implemented using Node.js and Javascript. Currently I'm designing how implement the persistent storage so that games can recovered in case of server crash. My idea is to use a in-process memory store for data access in the game server logic. When a store modification is being done, the in-process memory data store is always updated directly and the persistent storage changes are queued. I was thinking of something along the lines of this: function Store(memoryStore, persistentStore) { // Different queues for operations of different importance. // If the different operations need to happen in order and be in consistent state, they must be placed in same queue this.queue = new Queue(persistentStore); // Could be something like game chat. Saving them at different time doesn't affect the atomicity this.lessImportantQueue = new Queue(persistentStore); this.actionHandler = new ActionHandler(); this.doOperation = function(action) { // Generate applicable change using the memory store as source of truth var actionResult = actionHandler.handleAction(memoryStore, action); memoryStore.doOperation(actionResult); this.queue.push('doOperation', [actionResult]) } this.doLessImportantOperation = function() { memoryStore.doLessImportantOperation(); this.lessImportantQueue.push('doLessImportantOperation', arguments) } this.getSomeData = function() { return memoryStore.getSomeData(); } } function ActionHandler { // Generates operation using the memory storage as source of truth this.handleAction = function(memoryStore, action) { return action.complete(memoryStore); } } // Stores game state altering operations function Queue(store) { this.items = []; this.push = function(operation, args) { this.items.push([operation, args]); } // Can be called directly, after certain queue size or at an interval this.synchronize = function() { var p = Promise.resolve(); this.items.forEach(function(op){ p = p.then(function(){ return store[op[0]].apply(persistentStore, op[1]); }); }); this.items = []; } } // Special type of store that has synchronous interface function MemoryStore() { this.getState = function() { ... } this.getSomeData = function() { return ... } this.doOperation = function(actionResult) { ... } } // Uses external persistent storage function PersistentStore() { // Get state as an object that can be used for creating a memory store this.getState = function() { ... } this.getSomeData = function() { ... return ... } this.doOperation = function(actionResult) { ... return Promise.resolve(); } } The Store class is used as top level layer for fetching and storing data. Contrary to the example, I also considered being able to use a remote data stores for primary data access. The good side with that would be that the server wouldn't need to hold the whole game state in memory, consistent game state could be read from different processes and the server would be quite much stateless. The two latter benefits are highly questionable. The downsides I found were 1) either all server code involving data fetching would need to be asynchronous or the whole state would need to be fetched in advance. 2) data fetching would be a lot slower from remote database, even one like Redis Example: this.doOperation = function(action) { // Generate applicable change using a store as source of truth actionHandler.handleAction(mainStore, action).then(function(actionResult) { // Main store can either memory store with asynchronous wrapper or a persistent store return mainStore.doOperation(actionResult); }); } As the game server is normally a single process, store like Redis should not be needed as primary data store. Deciding between use of the memory store (synchronous) or possible use of both memory store (asynchronous wrapper) and persistent storages (asynchronous) has big implications for the codebase. With choice to use asynchronous stores, essentially lots of code would be asynchronous in places where one wouldn't expect asynchronous code. Every persistent store function call would be an atomic operation. Thefore the game state would stay consistent if the game server would shut down, whether some of the operations are still being completed or not. This structure would allow changing the frequency of storage which would mainly effect performance. Buffering the operations would allow for less round trips to the database. The performance would not likely be problem with any of the solutions I introduced, but would allow more games to be run in one server. I'm currently thinking about following questions: 1) Does the choice of the primary and secondary database make sense here? 2) Does it make sense to exclusively use synchronous in-process memory database for game data processing instead of database such as Redis or another type of database like RDBMS or noSQL database? 3) Is the plan for the storing data and queueing reasonable? I haven't seen literature nor good design patterns for this yet. Having to repeat the queue push for every operation seems kind of unnecessary. I'm also thinking if I'm overengineering. TL;DR: Should a turn based game store its state in memory and use asynchronous periodic backup or should game data be stored remotely directly at cost of lots of codebase being filled with callbacks/promises? Feel free to also note if my post doesn't provide enough information for allowing discussion.
  20. Hi, I'm currently working on a lightweight 2D canvas library called JSCF. It's got a lot of cool features but is still in prototype and I'd be glad to have more hands on this project + getting some feedback from programmers like you. This is an open-source project so no rev involved at all, but I think anyone knowledgable or interested in getting involved with a cool native JS 2D engine is welcome. For full feature list, contribution, prototype build and more please visit the github repo here: https://github.com/g--o/JSCF Thanks for reading 😃
  21. Awoken

    Almost Finished

    This week has been one heck of a week. I wake up, eat breakfast, go for a run, go to work, come home eat dinner, program for 4 hours, go to bed, and repeat. I've got a lot done. Here is a pic showing the latest accomplishments. Added - Crystals which act like lives, but also generate points after each wave. And they break if a shape touches one. - Score system - Upgrade system - Update shape paths if they were travelling to a crystal that has already been broken. - Start screen - Menu screen - Lose Animation I now only have two things to do to wrap up this game best of all I'll have it done by Saturday. I'm impressed with how well I've managed my time and how accurate I've been predicting how much time it will take me to do this or that. So fingers crossed. If I don't run into any snags I'll have met the requirements by Saturday Thanks for reading
  22. Awoken

    Cube Cannon

    Hello GameDev, Here is a screen shot of the Cube Cannon. You can only build one! It is fully operational and it packs a punch, for squares that is. Anyways I've made so many changes to the code I can't even really recap all the things I've done. So here is the code TD.06.22.zip If you fancy, give the project a go. I've included some instructions to go over. I'm going to be plugging away come tomorrow to add the Hell-Fire Hex and the Tack Tower. Then I'll be incorporating points and upgrades and a start screen Yeish! hopefully figures crossed.
  23. Sản Phẩm trang điểm cách đây không lâu với 1 sản phẩm có tên Detoxic đã được phổ biến người để ý và các từ khóa can hệ đến Detoxic có sự tầm nã cập rộng rãi nhất trên mạng xã hội và Internet. các ngôi nhà ở đây được vun đắp rất đơn thuần cốt yếu bằng chính đá đá hoa cương cộng với những dụng cụ cần lao đánh dấu sự tồn tại của con người trong giai đoạn tiền đồ sắt với thể đề cập tới như quặng sắt hay máy mài…Cung điện Hidi được xem là 1 trong các thắng cảnh với phổ thông giá trị linh nghiệm và đáng được bảo tàng nhất ở đất nước Nigeria. xem thêm:phun môi collagen giá bao nhiêu những loại áo đồng phục doanh nghiệp đẹp mặt chính là thấu kính để khuếch đại hình ảnh và đặc điểm quyến rũ, thú vị ấy đến các đối tượng bên ngoài khuôn khổ hành chính nhân sự tổ chức. Chính từ đây mà việc ngoại hình áo đồng phục tổ chức lại càng chịu thêm gánh nặng, càng đòi hỏi chất lượng cao của không chỉ người ngoài mặt mà còn ở người giám định nó trước lúc được cung ứng. Ngoài các khoa học trang điểm trọng điểm của chúng tôi còn dạy cho Các bạn biết 1 số cách thức làm cho tóc cho cô dâu, cho những người muốn đi dự tiệc cưới hoặc là biết tự làm tóc cho chính bản thân mình như thế nào để trông trẻ trung và đẹp nhất mang khuôn mặt mình. phổ biến lúc stress còn bị mất ngủ nữa, hậu quả là da mình cũng xấu đi. cho nên Hương biết điều quan yếu nhất là phải tậu 1 sản phẩm thấp trong khoảng tình cờ, hoàn toàn Organic như Saffron của Saffron Việt Nam, để giúp mình sở hữu được một làn da đẹp, khoẻ mạnh trong khoảng sâu bên trong. Collagen chẳng những có tác dụng liên kết những tế bào mà nó còn giúp những cơ quan, nội tạng cơ thể hoạt động rẻ và duy trì sự đàn hồi, chắc khỏe của làn da, chống lão hóa da, tiêu diệt các gốc tự do và còn mang thể tương trợ điều trị được những bệnh về xương khớp hiệu quả. Nhưng điều kiện số đông đề nghị sẽ là cần một chất lượng cực cao, cực chuẩn trong cách thiết kế đồng phục công ty. cùng sở hữu đó là việc áp nó vào những quy định, lệ luật có tính chất và thưởng phạt rõ ràng, chỉ sở hữu như vậy mới đảm bảo được tính thực dụng chủ nghĩa của nó. Hãy tiêu dùng ngay một quả chanh và hai - ba thìa đường thô (loại tuyến đường hạt lớn chứ không phải con đường tinh luyện mịn nhỏ), vắt chanh vừa phải vào bát đựng tuyến đường đấy tạo thành hẩu lốn sệt không quá ướt, tiêu dùng hổ lốn đấy massage nhẹ nhõm lên môi theo chiều vòng tròn. Nụ cười tinh ma giúp Margot Robbie xuất hiện như một làn gió thổi tới Oscar 2018 ko khí vui vẻ. Ở sự kiện năm nay, ngoài được giới chuyên gia Phân tích có phong cách ăn mặt đẹp nhất, Margot Robbie còn ghi điểm bởi lối điểm trang bỗng dưng, ko nhấn nhá quá đa dạng vào bất cứ bộ phận nào. xem thêm:phun môi collagen màu đỏ cam bề ngoài đồng phục doanh nghiệp bị tác động quá nhiều bởi nhân tố nguồn vốn, kinh tế, chỉ cần sở hữu chút khó khăn về mặc kinh tế thì gần như người sẽ ưng ý hi sinh nhưng mẫu áo đồng phục đấy. mang thể là hi sinh về mặt ngoại hình ví như hạn hẹp kinh phí, tuyển lựa những mẫu bề ngoài phẩm cấp không cao để hạn chế giá tiền cần bỏ ra. Cũng với thể là nó ảnh hưởng trực tiếp đến việc lựa chọn các chất liệu, nguyên vật liệu cấu thành lên chiếc áo đồng phục doanh nghiệp đó. Vì thế mà để với được một điều kiện lý tưởng nhất cho sự phát huy hết công năng, lợi ích của những bộ đồng phục công ty thì ngay tính từ lúc mẫu mã đồng phục công ty thì bạn cần đặc biệt phải chú ý và dành phổ thông thời kì để thử nghiệm, khảo sát khả năng thành công của nó. nguồn:phun môi màu hồng baby
  24. I've been doing some research on delta compression (used and described in the Quake3 doc http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/Quake3Networking,), and I'm looking for some clarifications on that topic please if possible. I understand that the delta compressed state is the difference between any given world states, meaning that if we store the state of every entity in a world state at every tick, the difference would be only the states of entities that changed between these two world states. Now when sending back the delta state to the client, do we go as far as only mentioning the properties that changed? Let's say a character moved only on X axis but didn't move on the Y axis between two states, are we sending to the client the whole state (x, and y) or only the new x position? If that's the case and let's assume there are a few more properties that describes a character, how can the client identify which properties have actually changed when rebuilding the information from binary data.
  25. I've been doing a lot of research on how to implement a game server to support a web based game in the vibe of surviv.io, or zombsroyaleio. There are so many ressources out there, but apparently surviv.io is built with NodeJS using Websockets. That implies also that they are built on TCP protocol. They might not look like big titles but they surely look very steady (from my point of view) and I feel like they do deal with classic Fast Paced multiplayer concepts such as Client-side prediction, interpolation, and potentially lag compensation. During my research, there seems to be that constant debate on UDP over TCP. To sum it all up, it seems that TCP is not appropriate for fast twitching games, however I do believe they fall into that category. How can they get away with TCP? Is this debate actually now outdated now we have better internet connections?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!