Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » Beyond Jazz Jackrabbit 2

Project 3D (or "Splitscreen Stereoscopy")

Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Jun 24, 2012, 02:53 PM
Jerrythabest is offline
Reply With Quote
Project 3D (or "Splitscreen Stereoscopy")

Hey people,

Last week a great idea popped into my mind and as far as I can tell it seems rather easy to implement for the people who know how.


How it started
The last few weeks I've been looking for a new TV, comparing prices and possibilities and stuff. As 3D TVs have become rather cheap this year (<500 euros for the cheapest), I've looked more into how 3D works and, for example, if it would be possible to play downloaded 3D movies on it by connecting my laptop to the TV.


Some background information
3D is achieved by showing a slightly different image to each of your eyes. The two images are either displayed sequentially (flashing left-right really fast) or interlaced (two images simultaneously), and cover the whole screen. Special glasses seperate the two images so each eye sees only one of them.

But for my idea it's not important how the TV displays this, but rather what the 'raw' video looks like. With 3D mode disabled, the two images cover half the screen; either side by side (SBS) or above each other (TAB). Nothing difficult. If you download a 3D movie and play it on a non-3D display, you'll just see the two images next to each other. Much like JJ2's splitscreen...

All TV vendors say they have a 'unique' feature (yes, everyone calls it unique even though every 3D TV can do this) called "Two player full screen gaming". You connect a game console or PC and play a game in Splitscreen mode. But at the same time you turn on 3D mode. With special 'gaming' 3D glasses (or the 'gaming' mode of active 3D shutter glasses), each player sees only their own view but it covers the whole screen.

But... can we make special use of 3D TVs when we're not playing JJ2 in splitscreen mode?


The idea
My idea is to add a 3D mode to JJ2, which is available whenever you have 1 or 2 players playing on the same screen.

To keep it easy, for now let's say you're the only player (that is, the only one on your PC). And you're connected to a 3D TV. So you've got the whole screen for yourself.

Here comes the magic. You turn on JJ2's 3D mode. JJ2 should should now show you twice. Thus, splitscreen, but with both halves of the screen pointing at you (though with a very slight offset). You press your TV's 3D button and put up your 3D glasses. Done. Jazz Jackrabbit 2 in 3D!

Since JJ2 already has splitscreen support, implementation of this idea seems rather easy.


The implementation
Now, how would we do this, how would this turn out best, and what would it look like?

Whether horizontal or vertical splitscreen should be used depends on the TV panel (and thus should be a setting!): if the TV panel uses the polarised 3D technology with interlaced rows of the same polarisation, the setting should be 'horizontal' (TAB). In all other cases it should be 'vertical' (SBS) since that is the most efficient use of screen space (that is, pixels). The 3D TV has a similar setting that must be set to the same value as JJ2.

The camera focus for the left eye view should be offset slightly to the left of the player. The camera focus for the right eye view should be offset slightly to the right. This creates the effect of 'looking with two eyes' which we experience as 3D. The exact offset can be adjustable, so it is possible to change the 'depth' of the 3D effect.

The HUD (chat, ammo, etc.) should must be on both halves. If not, you can only see the HUD with one eye and that's awful. If possible, their positions may optionally be offset somewhat (left HUD slightly to the right and the right HUD slightly to the left) so they will 'come out of the screen'.

JJ2 is exceptionally awesome for 3D out-of-the-box thanks to its layer system. Since foreground layers move quicker than background layers, there is a nice difference in 'viewing angle' between the left and right views for the foreground layers, while the furthest background is pretty much the same. This is absolutely perfect for 3D perception!


The effect
The effect of this (using my imagination here) is that JJ2's tile layers 1-7 (with their X-speed set incrementally from layer 7 to layer 1, layer 4 being Xspeed=1) will look as if they are floating in the air between yourself and your TV. The relative differences between the layer speeds determine their relative 3D distances. Layer 8 can't move and therefore stays 'sticked' to the TV screen.

Textured backgrounds are probably going to look as a 'roof' and (if the bottom part is visible) a 'floor' that extend from very far 'behind' the TV screen up to as close as the edges of your 3D glasses allow.
Most Textured backgrounds simulate sky (usually some clouds), but I think it'll depend heavily on the tileset whether it will actually look sky-ish in 3D since JJ2 still renders it as a flat surface (which you'll probably see as such in 3D).


Now let's see what's needed for a two-player version.


Two players in 3D: which glasses?
If you're playing with 2 players in a splitscreen setup, without using this new 3D mode in JJ2, but with your TV's 3D mode turned on, it's possible to use the "Two player full screen gaming" feature. Both players see only their own camera view filling the entire screen, but the left and right eye of one player both see the same image (thus, it's 2D). This is currently already possible with JJ2 by simply starting a splitscreen game, pressing the TV's 3D button, and using the "Two player full screen gaming" glasses.

