Gildor's Forums

Author Topic: udk split screen  (Read 16576 times)
double-o-kid
Newbie
*
Posts: 8



View Profile
udk split screen
« on: August 19, 2012, 03:24 »

hello all  Smiley

I wanted to ask if it was possible to make a game where you have a solo option and a split screen option

I found tutorials on how to have 1 playable character but how do I have 2 playable characters with different animations, skeletons, sound, etc?

I have asked this question a couple of times on epic's forums, but i get no answers.
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7972



View Profile WWW
Re: udk split screen
« Reply #1 on: August 19, 2012, 09:38 »

I think you'll need to attach secondary camera to the PlayerController of 2nd character in some way (I don't know how). It is uncommon task to create 2 playable PlayerControllers on single client, I think this will be your major task. Attaching the camera will not be so hard.
Logged
double-o-kid
Newbie
*
Posts: 8



View Profile
Re: udk split screen
« Reply #2 on: August 19, 2012, 13:36 »

Thank you for the reply! I'm going to check into this and see what I can find. I'll post up my findings later.
Logged
double-o-kid
Newbie
*
Posts: 8



View Profile
Re: udk split screen
« Reply #3 on: August 20, 2012, 11:57 »

I did some looking around, not too many people are doing what i'm trying to do. for the few I have come across that have something similar, they are no answers.
I did make two seperate pawn and player controller classes (from a tutorial I found). I don't have much in them, it looks pretty bare I know.

My Pawn (2nd pawn has same info)
class MBPawn1 extends Pawn;

DefaultProperties
{
GroundSpeed=440.0
JumpZ=322.0
}

My PlayerController (2nd player controller same info)
class MBPlayerController1 extends PlayerController;

Defaultproperties
{
Name="MBPlayerController1"
CameraClass=class'MBCamera'
}

and a Viewport code I found for splitscreen. I don't know yet how to change it to vertical split yet.

class MBViewportClient extends GameViewportClient;

 exec function DebugCreatePlayer(int ControllerId)
{
   local string Error;

   if(GamePlayers.Length < 2)
   CreatePlayer(ControllerId, Error, TRUE);
}

I still have to look more into the camera when it comes to coding it. I'm going for a isometric view but i'm not having much luck with that. I used the one on the udn page but it didn't work. setting the camera up in kismet was pretty easy! too bad the coding for it isn't  Sad

If I make anymore "break threws" before i go to sleep, I will post  Smiley i've been up for hours reading udn documents and uscript to the point that i'm seeing numbers and letters Shocked
oh, and thank you again for a point in the right direction gildor, i appreciate it.
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7972



View Profile WWW
Re: udk split screen
« Reply #4 on: August 20, 2012, 12:19 »

and thank you again for a point in the right direction gildor, i appreciate it.
I said nothing special Shocked By the way, you're welcome.

Are you sure you need a true "split-screen"? As I understand you have 2 characters which could be played by the same guy after some switching, and you may see your 2nd character while playing with the 1st. Am I right? If so you should better look for other solutions instead of split-screen.
Logged
double-o-kid
Newbie
*
Posts: 8



View Profile
Re: udk split screen
« Reply #5 on: August 20, 2012, 17:37 »

the kind of split screen type i'm looking to do is similar to the dynasty warrior series. where on the character selection screen 2nd player can choose to join first player, before each battle. if 2nd player decides to join, then the map will load as split screen. if the 2nd player chooses not to join, then the map will be single player.(hopefully that can be coded in, somehow) Undecided

here's a picture of the character select screen (2nd player has not joined yet)



here's the picture where 2nd player has chosen to join



here's the split screen I want to do except the vertical version



here's a picture of single player (2nd player chose not to join)




i think the one your talking about is kind of similar to resident evil 4 where you are able to switch between leon and ashley during different parts of the game.
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7972



View Profile WWW
Re: udk split screen
« Reply #6 on: August 20, 2012, 19:58 »

I'm not familiar with games you mentioned above, but it looks like you need standard split-screen.
Logged
double-o-kid
Newbie
*
Posts: 8



View Profile
Re: udk split screen
« Reply #7 on: August 21, 2012, 14:25 »

I was reading around on the forum, trying to find someone that had a standard split screen code and a guy mentioned dungeon defenders. he said to look at the split screen code in the game viewport. so I downloaded the files and looked in the viewport. I seen some code with split screen in it, but I don't know which part i'm suppose to use for my game Sad

 here's the pieces of code I found with split screen in it...

/** Static array of all of our cursor particles, up to a max num */
var CursorParticle CursorParticles[NUM_CURSOR_PARTICLES];
/** The Material that our cursor particles will use */
var Material CursorParticleMat;
/** The most recent canvas width */
var int LastCanvasWidth;
/** The most recent canvas height */
var int LastCanvasHeight;
/** Whether the game will currently allow split-screen (may be toggled off, for example, during a full-screen cinematic) */
var bool WantSplitScreen;
var float LastResetCursorParticleTime;

