Server Development

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
User avatar
ElvenProgrammer
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Server Development

Post by ElvenProgrammer »

Everything refers to eathena.

Maps

You should use my or Sull's map editor to create custom maps for the server and also modify the code to read our own custom map format

Scripts

We should have some basic npcs on the first map just to test npc talk

Protocol
In the near future we should be able to modifi the protocol a bit to make athena use our own
User avatar
ElvenProgrammer
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

Ok this is the first attemp on making athena read custom maps:

Code: Select all

static int map_readmap(int m,char *fn)
{
	int s;
	int x,y,xs,ys;
	int wh;
	size_t size;
	FILE *file;

	printf("\rmap reading [%d/%d] %-20s  ",m,map_num,fn);
	fflush(stdout);

	file = fopen(fn, "rb");
	if(file==NULL)
		return -1;
	fread(&xs, sizeof(int), 1, file);
	fread(&ys, sizeof(int), 1, file);
	map[m].xs = xs;
	map[m].ys = ys;
	printf("\nMap size: %i %i\n", xs, ys);

	map[m].m=m;
		
	map[m].gat = calloc(s = map[m].xs * map[m].ys, 1);
	if(map[m].gat==NULL){
		printf("out of memory : map_readmap gat\n");
		exit(1);
	}
	map[m].npc_num=0;
	map[m].users=0;
	memset(&map[m].flag,0,sizeof(map[m].flag));
	wh=map_waterheight(map[m].name);

	

	for(y=0;y<ys;y++){
		for(x=0;x<xs;x++){
			fread(&map[m].gat[x+y*xs], sizeof(char), 1, file);
			}
	}
		fclose(file);

	map[m].bxs=(xs+BLOCK_SIZE-1)/BLOCK_SIZE;
	map[m].bys=(ys+BLOCK_SIZE-1)/BLOCK_SIZE;
	size = map[m].bxs * map[m].bys * sizeof(struct block_list*);

	map[m].block = calloc(size, 1);
	if(map[m].block == NULL){
		printf("out of memory : map_readmap block\n");
		exit(1);
	}

	map[m].block_mob = calloc(size, 1);
	if (map[m].block_mob == NULL) {
		printf("out of memory : map_readmap block_mob\n");
		exit(1);
	}
	
	size = map[m].bxs*map[m].bys*sizeof(int);

	map[m].block_count = calloc(size, 1);
	if(map[m].block_count==NULL){
		printf("out of memory : map_readmap block\n");
		exit(1);
	}
	memset(map[m].block_count,0,size);

	map[m].block_mob_count=calloc(size, 1);
	if(map[m].block_mob_count==NULL){
		printf("out of memory : map_readmap block_mob\n");
		exit(1);
	}
	memset(map[m].block_mob_count,0,size);

	strdb_insert(map_db,map[m].name,&map[m]);
	
//	printf("%s read done\n",fn);

	return 0;
}
This one is located in /src/map/map.c

It reads: "athena folder"/data/new_1-1.gat

This file is in my custom format which you can export from map editor v.03. (It will be online soon I hope). I need also to make some other test on how to change the name and extension of map file.

Regarding the map format is simply two ints defining width and height of a map and then a width x height matrix of char indicating walkability (0=walkable, 1=non-walkable)

That's enough for this time.
To be continued... :arrow:
jui-feng
Peon
Peon
Posts: 26
Joined: 09 Jun 2004, 15:37

Post by jui-feng »

I (hopefully) changed some things to load maps from the "maps" directory (in athena folder) and let them have their ".map" ending. Of course Elvens improvements are included. =D

I also removed loading of the .grf files (hopefully this is not bad, i dont have the chance to test it .. the only thing i see, is that it loads successful). Instead, put the .txt files from an extracted data.grf into a directory called "data" in your athena folder. Configfile now is like that:
map:new_zone01.map
(change .gat to .map ;))

uhm.. i think thats it. ah, yes, i "cleaned" the structure of the package a bit.

note: the binarys are now "athena-login", "athena-char" and "athena-map" (to have them all at one place) - delete the old ones if you want to.



the .diff file is a patchfile to update the sourcecode of an existing eathena-installation. if you already have elvens changes added, maybe it fails.. but thats not bad i think.