However, to be able to see the 3D effect I described earlier, both eyes need to see a different image. Thus, the "Two player full screen gaming" glasses are not an option as both eyes see the same image with that. But using normal 3D glasses has one drawback: both players are going to see the same thing. So it's going to be a choice for the players to make: "Two player full screen gaming", or play JJ2 in 3D but with a split screen.


Two players, four eyes
Two players make four eyes. So if we want to play JJ2 in 3D with two players, we need to split the screen into four parts. Since JJ2 can already do this, I suspect this is not very difficult to implement.

The question is: which screen part should show which image (i.e. Player 1 left, Player 1 right, Player 2 left, Player 2 right)? This depends on the horizontal/vertical 3D setting. This setting, as I told before, should depend on the type of 3D TV panel that is used.

In 'horizontal' 3D mode, the TV treats the upper half of the screen as 'Left eye' and the lower half as 'Right eye'. This means that JJ2 should display the left eye images in the upper two screen parts and the right eye images in the lower two. The player 1 images are in the left half of the screen and the player 2 images in the right half. The result is that the players see two 3D scenes next to each other (so that's actually playing like vertical splitscreen).

In 'vertical' 3D mode, the TV naturally treats the left half of the screen as 'Left eye' and the right half of the screen as 'Right eye'. Thus, JJ2 should display the left eye images in the left two screen parts and the right eye images in the right two screen parts. The player 1 images are in the upper half of the screen while the player 2 images are in the lower half. The result is that the players see two 3D scenes above each other (so, that's playing like horizontal splitscreen).


Horizontal or vertical?
As said, ideally players set their horizontal/vertical 3D setting according to the type of TV panel that is being used. However, in a two player game this forces the game to appear as splitscreen in the opposite direction. Horizontal 3D results in vertical splitscreen, vertical 3D results in horizontal splitscreen.

Players may choose not to use the 3D mode that best fits their TV panel, if they have a preference for either horizontal or vertical splitscreen. The image quality might be slightly impared, though, if they do so. Therefore, I'd recommend to save the two player 3D mode seperately so that they will use the better setting in single player in any case.

An extra 'Automatic' option causes JJ2 to switch modes according to the level's properties (like the game does currently). This comes with a little drawback; players need to manually switch their TV's 3D input setting while they cycle to a level with the opposite splitscreen direction.




This is probably my longest post in my JJ2 history. I'm curious about what you guys think of this idea. And I'm especially interested in the comments of people who know how to implement this into the game, of course! It would be awesome if this ended up in JJ2+.


I hope you all like it!

Jerry
__________________
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Jun 30, 2012, 03:53 PM
Love & Thunder is offline
Reply With Quote
I think that this is a great idea! How no one else thought of this before is beyond me.

I'll be following progress of this.
__________________
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Jul 1, 2012, 02:13 AM
Jerrythabest is offline
Reply With Quote
So, several people are saying they find this a great idea (also through the reputation feature), but since no one has stand up to work on this, I think I'll try some little things myself first.

I am, however, infamiliar with modifying JJ2's behaviour through DLL injection or things like that, so I'll see what I can achieve by doing only memory hacking.

I'll use the ERE as a resource for Memory Addresses, but if anyone has a longer (or additional) list of known addresses it would help if you'd share it

Let's see if I can get JJ2 to do what I want..
__________________
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Jul 1, 2012, 04:50 AM
Love & Thunder is offline
Reply With Quote
Will it support the LK Avalon version of TSF?
__________________
Stijn Stijn's Avatar

Administrator

Joined: Mar 2001

Posts: 6,964

Stijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to behold

Jul 1, 2012, 07:39 AM
Stijn is offline
Reply With Quote
Quote:
Originally Posted by Robo4900 View Post
Will it support the LK Avalon version of TSF?
It's a bit early to start asking questions like that, if there's no project to speak of yet and the implementation of 3D is still a mystery.
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Jul 1, 2012, 11:49 AM
Love & Thunder is offline
Reply With Quote
Good point. I guess I'm just a bit overexcited, being as this is pretty much the first major(Well, major in my opinion) modification to JJ2 since Plus(And that hasn't been updated for 2 years), and although comparing this to Plus sounds like an unfair comparison(Like comparing a piece of Bacon to a huge slab of Pork), Plus is pretty much the only major modification for JJ2 that people use at the moment.
__________________
Sean Sean's Avatar

JCF Member

Joined: Oct 2010

Posts: 720

Sean is a forum legendSean is a forum legend

Jul 1, 2012, 12:17 PM
Sean is offline
Reply With Quote
Quote:
Originally Posted by Robo4900 View Post
(Like comparing a piece of Bacon to a huge slab of Pork)
The difference being Piece of Bacon > Huge slab of pork
__________________
drop by my SoundCloud or something if you want, it's my life's pride
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Jul 1, 2012, 12:27 PM
Love & Thunder is offline
Reply With Quote
Well, that comparison was all about quantity. For a quality comparison, I'll have to wait for this thing to be released and get a 3D TV.
__________________
MrAlextov MrAlextov's Avatar

JCF Member

Joined: Apr 2010

Posts: 182

MrAlextov has disabled reputation

Jul 2, 2012, 11:00 AM
MrAlextov is offline
Reply With Quote
i had the same idea before months.
Wait Fukkatsu to edit the game and make this.
__________________
Sega Satan somewhat
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Jul 2, 2012, 11:20 AM
Jerrythabest is offline
Reply With Quote
Yesterday I've managed to take control of the game's splitscreen setup to the extent that I can tell the game whether I want the screen to be split horizontally, vertically, or "both" (read: 4 'subscreens').

The problem I'm currenty facing is that it either spawns extra player characters, or it doesn't draw anything in the additional 'subscreens'. (I can control which of these occurs.)

I'm currently doing some reverse engineering to find out what the game does to initiate a player, hoping to find something like a link between a specific subscreen and a player. That hopefully allows me to link the additional subscreen to the same player. (After this I "only" need to accomplish a horizontal offset between the two cameras and we're ready for a test run!)


