Jump to content

  • Log In with Google      Sign In   
  • Create Account

Schoening

Member Since 28 Oct 2012
Offline Last Active Mar 06 2013 03:32 PM

Topics I've Started

Callback is blocking.. (JavaScript)

05 March 2013 - 11:50 PM

I am trying to understand callbacks properly so that I can iterate arrays without blocking the Server.

 

Please tell me why it is blocking.. what am I doing wrong? I would much rather run this loop, and then do something when it is finished, but not block the rest of the server.

 

Here is the code:

 

//callback test

var myID = 666;
var grid = [
    [0,0,0],
    [0,0,0],
    [0,0,0]
];


function find_empty_slot(id,callback){
    console.log("Your ID is" + id);
    callback();       
}

find_empty_slot(myID,function(){
    for(var y = 0, len = grid.length; y < len; y++){
        for(var x = 0; x < grid[y].length; x++){
            if(grid[y][x] === 0){
                console.log("I am a Callback");
            }
        }
    }
});

console.log("This should fire before the Callback?");

 

 


Help with Deploying a Node JS app?

02 March 2013 - 02:58 AM

I wrote a little nodeJS server that works just fine offline on my computer.

But now I want to put it online on one of the many clouds out there that support nodeJS

 

I looked at some of the "tutorials" out there, but I don't use expressJS and it is to complicated for me.

 

 

All I am using is NodeJS and Socket.IO.  And I haven't seen a tutorial for that. I also don't understand how I am to know what IP and Port I have to set the app to.

 

 

I am pretty much just lost :D

 

Could I get some help?

A guide, a explanation, something.. 

 

All the Clouds seem to work the same way. npm install   and then .. Magic.  

So it isnt really cloud specific what I am asking for, I am just clueless how to upload and deploy it.   A Drag&Drop onto the cloud  would be the best for me haha.

 

 


Grid, Pathfinding and collision?

18 December 2012 - 12:37 PM

Hi :)
I have a JavaScript server for my Game.

Right now Players simply move around with X,Y coordinates and Velocity.

Collision is detected if a players X,Y is = to an objects X,Y.


I would rather work with a grid.

Like:

Grid = [

[0,0],[0,1],
[etc..],

]

But right now I have no real Idea how to work on grids :-/ In my head I am only able to run Left and Right on an Array...


Any good tutorials?

I need to learn how to use a grid, and collision detection. Path-finding I understand mostly.

Tutorials are your Friends!

03 November 2012 - 05:46 AM

I know learning new stuff can be irritating. But it is important to always push your boundaries.

Unless you are a genius of an artist, you have to do more then repeating what you already know.

You have to look for new and perhaps better ways to push yourself ^^

Check out this Before & After I made today.

One hand was modeled before, the other after, I saw a great tutorial:

Posted Image

Video Tutorial:

http://www.youtube.com/watch?v=J1mExXURsWk

setInterval OR setTimeout: Am I understanding this right?

29 October 2012 - 02:02 AM

Is this right? We are talking about JavaScript. Event Based Language.


If I use setInterval to call a function every second, and the funtion takes 2 seconds to process. Then I am going to "stack up" requests indefinelty? and creating a longer and longer delay?


If I use setTimeout, and specify 1 second. Then the function will run (again, lets say 2 seconds) and then start the timeout. And not stack up requests.

PARTNERS