A Simple Multiplayer Game

@HunterLong said: I must be missing something here... I did set...

[java] Application appclient = new Main();
appclient.start();[/java]

Yes, the thing you miss is basic programming knowledge. Application appclient is a local variable and is only applicable in that scope. At least based on the teeny tiny windows of the latest code we see. This kind of scoping thing is the same in almost any language.

But doesn’t
[java] Application appclient = new Main();
appclient.start();[/java]
have to be in main, like:
[java]public static void main(String[] args) throws IOException, InterruptedException{
Application appclient = new Main();
appclient.start();

}[/java]

Where else can variable Application appclient be stated?

I will try to use a metaphor to explain our positions.

You have seen a picture of a mountain somewhere. Now you decide you want to climb it. You are still learning to get dressed and you figure you will need to wear clothes and shoes to climb a mountain.

So you start asking a bunch of experienced mountain climbers and guides how to tie sneakers. They try to convince you that if you can’t tie your own shoes then you will fail at every other step of the process. They also don’t see the point in taking time to teach you the details of tying sneakers when you won’t even be wearing sneakers on your climb… and mountain climbing boots are put on in a completely different way.

You get frustrated asking us why this simple thing cannot be explained. You’ve looked through all of the mountain climbing journals and don’t understand any of it because you don’t know the lingo yet… and you get more frustrated that no one will help you with your sneakers. And it starts to become clear to the rest of us that you don’t even know how to put your pants on yet… and you should definitely put your pants on before your shoes.

You think we are insulting you by telling you that you should know how to put your own clothes on before climbing a mountain. But it’s true. You think I’m insulting you now by comparing your level of knowledge to learning how to put your clothes on… but it’s not insulting, it’s a fact. The knowledge you lack is the equivalent of zipping a zipper and tying laces to us.

It’s not insulting. It’s just a fact. Everyone has to start somewhere and you are still learning the basics and wondering why no one will help you climb the mountain.

What’s even worse is that you haven’t gotten far enough to know that the mountain you want to climb isn’t even just over the next rise, it’s the equivalent of being on a different planet.

5 Likes

ok, It may seem like im some script kiddie, but i’m not. I’ve been programming PHP, Javascript(jQuery/Ajax), CSS. and MYSQL for a long ass time. I mainly deal with creating social communities. I think I got a pretty good handle of Java in Jmonkey, but damn, some people need a little kick start to get shit going. As soon as I get a fix for this, i’ll be creating what I was offering $30 for. And i’ll give it out to other jmonkey users to understand how multiplayer works (without advanced methods of networking). It’s a little sad i’ve been trying to look for this for so long, this page has already hit Google and i’m SURE this forum will be getting some major hits for users wanting to understand multiplayer with jMonkey.

The only question I have now is,
Where else can variable Application appclient be stated?
Currently it is in MAIN. But then the variable becomes null after the MAIN section, so, i’m guessing thats why i;m getting an error. Because after MAIN, appclient doesnt mean anything.

@HunterLong said: ok, It may seem like im some script kiddie, but i'm not. I've been programming PHP, Javascript(jQuery/Ajax), CSS. and MYSQL for a long ass time. I mainly deal with creating social communities. I think I got a pretty good handle of Java in Jmonkey, but damn, some people need a little kick start to get shit going. As soon as I get a fix for this, i'll be creating what I was offering $30 for. And i'll give it out to other jmonkey users to understand how multiplayer works (without advanced methods of networking). It's a little sad i've been trying to look for this for so long, this page has already hit Google and i'm SURE this forum will be getting some major hits for users wanting to understand multiplayer with jMonkey.

The only question I have now is,
Where else can variable Application appclient be stated?
Currently it is in MAIN. But then the variable becomes null after the MAIN section, so, i’m guessing thats why i;m getting an error. Because after MAIN, appclient doesnt mean anything.

Sigh… to tie your shoes, first you hold the laces in each hand…

The variable can be defined at the class level (first or second thing you learn if you try to learn Java) or in local scope. You must have defined it in both. We can’t see the rest of your class, so I can only guess since you would have gotten a compile error.

I seriously hope no one uses your $30 example to learn networking since most people who come here will want to make a game and it will be 110% useless for that. The chat example already shows the basic mechanics of SpiderMonkey. Anyone with the skill to code a network game in Java will not need anything else to learn the API.

@HunterLong said: ok, It may seem like im some script kiddie, but i'm not. I've been programming PHP, Javascript(jQuery/Ajax), CSS. and MYSQL for a long ass time.

Mountain climbing metaphor translation:
“I’ve walked to my living room, walked up stairs, eaten a sandwich and even put on ear muffs many times.” Javascript being the “walking up stairs” part of this example since it’s the closest to OO programming in the entire list.

WOW… changing this:

[java]appclient.enqueue(new Callable() {
public Void call() throws Exception {[/java]

to:

[java] this.enqueue(new Callable() {
public Void call() throws Exception {[/java]

do i get to tie my own shoes now…?..

I think, I know what could be your problem… You said, you declared the variable in your main method:
[java]public static void main(String[] args) throws IOException, InterruptedException{
Application appclient = new Main();
appclient.start();
}[/java]

And now I assume, you declare it at another place like this:
[java]Application appclient;[/java]

… Now that I’ve read, you (apparently) programmed a lot in PHP and Javascript - This is not a global variable. You can’t declare the variable in the main-method and then hope, the same value is called, when you declare another variable with the same name somewhere else (like it is in PHP or JS most of the time).
@pspeed mentioned this before, too - Keyword: scopes

Please note, that Java is another kind of language than those scripting languages. This is no offense towards you, but learn those basic things before writing a complete 3D multiplayer network game - Once, you control Java, jMonkeyEngine is not a big deal. But starting to learn Java by using an on-top framework… No good idea. :wink:

Hope, that helps.

No, you just put on loafers.

appclient would have worked, too, if it had been defined correctly. Also, that was pseudo code and could have been moved to different classes, etc.

The problem you are having is that none of the languages you list (and I am experienced in them all) are proper object oriented programming languages. In fact a lot of habits you have learned doing them - and things that work well in those contexts - are horribly counter-productive in a proper full programming language OO situation. It’s entirely possible to learn the new language and it sounds like you have the technical skills to do so - but you really do need to learn that new language.

3 Likes

Not to say that OOP is the king and awesome for everything(cause its not the top choice for pretty much most things except for select few instances which happen to be useful when developing large “evolving” systems, but for quick script-like actions there are much better options, not the least of which is functional programming but i digress), ive gotta say that in my previous post i assumed that you knew anything at all about programming a game, and so i painted a picture of what you would have to know to program a simple run around the yard type of multiplayer experience. Obviously that fell on deaf ears and i shall take this space to drive the nail through the proverbial skull in the shape of an idea about what you do not know.

Why multiplayer is not for beginners:

  1. Thare are many points of failure that will drive you nuts, the main one being weird exceptions(you found one) that are hard/impossible to debug(you are miles away from those).
  2. Results, without doing “advanced” topics you produce utter crap that is useless for anyone. Latency messes up your states so bad that all you will ever see on the screen is jittery garbage. Without advanced lag compensation techniques that you say are not necessary for a simple “example” you will not accomplish any kind of multiplayer anything.
  3. State synchronization across network is NOT a problem that has been solved for over 2 DECADES by very very very smart people. Those two articles(Referring the Valve ones, on networking, which one of them is a paper that was published) are pretty much as close as we as society got to ever solving those, and they are a decade old already. So if you cannot understand them, you have no hope of making anything close to a box that can move around on your screen, and is controlled by another player over a network, maybe localhost, but network definately not.

Only solution we have(and i mean it, and do quote me on this) is making game states deterministic(very very very diffucult, note the amount of very’s i usee), which in turn makes it possible to create lag compensation algorithms(or employ them), so sending the W key will not do you any practical good, as the message will probably get queued in the tcp layer until it has 5 more messages saiing something like a,s,d and send this all at the same time, so it will literally go forward left back and then right again instantly instead of the discrete steps that you actually pressed the keys in, effectively not moving the object. The fact that you have 4 pages of people trying to put this in a nice way, and you constantly ignoring it baffles me. That and also the fact that you had the tenacity to come to a place and shout that the library is awful because you dont understand it. On a side note though, the $30 for the code made me chuckle :), because the math and the coding involved in building a multiplayer motion example would involve several thousand(thats 3 0’es) dollars worth of effort in terms of time for an average developer, hence why there isnt an example like that, and instead a much simpler chat example.

Also note MySQL is a relational database with nothing but procedural language, PHP is just a mess, and JavaScript is not java. Saying that you are a web developer does not make you a games developer, because games space is grounded in cold hard MS. level of Computer Science not to mention math. While building web communities is built on top of a technology stack that puts priority on getting things “done” in whatever manner is necessary, which lets mediocre developers write code that actually works good “enough”.

Not to start a flame war, just saying, thats the general picture of where you are at.

PS: the mountain climber thing is funny cause its more like a pit climber, since after a while you start to want to get back out, but cant, cause it will take you to the depth you never wanted to be in.

2 Likes

PS you should lock this thing before people get angry enough to start throwing cake
( mainly me >.>)

1 Like

Nick needs a girlfriend. Typing wayyyy to much bullshit.

Anyway, I got it to work multiplayer without MZ nonsense. I’ll probably post the source code in a little bit. NOW, I can work on the lagging issue, and read how steam recommends networking.

@HunterLong said: Nick needs a girlfriend. Typing wayyyy to much bullshit.

Anyway, I got it to work multiplayer without MZ nonsense. I’ll probably post the source code in a little bit. NOW, I can work on the lagging issue, and read how steam recommends networking.


i look forward to seeing it. :affe:

Can i get a couple of more negatives on my account.

@HunterLong said: (...) I'll probably post the source code in a little bit. NOW, I can work on the lagging issue, and read how steam recommends networking.
Alright then, seems we're at a way's end as far as this thread is concerned. Glad to hear it. Please post your code in a new thread.

I’m gonna go ahead and close this thread to avoid any unnecessary mudslinging.