/** Updates the split-screen mode, forcing split-screen to be disabled when we don't want it (i.e. during a cinematic) */
function UpdateActiveSplitscreenType()
{
   if(!WantSplitScreen)
   {
      ActiveSplitscreenType = eSST_NONE;
      return;
   }

   super.UpdateActiveSplitscreenType();
}


/** Sets whether we currently want split-screen support, and updates accordingly for the new value to take effect */
function DunDefSetSplitScreen(bool splitScreen)
{
   WantSplitScreen = splitScreen && main(GetCurrentWorldInfo().Game).IsGameplayLevel();
   UpdateActiveSplitscreenType();
}

event bool Init(out string OutError)
{
   local bool returnVal;

   local PlayerManagerInteraction PlayerInteraction;

   ActiveSplitscreenType = DesiredSplitscreenType;

DefaultProperties
{
   UIControllerClass=class'UDKGame.DunDefUIController'
   WantSplitScreen=true
   LastCanvasWidth=1024
   LastCanvasHeight=768
   CursorParticleMat=Material'DunDefMisc.CursorParticle'
   bUseConsole=true
}
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7972



View Profile WWW
Re: udk split screen
« Reply #8 on: August 21, 2012, 14:49 »

Check Engine/GameViewportClient.uc. This class implements splitscreen support. You can make any number of player viewports, tune their sizes and positions. Rendering is performed from native code, but everything else is set up from the scripts.
Logged
freezerburn
Jr. Member
**
Posts: 46


i love it xD


View Profile
Re: udk split screen
« Reply #9 on: August 21, 2012, 17:17 »

Hi double-o-kid,

Hmm... I'm not familiar with the splitscreen method myself. Actually I didn't know it existed in UDK. Now i'm interested in trying to do this. I looked up Dungeon Defenders source file and downloaded it. Wow, the splitscreen codes look rather confusing in the gameviewportclient.uc. :O (Especially since i'm no programmer.)

Gildor, which part of the code in gameviewportclient will she need? All of it?
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7972



View Profile WWW
Re: udk split screen
« Reply #10 on: August 21, 2012, 18:25 »

There is no way to "cut" or "copy-paste" code of native class, so you will not get a "part". You'll use all the code. Just make a class derived from GameViewportClient or from UDKGameViewportClient and tune class here.
Logged
double-o-kid
Newbie
*
Posts: 8



View Profile
Re: udk split screen
« Reply #11 on: August 21, 2012, 18:59 »

thanks for the replies  Smiley
i'll get the code and fine tune it. hopefully i'll get right  Cheesy
if i have an errors or succeed when I compile I'll post it.
Logged
double-o-kid
Newbie
*
Posts: 8



View Profile
Re: udk split screen
« Reply #12 on: August 22, 2012, 09:01 »

I'm still working on the dungeon defenders viewportclient file, but while i was searching around on epic forums I came across a basic split screen code.
He had directions on setting up but I think that was meant for the programmers (needs programmer's format for dummies <--  Cheesy )
Maybe someone can show me how to type that out? Well heres what he said

"initialize a 2nd player and initiate split screen by hooking into the game's viewport client and calling CreatePlayer()
 local string errmsg;
local GameViewportClient vp;
vp = class'UIRoot'.static.GetCurrentUIController().Outer;
vp.CreatePlayer(1, errmsg, true);

This should probably be done in Login() or InitGame() in the GameInfo class.

You can set the way splitscreen takes effect by calling SetSplitscreenConfiguration()
vp.SetSplitscreenConfiguration(eSST_2P_VERTICAL);

eSST_2P_VERTICAL is an enumeration of ESplitScreenType
enum ESplitScreenType
{
   eSST_NONE,            // No split
   eSST_2P_HORIZONTAL,      // 2 player horizontal split
   eSST_2P_VERTICAL,      // 2 player vertical split
   eSST_3P_FAVOR_TOP,      // 3 Player split with 1 player on top and 2 on bottom
   eSST_3P_FAVOR_BOTTOM,   // 3 Player split with 1 player on bottom and 2 on top
   eSST_4P,            // 4 Player split
}; "

then he went on to say that
"if you only have 1 controller or no controller, the second player doesn't get assigned any sort of controls. Controller1 gets assigned to the 1st player if you don't have a 2nd controller."

he also said he would update but never did.
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7972



View Profile WWW
Re: udk split screen
« Reply #13 on: August 22, 2012, 09:07 »

There is no useful information in that post. He says obvious things (which you know already, I think).
Logged
double-o-kid
Newbie
*
Posts: 8



View Profile
Re: udk split screen
« Reply #14 on: August 22, 2012, 12:18 »

Yeah your right, it wasn't anything useful. He did more rambling that anything else and pasting code.
I really know very little about unrealscript and I only know of a few computer languages, but even those are over my head (variables, boolens, fucntions, etc, I only know by name and don't know how to set them up).
Maybe i'll be able to wrap my head around this once I get some sleep. I have had a pretty long day outside of trying to learn unrealscript.
Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS