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 85 results

  1. Im a beginner programmer in java script (hobbyist) and im trying to replicate pong in the p5.js web editor. i have this problem that i cant solve with the player colision, i tried several things. i ahve the distance from the player to the ball but i dont know how to use that information to make a colision detection. i provide you the code below: https://editor.p5js.org/p3nd_/sketches/rkAEBmgeV would be very happy if i would get help.
  2. So I have a decent amount of JavaScript experience now and decided I was gonna lower my head and start cranking out some 2d games, partly to learn, partly to have fun. Afterall, HTML5 canvas is such an easy and enticing medium. I love the JavaScript implementation of it. But after literally struggling for a week to get basic game functionality working I have had enough of the little stupid bugs that pop up with JavaScript. Don't get me wrong, I still love the language for scripting. I'm just not going to spend 20 mins coding and 5 hours debugging just because the language is crap. I've decided to return to my previous endeavor, Java. I like Java a lot and the only reason I haven't pursued more in the way of game development is just for the fact that Java is limited to mobile or PC apps that may never see the light of day unless it's hosted on some obscure Java game hosting website that is populated with 2,000 half developed games that no one will ever care about. BUT, still, I enjoy hand coding and I know C# but don't feel like using Visual studio and I really don't wanna hand code C# on the .Net or whatever. I use Visual Studio for business apps (ASP.NET) but I don't wanna build a game with it. So, does anyone have any points to share about why moving to Java for game development is not smart? Besides the whole, "Java is slow" thing. I mean things that might make it harder in JAva to make games vs. in other languages. Please share your thoughts.
  3. Hello everyone, in the game code below (written using the Phaser framework) I am trying to pass the variable this.inputScore to the global function assignValue. How can I do this? The assignValue function is being read by an external Index.html file on game over and I need this.inputScore to be passed to the Index.html file. I would greatly appreciate any help - new to programming. Thank you. //GLOBAL FUNCTION function assignValue() { document.getElementById("inputScore").value = this.inputScore; //how can I get this.inputScore from the game code below? }; //GAME CODE var CrystalRunner = CrystalRunner || {}; CrystalRunner.GameState = { init: function() { //...code here }, create: function() { //...code here }, update: function() { //..code here //check if the player needs to die if(this.player.top >= this.game.world.height) { this.gameOver(); } }, gameOver: function(){ //..code here this.updateHighscore(); //..code here }, updateHighscore: function(){ this.highScore = +localStorage.getItem('highScore'); if(this.highScore < this.myScore){ this.highScore = this.myScore; this.inputScore = this.highScore; //I need this.inputScore to be passed into the assignValue function this.submitScoreButton = this.game.add.sprite(this.game.world.centerX-135, this.game.world.centerY+100, 'submitScoreButton'); this.submitScoreButton.events.onInputUp.add(function() { window.location.href = "index1.php"; //Index1.php will have a form input value into which this.inputScore will be passed }, this); } localStorage.setItem('highScore', this.highScore); }, };
  4. I am designing a very simple 2d tilemap engine with HTML5 canvas and Javascript. I have two for loops to run through map coordinates and then draw to canvas a tile based on what the said coordinate value is. While doing this, I also need to able to assign an incrmenting var/class/type or whatever with dynamic parameters such as that tile's x, y, and number values. Something like the following pseudo theory: for loop ++ , for loop++ counter++ sprite[counter]{ x=someNum; y=someNum; value=someVal; } Thanks for any help! Jscript_GameTest.html
  5. Hi everyone. For the last few months I’ve been working on a simple HTML5 2D side scrolling action game called Theraxius. It's nothing new and revolutionary, it's more like an evolution of different technology (combination of HTML5, PHP, MySQL). The game also includes a level editor so you can create your own levels. The game and the level editor is written almost completely in JavaScript, no download is required. Just load and play. Here are a few screenshots and the link to the page. In the next weeks I’ll try to post some videos, try to add registration (for newsletter and later for public test). Release date: when it's done theraxius.com
  6. Looking for a developer to help me develop a bot for discord, it will be a few simple features that will all work together to create a bot perfect for Discord servers that want to be used for games. I am creating a server for Halo Infinite competitive play and need something to fit the purpose, but I want the bot to be multipurpose and work on other servers for different games. The features i want it to have are: - Auto Roles, controllable by admin of how they are given, so if admin accepts them they get given a specific role. - Basic announcement commands - Nickname requester - auto message when specific command is made e.g. when i use a specific reaction to a message, I can automate a new message. - Welcome messages, leave messages etc... - I want a way to organise teams in roles, but I want their team captain to choose who has that role so I want specific people to be able to give the team role to people or request a role for someone if the other isn't possible. -A ban, unban, report system etc. - Chat command purge, so when a command is used or a specific reaction etc... the chat is cleared for that person to keep the chats tidy. -Maybe a way for messages to be moved into a different chat almost copy and pasted, so if a user requests to change their nickname in one chat the request goes to a private chat for the admins, so the public chat stays clear. Extra Features if possible: - Event reminders for when there are matches etc... sent to team captains when they have a scrim match - Leveling system but given by the admins, this can be when they win matches, or tournaments they level up on the admins command, this will then categorise the roles. -A way to search for certain roles so for example search for all of the players with a specific role(rank), specified by the admins so they can recruit players etc... and also a way to search for a certain players username and find out what rank they are in your server. - A twitch broadcasting automation set by admins for when a specific matchup is being streamed and this gets posted wherever specified maybe announcements etc... Future Preferences: -A way for people to get involved like a in discord currency everyone is given a specific amount when they start and they then can use that to gain currency by predicting who is going to win/draw, so they place the currency on specific result, result is posted by admins and the total amount of currency used is split between the people that won etc... There will be in discord leaderboards for people with the most currency, there will be prizes for people with the most currency by the end of each month or so... they will also be able to donate to the channel, and will receive bonuses in the channel. -Depending on how much is donated to the channel, they can work up tiers, if they donate £10 for example they get priority status on twitch links and when they start to stream they are auto posted in the twitch channel. etc... -got more ideas,
  7. applicant42

    Update 0.19.0

    Still just a start, WIP, but finally a new step done. New assets, new sandbox map… Isometric and alpha maths has been rewritten but still needs a lot of refactors and reviews. http://game.applicant42.com/
  8. Top HTML5 game developersThe spry march of digital technology has ushered a radical transformation in the entertainment segment, the way it was perceived and consumed. The over dramatic daily soaps replaced by more relevant web series, the noisy news channels are muted for the tailored-to-taste news feed and child’s play time has shifted from the outdoor parks to the computer deck. With the heroic stunts and captivating sequences of the virtual world, browser games have taken the world by a thundering storm.There is no two say that today’s ground breaking source of entertainment for the millennials is the craze for HTML 5 games coupled with the captivating graphics, enchanting characters, and intriguing strategies that keeps the players glued to their screen. It’s not just the millennials infatuating over the flashy games and challenging strategies but even the adults can’t keep off these instantly addictive games.With such a diverse palette of consumers and their manifold tastes, it creates a huge vent in the gaming world pushing the boundaries to create custom made game strategies that could address the appetite of the cohorts of different realms. The consumer today demands flexibility and portability of their favourite games which paves the way for HTML5 games to create waves across the globe.Catering to this unflinching demand for more challenging, more interesting and more target oriented tailored gaming concepts we’ve witnessed quantum-shift levels of improvements in every aspect of the games from its audio/video quality to concepts over the past few years. Today, the web offers an ocean of gaming options right from educative, engaging, entertaining or challenging. From Barbie dressing to counter strike, crime scenes to investment puzzles there is a game for anything and everything.Customers urge for choices of platform where in they can plug into their current level from any device, be it their smart phone, laptop or desktop. As such, HTML5 is unanimously favoured by web developers and game developers as it provides cutting-edge features, of 2D and 3D graphics, audio APIs, offline asset storage, and combined support for the most popular web browsers. From online casinos to fun games, this mobility-friendly technology is just the perfect match for today’s game consumers.Benefits of Developing Games in Html5Cross Platform Accessibility:HTML 5 offers the flexibility and portability of the games in multiple devices without a tweak in the code. It stands true to its promise of coding once and deploy everywhere that means the same piece of code would run on any device (hardware) and operating system (software).Ease of Framework:HTML 5 is the most preferred gaming tool for the versatility, flexibility and compatibility it offers that allows the developers to tap into uncharted territories with the best tools at disposal.No plug-ins neededDodge the nagging pop ins requesting to download the plug-ins with HTML5 gaming engine. There’s no need for extra plug-ins in HTML5 as that of Flash or Unity. A brief preload is all it takes to boot the game.It’s the futureHTML5 is not going anywhere anytime soon. With more and more elements getting adopted more and more companies will start to develop in HTML5. It is indeed the future.Given these scintillating advantages of the budding platform more and more companies and game developers are making their way to learn and implement HTML5 in their books of code. Considering the market flooded with all the itsy-bitsy games, it becomes a daunting task to choose a high-quality brain stimulating concept of game that not just focus on engagement but actually delves deeper to hone the skills of strategic thinking, reflex reactions, decision making, confidence boosting and many such personality traits.Creating an engrossing game is no amateur thing mastered in a day by the naive programmers binging on the html5 gaming tutorials but it is a piece of art created by experts of different talents who come together to paint the canvas. In the list of top Browser Game Development Studios Genieee secures an admirable position for its commendable work in developing and deploying HTML5 browser games leading the way for its competitors unveiling new possibilities of the arena.Genieee is one of the Top Browser Game Development Studios worldwide that has been serving some of the best quality and concept-driven gaming strategies for more than 10 years. Whether you craze for the fast-paced racing games, heart-pounding first person shooters, or edge-of-your-seat tower defense games, Genieee has to offer quite a diverse collection of games that would keep you on the toes with the unforeseen twists and twirls along the way.Genieee’s strategic masterminds behind each game focus on tantalizing the cognitive functioning of your brain by throwing unfathomable challenges and hindrances that are not just fun to decode and conquer but also forces you to ace your thinking, speed and decision making tactics.Genieee is a powerhouse of artistic talents and out-of-the-box strategists who come together to design and code some of the best pieces of entertainment. The company’s R&D team rigorously analyses the market and experiments with the cutting-edge technology for tomorrow’s browser games, ensuring that the company continues to set trends in the future.Their diverse portfolio of games is painted with many categories like Puzzle & Strategy Games, Action & Arcade Games, Educational & Sports Games and much more that caters to a wide audience. Keeping up with the pace of the changing demands and choices of the consumers, Genieee keeps an eagle-eye on the latest updates on the technology and market and comes up with the latest trend setters in its realm.Being a Top Browser Game Development Studios Genieee strives to be a path-breaker and leader in delivering the best experience of the virtual reality. With their great flow of streamlined processes, exemplary management of each project, and an army of exceptional talents, Genieee offers the best resources to turn your idea into a concept and a concept into a virtual reality.
  9. applicant42

    Frameworks, tooling and other drugs

    It's been long since some colleagues and me "achieve" our unfinished Red Atlas I project. A full hackaton weekend trying to do a strategic game and the full weekend deep inside PhaserJS, our bet on free game frameworks and engines. Phaser 2 CE & Webpack 3 I liked Phaser framework and I wanted to come back to this framework, so now here I am again, working with an idea of #isometric #RPG. Well, not now, Phaser released its 3.x version and webpack is in its 4.x version. I started this idea some time before, using Phaser 2 CE and Webpack 3.x and it looks like is not easy to migrate to Phaser 3 now for me. The future will say... As I re-started this idea many times searching for a good architectural approach to work with this toolchain I decided recently to upload and share the boilerplates I used to start. I hope it helps someone! Boilerplate for 2D games Boilerplate for Isometric games
  10. 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.
  11. 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!
  12. 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
  13. 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.
  14. 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.
  15. 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!
  16. 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'); };
  17. 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
  18. 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.
  19. 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?
  20. 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)
  21. 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
  22. 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
  23. 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:
  24. 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
  25. 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
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!