2 Replies - 224 Views - Last Post: 25 February 2012 - 06:14 AM Rate Topic: -----

#1 cornetto456  Icon User is offline

  • D.I.C Regular

Reputation: 21
  • View blog
  • Posts: 438
  • Joined: 03-January 11

World server best way to handle this.

Posted 23 February 2012 - 11:25 AM

Hello, im making a mmorpg.

I am not asking for the code im asking for the best way to do something.

So I have at the moment this class:
package com.definem.ws.alpha;

public class Event {
	private enum EventTypes{
		WCHARAK,CONNECT,DISCONNECT,CCHAR,DCHAR,DEVLOGIN
		
	}	
}




Not really mutch an actually not using it.

I found this code to be not tutorial worthy.


The server is working (and you see a couple of people walk and such) but my question is:

  • What's the best way to implement a event system

What I mean by this, you have an user that clicks on npc1 so the client will do this lets say:
	if(Player.clicked(npc1)){
		Printwriter.println("talk" + 1);
		}


how could i make an event system that is usable on server as client aswell.

like PlayerDied,PlayerLoot,PlayerCommand,PlayerRevived

do I use enums and print a that enum when you do something?
  • Do you store the npc's state(event) on the server on the client?

This is for later, when you have 10 npc's on one map, you will need a thread i suppose and then put them in a hashmap
itterate over that hashmap and set them all to a specific event ?
  • Do you create a Hashmap,list with all the connected user's on a specific map ?


This is more of a desinger faulth of my server, I don't store all the connected user's anyware.

I just let them connect but I don't see where they are and such.

I wrote a small text beneath each question that explains all things and sometimes give's an example anwser

but are there better solutions?

Thanks,Arno(Cornetto456)

Is This A Good Question/Topic? 0
  • +

Replies To: World server best way to handle this.

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8325
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: World server best way to handle this.

Posted 23 February 2012 - 06:21 PM

Sorry, I read your post 5 times and I do not have a clue of what your question(s) might be
Was This Post Helpful? 1
  • +
  • -

#3 cornetto456  Icon User is offline

  • D.I.C Regular

Reputation: 21
  • View blog
  • Posts: 438
  • Joined: 03-January 11

Re: World server best way to handle this.

Posted 25 February 2012 - 06:14 AM

View Postpbl, on 23 February 2012 - 06:21 PM, said:

Sorry, I read your post 5 times and I do not have a clue of what your question(s) might be

Sorry for that my native languages isn't english.

My real question is this:

I want to create an event system when a player join's, leave's, kill's someone.

I thought of something like this:

public class Event {
  private Player p;
  public Event(Player p){
 this.p = p;
}


 public void getPlayer(){
 this.p;
}

 public void setPlayer(Player p){
 this.p = p;
}
}




and then create all event classes and extend this event class.

Is this the wright approach ?

Thanks

This post has been edited by cornetto456: 25 February 2012 - 06:17 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1