I think some people (Blur for example) know the memory address(es?) I'm looking for, since JJ2+ probably does a similar thing for its Spectator Mode (i.e. link the camera to a specific player character). I'm hoping for some input on this part, but in the meantime I'll continue the search myself.


UPDATE 0:35 AM CEST: I've found some rather interesting per-player addresses, but the ERE does not have descriptions for them. I will find out their meaning tomorrow, hopefully enabling me to complete the next step in the puzzle
__________________

Last edited by Jerrythabest; Jul 2, 2012 at 02:38 PM.
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Jul 3, 2012, 09:09 AM
Jerrythabest is offline
Reply With Quote
I've made some more progress today. I've been digging deeper into how JJ2 handles player cameras and splitscreen and I think making a 3D mode is not going to be as easy as I had hoped. Still, it should be possible.


I've found that in JJ2, every subscreen has exactly the same size (they share the same width/height setting). However, the position where each subscreen is drawn on-screen is set per player (in memory there are 32 blocks of 1444 bytes, each storing data about one player; 16 of these bytes contain the camera's drawing position). This has an important implication: it's not possible to draw two cameras for the same player. A second player slot must be used to be able to draw the second camera.

JJ2 will draw a camera image if a specific player slot is of a local player and that player is visible in the F9 list (this is an optimisation; if you minimize JJ2 it will remove you from the F9 list and thus also stop drawing your camera).
(Fun fact: it's possible to spectate, say, 30 players at the same time. You need to set the camera size to 128x80, remove the local player check, and set the drawing positions of each player's camera so they tile nicely. Full server spectation mode, yay!)


Back on topic...
So, what needs to be done to get 3D mode working?
-Introduce a second player (or a third and a fourth, in 2 player mode) to allocate the extra player structures (not so difficult)
-Force them outside the level area (somewhat harder to do I guess)
-Get their respective cameras to follow the wrong rabbit! (no idea how as of now)


This project is getting closer to the point that I'm really hoping for some input from more experienced JJ2 hackers!
__________________
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,991

Violet CLM has disabled reputation

Jul 3, 2012, 03:35 PM
Violet CLM is offline
Reply With Quote
Quote:
Originally Posted by Jerrythabest View Post
-Force them outside the level area (somewhat harder to do I guess)
What if you killed them? That way they wouldn't respond to errant control input. Assuming of course there's some way to get around the black death screen, because if not, well, never mind.
Quote:
-Get their respective cameras to follow the wrong rabbit! (no idea how as of now)
Code definitely exists to move the camera around. Maybe check out the Devan (Robot Boss) event and see if you can figure out how it works?
__________________
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Jul 3, 2012, 11:29 PM
Jerrythabest is offline
Reply With Quote
Interesting ideas. But when killing the extra player characters, I'll also need to find a way to prevent them from respawning in multiplayer games.

I'll have a closer look at the camera controls. Clearly the camera doesn't always focus exactly on the player. Another intereseting event is the Limit X-Scroll event, I'm curious about the implementation of that too. But the Robot Boss is certainly a great place to start.
__________________
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Jul 5, 2012, 06:06 AM
Jerrythabest is offline
Reply With Quote
I think I've found the code block that controls the camera movement. It's just over 400 operations in length, so it may take a while to find out exactly what's happening in there.

