Split Screen and Beyond

In this thread, I was asked if it were possible to create a split-screen game in Corona:

https://forums.coronalabs.com/topic/74023-game-map/

I said, “Yes”.  I also said I’d look up some old experimental code of mine that was related to the concept.

In 2014 … 2015 I did an experiment with ‘viewport cloning’  This is essentially duplicating the current screen view into one or more additional views.

In addition to duplicating a view, I experimented with offset views of the same world.  This is where the concept of splitting comes in.

Anyways, I never did anything with my work and I will say it is probably a bit messy and under-optimized. 

Here is the code:  https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/10/viewportCloning.zip

That said, I was able to create test scenes with up to 16 views of the world all offset and even rotated.

This would not run great on mobile, but desktop was OK.

https://www.youtube.com/watch?v=e_AQOFOql14&feature=youtu.be

Pretty cool sample …

The biggest problem here is, that Corona does not offer any kind of immediate mode API for rendering where you could render the same objects/world multiple times, and so you not only have to dupliate all your objects but also update/simulate every copy (or at least update/sync all the relevant parameters).

But it depends a lot on the game - if it has reasonable static backgrounds like a tilemap without lots of animated tiles etc. I think it would work great (f.i. a topdown racer)

@roaminggamer

That…  Is awesome!  The idea that I’ve got niggling in the back of my head would be for a desktop game, spread over a largish map but with relatively few moving objects.   I’ve downloaded your code and will have a play about.

Many thanks :slight_smile:

Thanks.  Be aware, this experiment doesn’t deal with Physics at all.  If you have two side-by-side scenes (split) you’ll need to do some special work to handle physics. 

I have a number of ideas on this that I’d be happy to share if you end up trying to do a split-screen world.

Remember, this is totally un-optimized.  There are many ways to approach multi-view object management (ghosting).  I believe I did the easiest, which is to duplicate everything. 

Pretty cool sample …

The biggest problem here is, that Corona does not offer any kind of immediate mode API for rendering where you could render the same objects/world multiple times, and so you not only have to dupliate all your objects but also update/simulate every copy (or at least update/sync all the relevant parameters).

But it depends a lot on the game - if it has reasonable static backgrounds like a tilemap without lots of animated tiles etc. I think it would work great (f.i. a topdown racer)

@roaminggamer

That…  Is awesome!  The idea that I’ve got niggling in the back of my head would be for a desktop game, spread over a largish map but with relatively few moving objects.   I’ve downloaded your code and will have a play about.

Many thanks :slight_smile:

Thanks.  Be aware, this experiment doesn’t deal with Physics at all.  If you have two side-by-side scenes (split) you’ll need to do some special work to handle physics. 

I have a number of ideas on this that I’d be happy to share if you end up trying to do a split-screen world.

Remember, this is totally un-optimized.  There are many ways to approach multi-view object management (ghosting).  I believe I did the easiest, which is to duplicate everything.