What I did today

I technically did this yesterday, but here goes.

Although most of WSW’s engine has always supported rendering the scene from multiple views (e.g. both the camera’s view and the views of lights to render their shadow maps), I still had certain parts that I assumed would only need to be rendered from the main camera view were limited to a single view. I rewrote those parts to allow the engine to support any number of camera views and shadow map views. This makes it possible to do 3 new interesting things:

  • Support for splitscreen offline multiplayer, for any number of players. Even better, I could even have 3 different players on each of the 3 monitors I have since my 3 monitors are presented as a single logical monitor to LWJGL thanks to Nvidia Surround. AMD Eyefinity should work in the same way for AMD users. In theory I could have 4 player splitscreen per monitor for a total of 12 players on a single computer. Obviously, GPU performance would be the only thing that holds me back.

  • Proper support for anaglyphic 3D, active shutter 3D monitors and Oculus Rift. Although I can’t get OpenGL quad buffering working on my Nvidia cards (stupid driver limits it to Quadro cards -___-’), I can easily render side-by-side 3D which a 3D TV can convert to proper 3D (although at half resolution for each eye), or even make my own anaglyphic 3D support. I intend to actually try out quad buffering on my AMD test PC as well.

  • Better quality multi-monitor gaming. I have 3 monitors, but on the side monitors the game looks extremely stretched. This is due to the fact that GPUs assume that the monitor is flat, so angling the side monitors in towards me breaks that assumption. With one view for each monitor I could easily compensate for the angle of the monitors so that the quality remains perfect at the cost of some performance.

Good work theagentd, plus I learned something from that :slight_smile:

Today I added Python-scripting to my sandbox.
Why did nobody ever tell me that Python can be fun?!

(Also, more boxes, now of different scale and color) EDIT: replaced image with better example

http://i.imgur.com/dWuFMKvl.jpg

This picture was made with this script:


s = 32

for x in range(-s,+s):
	for z in range(-s,+s):
		fx = x * 16.0
		fz = z * 16.0
		
		w = mathutil.random(0.1, 8.0)
		l = mathutil.random(0.1, 8.0)
		h = mathutil.random(0.1, 8.0)
		
		datbox = bulletutil.mkBox(fx,0,fz, 0.0, 0.0, 0.0, w, h, l, 0.0, False)
		world.addRigidBody(datbox)

Edit:
Have a prototype.

  • Not guaranteed to work!
  • 18 MB RAR

fixed some rather annoying bugs when using the buttons.

Figured out how to render a pseudo-3D box in a 2D projection using min and max values of a player. I’m rendering with DirectX over a C# form which is set up to basically acting as an overlay to a 3D game. Using my reverse engineering “skills” to mess with Battlefield 4.

Made a truckload of android layouts for 280dp, 300dp, 350dp, 400dp, 450dp, 550dp and 700dp width screens. I needed so many for my word puzzle game because the words are nine letters (buttons) wide, so for phones I have to squeeze the maximum button size in for the available screen width.

I had some clever code to resize the buttons at runtime, but font resizing did not work well enough. In the end it was faster to crank out an XML clone army.

I just took a look at an old problem of mine, and realized a simple solution :slight_smile: Anyways, I present to you RotatingRectangle collision in 98 lines (including some cropped parts in this code).

The brainpower has returned to me :slight_smile:

I know, not impressive, I just felt I should post it :slight_smile:

(Let me know if I should make this a pastebin)

public class RotatingRegion {
	
	private Line2D.Float[] lines = new Line2D.Float[4];
	
	private float cx, cy;
	
	public RotatingRegion(float x, float y, float width, float height, float angle){
		cx = x + (width / 2);
		cy = y + (height / 2);
		float[] point1 = rotateAroundCenter(x, y, angle);
		float[] point2 = rotateAroundCenter(x + width, y, angle);
		float[] point3 = rotateAroundCenter(x + width, y + height, angle);
		float[] point4 = rotateAroundCenter(x, y + height, angle);
		lines[0] = new Line2D.Float(point1[0], point1[1], point2[0], point2[1]);
		lines[1] = new Line2D.Float(point2[0], point2[1], point3[0], point3[1]);
		lines[2] = new Line2D.Float(point3[0], point3[1], point4[0], point4[1]);
		lines[3] = new Line2D.Float(point4[0], point4[1], point1[0], point1[1]);
	}
	