The code contains all the write operations to the camera position addresses, including the robot boss cam controls. So this is probably the place to be to gain control of JJ2's camera!



UPDATE: I've looked into the half of the code that controls the camera for the EOL animation and the Robot Boss. It's not difficult to keep the camera at a specific place, or to have it move in 30 equally-sized steps frome one place to another. There's also code for doing a similar slide to the player's location, after which the camera will follow the player again.

The code that has the camera follow the player is left to be investigated. As of now, I haven't found any obvious way to have the camera follow another player. But I have good hopes I'll find that in the other half.
__________________

Last edited by Jerrythabest; Jul 5, 2012 at 01:16 PM.
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Feb 7, 2013, 01:14 PM
Jerrythabest is offline
Reply With Quote
So, about a week after that previous post came the PM in which I was invited for the JJ2+ dev team. And as some of you may have noted, somewhere deep buried into the huge list of awesome new things in the latest JJ2+ releases, is 3D Mode. As can be found in the Plus Readme, the 3D implementation is not complete and possibly not optimal either.

The reason I'm now suddenly posting this here is because I FINALLY BOUGHT MYSELF A 3D TV!! Besides me being really excited about that, this also means I can now improve 3D Mode more easily and also test it much more thoroughly than before.

Just wanted to share this with everyone who cares to read this thread =)


Now back to bugfixing...
__________________
burnout92 burnout92's Avatar

JCF Member

Joined: Dec 2012

Posts: 236

burnout92 is doing well so far

Feb 7, 2013, 07:45 PM
burnout92 is offline
Reply With Quote
I have a question. I saw in the plus readme: "For most 3D screens, to enjoy 3D Mode the following conditions need to be met:
1. The display resolution is set to 1920x1080 ("1080p"), and
2. The JJ2 video image spans either the width or height of the screen (or both).
Since JJ2 currently does not support the 1920x1080 resolution, the easiest way to accomplish this is to set the Windows desktop resolution to 1920x1080 (if it isn't already), and run JJ2 in a Maximized window so that it spans the width."

I can enjoy the 3D in fullscreen with Bigjazz? This is a great improvement and I wish good luck for further development.
__________________
"Where I walk, I walk alone. Where I fight, I fight alone" Akuma from Street Fighter Alpha The Animation
Love & Thunder Love & Thunder's Avatar

JCF Member

Joined: Sep 2011

Posts: 1,101

Love & Thunder has disabled reputation

Feb 7, 2013, 08:11 PM
Love & Thunder is offline
Reply With Quote
Actually, if you use Bigjazz, most online Plus games will force the game to have massive black borders around the screen(At least, that's what I've heard).
__________________
burnout92 burnout92's Avatar

JCF Member

Joined: Dec 2012

Posts: 236

burnout92 is doing well so far

Feb 7, 2013, 08:21 PM
burnout92 is offline
Reply With Quote
I played the JJ2 with (2010 June 30th bulid) Bigjazz in 1024x768x8 and I not see those black borders which you talk about. Stretched to my screen. But i will try the Bigjazz this plus version.
__________________
"Where I walk, I walk alone. Where I fight, I fight alone" Akuma from Street Fighter Alpha The Animation
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Feb 8, 2013, 12:06 AM
Jerrythabest is offline
Reply With Quote
Yes, 3D Mode will work fullscreen with Bigjazz. But be advised that Bigjazz at 1920x1080 is extremely unstable.
__________________
Grytolle Grytolle's Avatar

JCF Member

Joined: Sep 2004

Posts: 4,126

Grytolle is a forum legendGrytolle is a forum legendGrytolle is a forum legend

Feb 8, 2013, 01:19 AM
Grytolle is offline
Reply With Quote
It was really stable on low detail etc until the last plus release (I used to have it on 800x600 all the time, and jacking it up to higher resolutions made no difference)
__________________
<center></center>
Jerrythabest Jerrythabest's Avatar

JCF Member

Joined: Apr 2005

Posts: 2,602

Jerrythabest is a forum legendJerrythabest is a forum legendJerrythabest is a forum legend

Feb 8, 2013, 01:24 AM
Jerrythabest is offline
Reply With Quote
Hmm, that might have something to do with the way the last Plus release handles Low Detail. Previously, it would simply only render layers 3, 4 and 8 in Low Detail. Now it renders any speed=1 layers in Low Detail.
__________________
Grytolle Grytolle's Avatar

JCF Member

Joined: Sep 2004

Posts: 4,126

Grytolle is a forum legendGrytolle is a forum legendGrytolle is a forum legend

Feb 8, 2013, 02:29 AM
Grytolle is offline
Reply With Quote
Yeah, that's what I figured too
__________________
<center></center>
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 10:48 AM.