download the file from: http://anime-com.info/themanaworld/athe ... 10-04.diff
save it to your "athena/src/" directory.
now, "cd" into your athena/src/ directory (using cygwin/linux). issue the command:
patch -p1 -u < tmw_athena.diff
recompile, and youre done. :) Don't forget to put the .txt files into a "data" folder, the new_zone01.map from TMW into a "maps" folder, and change your config.

here is a patched .tar.gz file including .txt's etc: (and a bit better structure of the athena files ~~) (will be offline when im offline)
http://ich.gotdns.com/download_tmw/eathena_tmw.tar.bz2

and, if somebody needs them, the tar.bz2'ed maps: (offline when im offline)
http://ich.gotdns.com/download_tmw/maps.tar.bz2

and, if somebody needs them, the tar.bz2'ed .txt files for the data-dir:
http://anime-com.info/themanaworld/athe ... ta.tar.bz2

Here a list of changed files and links to them:
map/atcommand.c
char/char.c
common/grfio.c
map/map.c
map/pc.c

wah ~~ such a long text for 2 little changes. xD
Last edited by jui-feng on 11 Jul 2004, 13:57, edited 1 time in total.
:> poor english i know ^^ hope you understood a half.. <:

________________________
asdf?!
come, lets talk with swords! omfg!
Ardaen
Peon
Peon
Posts: 24
Joined: 01 Jul 2004, 18:51

Post by Ardaen »

So your map format is essencially the .gat format (as I documented on the eAthena forum for ya ;) ) without the extra 4 floats for the 3d stuff eh?

What about doodads and thingamagigs and stuff that make the map look all pretty like different tilesets and stuff... How is that all gonna be done?
User avatar
ElvenProgrammer
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

Weel currently TMW supports 2 map formats! One is for the client and is complete with all the infos about tiles, animations, and so on...
the other is used by the server and it has all essential infos so the server doesn't need a lot of memory -> Yeah basically is the one you suggetsed me on the forum but it's also the default map format someone can think whne developing this kind of games (this was my first map format 4-5 years ago)
Ardaen
Peon
Peon
Posts: 24
Joined: 01 Jul 2004, 18:51

Post by Ardaen »

Why redesign the wheel eh? it works best when round.

So you have to convert the maps to server format instead of the server just loading what it needs from the complex format?
User avatar
ElvenProgrammer
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

What do you mean? We're only trying to get rid of thoose RO copyrighted file formats so they won't bother us for using them! :?
User avatar
Genis
Novice
Novice
Posts: 82
Joined: 29 Apr 2004, 19:43
Contact:

Post by Genis »

Hey I was wondering if someone could please post the newest available tmw eathena server source that they are using and can successfully connect to with tmw. I tried the above stuff, but I am having issues. So if someone like jui or sull can just zip up their server directory and upload it here thatd be great. Please put it in the TMW directory. Thanks

ftp.vespersoft.net
user:u35665172tmw
pass:tmwdevs
Last edited by Genis on 06 Aug 2004, 21:40, edited 1 time in total.
Sorry...I only speak English
User avatar
Shura
Novice
Novice
Posts: 96
Joined: 15 Jun 2004, 01:36

Post by Shura »

the ftp account u posted doesn't seem to work. i get the 530 login incorrect error. ^^
Don't argue with idiots. They drag you down to their level and beat you with experience.
User avatar
Genis
Novice
Novice
Posts: 82
Joined: 29 Apr 2004, 19:43
Contact:

Post by Genis »

lol, my bad the pass is tmwdevs
Sorry...I only speak English
User avatar
Shura
Novice
Novice
Posts: 96
Joined: 15 Jun 2004, 01:36

Post by Shura »

umm.... unless admin/config.inc.php really is nothing important u should remove the info from the forum. ^^
Don't argue with idiots. They drag you down to their level and beat you with experience.
Guest

Post by Guest »

uhh, nothing, the whole site doesnt matter, but ill probably lock the account into tmw, but whatever
User avatar
ElvenProgrammer
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

There should be a working copy of the server on the ftp server...
User avatar
Genis
Novice
Novice
Posts: 82
Joined: 29 Apr 2004, 19:43
Contact:

Post by Genis »

yea, like i said in irc though, it doesnt seem to work right for me, im gunna try compiling my own
Sorry...I only speak English
Post Reply