Jump to content

  •  

luis.seifert

Member Since 19 May 2014
Offline Last Active Mar 13 2017 11:47 PM
*****

Topics I've Started

[Using OpenMp to Parallelize the source

27 October 2015 - 07:50 PM

Hello Community, i was wondering why the Hecules isnot optimezed to use all the thread of the cpu...

Hands on that, i try by myself doing some mods at the source and got no problems while compiling and using the modified source to play, here is a example:
 

/src/char/char.c

original:

int mapif_sendall(unsigned char *buf, unsigned int len){	int i, c;	nullpo_ret(buf);	c = 0;	for(i = 0; i < ARRAYLENGTH(chr->server); i++) {		int fd;		if ((fd = chr->server[i].fd) > 0) {			WFIFOHEAD(fd,len);			memcpy(WFIFOP(fd,0), buf, len);			WFIFOSET(fd,len);			c++;		}	}	return c;}

parallel:

#include <omp.h>int mapif_sendall(unsigned char *buf, unsigned int len){	int i, c;	nullpo_ret(buf);	c = 0;		#pragma omp parallel reduction(+:c)  //reduction to prevent race condition on c		{			#pragma omp for schedule(static)  //will devide i/thread			for(i = 0; i < ARRAYLENGTH(chr->server); i++) {				int fd;				if ((fd = chr->server[i].fd) > 0) {					WFIFOHEAD(fd,len);					memcpy(WFIFOP(fd,0), buf, len);					WFIFOSET(fd,len);					c++;				}			}			}		return c;}

[color=rgb(0,0,0);font-family:'Times New Roman';font-size:medium;]In a concurrent program, several streams of operations may execute concurrently. Each stream of operations executes as it would in a sequential program [/color]except for the fact that streams can communicate and interfere with one another[color=rgb(0,0,0);font-family:'Times New Roman';font-size:medium;]. Each such sequence of instructions is called a [/color]thread[color=rgb(0,0,0);font-family:'Times New Roman';font-size:medium;]. For this reason, sequential programs are often called [/color]single-threaded[color=rgb(0,0,0);font-family:'Times New Roman';font-size:medium;] programs. When a multi-threaded program executes, the operations in its various threads are interleaved in an unpredictable order subject to the constraints imposed by explicit synchronization operations that may be embedded in the code. The operations for each stream are strictly ordered, but the interleaving of operations from a collection of streams is undetermined and depends on the vagaries of a particular execution of the program. One stream may run very fast while another does not run at all. In the absence of fairness guarantees (discussed below), a given thread can starve unless it is the only ``runnable'' thread.[/color]

 

So... Why not use? Just by respecting some rules and including one more library we can make a very efficient code with the same code... 


[Solved]Neve caindo em prontera

17 February 2015 - 08:15 PM

Olá comunidade :)
Alguém já passou por esse problema da neve em prontera? Eu simplesmente não consigo remover, já tentei @snow, clearweather... E não sai de jeito nenhum!
Attached File  Sem título.png   432.24K   15 downloads


Reduzir dano de Reflect

17 February 2015 - 07:23 PM

Olá comunidade do Hercules!

Gostaria de reduzir o dano máximo refletido pelos paladinos e pelos stalkers, eu uso hercules de julho de 2014.

Já alterei em battle.c para refletir no máximo o HP total do stalker, agora queria diminuir o reflect dos paladinos também.

O que eu alterei:
 

 

	if(wd.damage && tsc && tsc->data[SC_SWORDREJECT] &&	(src->type!=BL_PC || (			((TBL_PC *)src)->weapontype1 == W_DAGGER ||			((TBL_PC *)src)->weapontype1 == W_1HSWORD ||			((TBL_PC *)src)->status.weapon == W_2HSWORD		)) &&		rnd()%100 < tsc->data[SC_SWORDREJECT]->val2		) {		ATK_RATER(50);		wd.damage = min(status_get_max_hp(target),wd.damage);		status_fix_damage(target,src,wd.damage,clif->damage(target,src,0,0,wd.damage,0,0,0));		clif->skill_nodamage(target,target,ST_REJECTSWORD,tsc->data[SC_SWORDREJECT]->val1,1);		if( --(tsc->data[SC_SWORDREJECT]->val3) <= 0 )			status_change_end(target, SC_SWORDREJECT, INVALID_TIMER);	} 

 

Alguém sabe aonde fica o reflect do paladino para eu poder alterar?


Obrigado :)


Dano na Batalha Campal

06 February 2015 - 09:46 PM

Olá pessoal, 
estou com um problema sério no meu servidor, é assim:

2 times, a pessoa está em uma das equipes

mapflag battleground 2 no mapa

todos os comandos de bg_warp ou que envolvem o  labels do time funcionam corretamente.

até ai tudo bem, mas alguns jogadores estão conseguindo ver o dano causado dentro do mapa e outros tem que apertar shift para conseguir atacar...

Já viram coisa parecida? Alguma dica de onde procurar possíveis soluções?


Obrigado!


Problem with endless tower quest

28 January 2015 - 08:43 PM

Hello community :)

I'm facing a problem with this endless_tower script, my players are getting stuck at 45 floor, every single  time!

I didn't touch the code.

Spoiler