	public float[] rotateAroundCenter(float x, float y, float angle){
		float dx = x - cx;
		float dy = y - cy;
		float distance = (float) Math.sqrt(dx * dx + dy * dy);
		float originalAngle = getAngle(cx, cy, x, y);
		float newangle = originalAngle + angle;
		float ndx = distance * (float)Math.sin(newangle);
		float ndy = distance * (float)Math.cos(newangle);
		float nx = cx + ndx;
		float ny = cy + ndy;
		return new float[]{nx, ny};
	}
	
	public boolean intersects(float x, float y){
		for(int index = 0; index < lines.length; index++){
			if(lines[index].contains(x, y)){
				return true;
			}
		}
		return false;
	}
	
	public boolean contains(RotatingRegion region){
		for(int index1 = 0; index1 < region.lines.length; index1++){
			for(int index = 0; index < lines.length; index++){
				if(lines[index].intersectsLine(region.lines[index1])){
					return true;
				}
			}
		}		
		return false;
	}
	
	private static float getAngle(float mousex, float mousey, float playerx, float playery){
		float deltax = mousex - playerx;
		float deltay = mousey - playery;
		double rawangle = Math.atan2(deltay, deltax);
		float degrees = (float) Math.toDegrees(rawangle);
		degrees += 90.0f; // add 90 so opengl can use it
		if(degrees < 0){
			degrees += 360.0f; // fix all angles less than 0
		}
		if(degrees > 360.0f){
			degrees -= 360.0f; // fix all angles more than 360
		}
		degrees %= 360.0f;
		return (float) Math.toRadians(degrees);
	}

}

CopyableCougar4

Anything that is made with good intentions and done well is impressive. I found this useful the idea of rotating collision just makes me want to go nope . Same with skeletal joint movement.

If anybody is interested for the non-trimmed source:

https://github.com/CopyableCougar4/Rotating-Region

CopyableCougar4 :slight_smile:

What I did today (expressed in commits):


Added TimeWasteThread to increase System-Time precision.
Added Key/MouseEvent to GUIPanel.
Added transparent grid to the world, and changed deletionDepth-Grid to use the same system.
Working on GUI-System.
Scripting derpiness.
BugFix: NullPointerException if too many objects get deleted too fast.
BugFix: Weird micro-stuttering in camera interpolation.
BugFix: Removal of objects can corrupt the Artemis-ECS.
BugFix: System.GC() after init() to free post-startup memory and reduce initial frame-lag.
Marked some colors for easier color-search.
Added vsync.
Added EntityComponentSystem (ARTEMIS).
Changed Debug-Rendering.
Added TimerTask-class.
Scripting derpiness ensued.
Work on GUI.
Made the FlyCamera use interpolation, results in a smoother movement/rotation.
Added code to allow the XPNG-system to use any kind of OpenGL texture-filtering.
Worked on the BasicGeometry?D classes.
Added sphere RigidBody/Shape creation and caching to BulletUtil.

And a picture, because pictures:

http://i.imgur.com/0JKR0Zvl.jpg

Also, note that the application eats up less than 10 megabyte. Yay for correct memory management!

Just threw together a small, simple A* pathfinding in like 20 minutes :slight_smile: still needs lots of changes/tweaks, but I was really proud of myself :slight_smile:

Sneak peak, about 20% done all I want to do with it :slight_smile:

CopyableCougar4

Looks awesome
Is the repo public? I would love to see the source!

Yes, its public (I just made it public).
But mind that:

  • The code has badly designed code everywhere in it.
  • Lots of dependencies.

https://bitbucket.org/longor1996/sandbox

Updated the game trailer for Biodrone Battle:

0Opd0037RIg

Finished the GUI in my Sandbox-game, and some other things…

(listing of commits)


Removed 'U' ("Reset World") keybinding.
Finished up GUI-Work and a bunch of other things.
Added a wireframe-box to show how big the world is.
Added wraparound to camera Y rotation.
Sphere rendering now actually uses textures (for real this time!).
Added 3 new methods to GUIRenderer.
Added texturing to sphere drawing, and reduced polycount for spheres.
Fixed bug that the mouse-pos is inverted.
Added method to set color before drawing a string.
Added normals to sphere rendering.
Added methods to draw gradients to BasicGeometry2D.
Refactoring, optimization and bug-fixes. Added controls.txt file. Added source-metrics.

(Also, screenshot)

http://i.imgur.com/aVBMHUd.jpg

XKCD inspired me to comment some code:

(Strangely enough I’m actually working on some parsing)

Managed to write a shader to show bone weights.

Still trying to get my skinning code to work…

this looks awesome! :smiley:

More horror in the land of C# and Unity for me. Put in the logic behind crafting items for Basingstoke.

Cas :slight_smile:

I gave in and decided to use textures.