Kind of RFC for armagetron?

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
Post Reply
shu
Posts: 2
Joined: Sat Jul 09, 2005 5:36 pm

Kind of RFC for armagetron?

Post by shu »

Good evening,

since I'm interested in creating something like a armagetron 2D which should be compatible to the "real" armagetronad, Iam looking for a documentation of the network traffics of armagetronad. Iam not a good c++-coder, so I cannot just read through the source.
Does something like this exist?

sincerely,
shu
User avatar
Z-Man
God & Project Admin
Posts: 11717
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Hi and welcome to the forum!

There is sort of what you're looking for, but it is very outdated; it's in the net subfolder of the regular HTML documentation. The whole network stuff depends very much on C++ constructs, so there does not exists such a thing as a network protocol specification that tells what goes into the various UDP packets.

The best way to create a 2D client would be the following: take the full source code, abstract away all rendering (we want to do that anyway sometime...) so the core does not depend on OpenGL any more, then plug in a 2D interface.
Or, if it's a one shot thing, do all of that without the abstraction bit. Take the source, delete the openGL includes and all code that breaks and work your way upwards.
Another possibility: Take the dedicated server compilation mode where OpenGL is already removed and add your output on top of that.
Last one: Back when I had two monitors and a 3dfx card where one monitor was showing the 3d rendering and the other the normal desktop, I used the compilation flag "-DPOWERPACK_DEBUG" to render a 2d overview of some stuff. The additional library powerpack that sits on top of SDL was used for that. Maybe some of this is still functional?
User avatar
Tank Program
Forum & Project Admin, PhD
Posts: 6712
Joined: Thu Dec 18, 2003 7:03 pm

Post by Tank Program »

Good luck... This would be useful for slower computers.
Image
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Post by Jonathan »

This may also be useful:

Code: Select all

void DrawWallList(tList<gNetPlayerWall> &list) {
	unsigned i, len=list.Len();
	double currentTime = se_GameTime();
	double wallsLength = gCycle::WallsLength();
	double wallsStayUpDelay = gCycle::WallsStayUpDelay();
	bool limitedlength = wallsLength > 0;
	gCycle *lastCycle = NULL;
	bool dontrender = false;
	double dist;
	glBegin(GL_LINES);
	for(i=0; i<len; i++) {
		gNetPlayerWall *wall = list[i];
		gCycle *cycle = wall->Cycle();
		if(!cycle)
			continue;
		if(cycle != lastCycle) {
			lastCycle = cycle;
			if(!cycle->Alive() && wallsStayUpDelay >= 0) {
				double secondsafterdeath = currentTime - cycle->DeathTime() - wallsStayUpDelay;
				if(secondsafterdeath >= .5) {
					dontrender = true;
					continue;
				}
				glColor4f(cycle->color_.r, cycle->color_.g, cycle->color_.b, 1 - 2 * secondsafterdeath);
			} else
				glColor3fv((GLfloat *)&cycle->color_);
			dist = cycle->GetDistance();
			dontrender = false;
		} else if(dontrender) continue;
		double mindist = limitedlength && dist > wallsLength ? dist - wallsLength : 0;
		eCoord beg = wall->EndPoint(0), end = wall->EndPoint(1);
		tArray<gPlayerWallCoord> &coords = wall->Coords();
		double start = wall->BegPos();
		double size = wall->EndPos() - start;
		unsigned j, numcoords = coords.Len();
		if(numcoords == 0) continue;
		for(j=0, --numcoords; j<numcoords; j++) {
			gPlayerWallCoord *coord = &coords[j];
			if(!coord[0].IsDangerous)
				continue;
			double p0 = coord[0].Pos;
			if(p0 < mindist) p0 = mindist;
			p0 = (p0 - start) / size;
			glVertex2f((1 - p0) * beg.x + p0 * end.x, (1 - p0) * beg.y + p0 * end.y);
			double p1 = coord[1].Pos;
			if(p1 < mindist) p1 = mindist;
			p1 = (p1 - start) / size;
			glVertex2f((1 - p1) * beg.x + p1 * end.x, (1 - p1) * beg.y + p1 * end.y);
		}
	}
	glEnd();
}
It's a mess that I left alone while experimenting, and is dependent on the implementation of Coords(), but it works. :)
(oh, and double-precision is absolutely necessary (NOT! "because I can" is more appropriate))

To draw:

Code: Select all

DrawWallList(sg_netPlayerWalls);
DrawWallList(gridded_sg_netPlayerWalls);
ˌɑrməˈɡɛˌtrɑn
Post Reply