Page 1 of 1

Make game with 2 windows! *Demo updated!*

PostPosted: Thu Jul 28, 2011 1:47 pm
by lcl
Hello,
here is little example of how to make a game
which will run in two windows at the same time.

It can be used to make a two player game.
Both actors have to be controlled by the same window because the other windows
key down events don't work when other one is active. But you can make other one follow other player
and another one will follow another one.

The basic idea is that game window 1 writes characters state (position, animindex, animpos) into file and the game window 2 reads them from there. It actually seems to work fast enough for make games with that system.
So, the character is actually running by the key down event just in window 1 but window2 reads that info from file and makes the character also move.

Sorry if this made no sense, it's hard to explan this. :P

That's how it works:


AND SORRY FOR EXTREMELY BAD GRAPHICS! xD
2screens.jpg


Download: (UPDATED!)
http://www.mediafire.com/download.php?i7n5ib1o3kh2xt9

Please post if you have any questions or feedback. :)

lcl

ps. what's wrong with the forum uploadings?
I can't use the java uploader, it just doesn't add the file and the normal uploader says that file size limit is 100 KiB though it should be 2 MB!

Re: Make game with 2 windows!

PostPosted: Thu Jul 28, 2011 3:49 pm
by Game A Gogo
This gave me a brilliant idea.... if you don't mind I will upload here when it's done!

Re: Make game with 2 windows!

PostPosted: Thu Jul 28, 2011 4:14 pm
by lcl
Game A Gogo wrote:This gave me a brilliant idea.... if you don't mind I will upload here when it's done!

Yeah, just go ahead! :D
I have also done now a better demo of this, I'll send it soon! :D

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Thu Jul 28, 2011 5:46 pm
by Game A Gogo
Ha I love the end of the video xD

also here's what I made :)

http://dl.dropbox.com/u/9246426/multi%2 ... xemple.zip

the script is FULLY commented, make sure to check out the global codes!

With this, you could make GUI separated from the game, showing you information like maps and status!
Also with editors... you could have many windows for multiple projects and others for tools and what not...

Makslane needs to allow opening other ge-games in new window ):

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Thu Jul 28, 2011 6:23 pm
by lcl
Game A Gogo wrote:Ha I love the end of the video xD

xD
Game A Gogo wrote:Makslane needs to allow opening other ge-games in new window ):

Yeah! exactly! :)

EDIT:
Wow, nice work! :)

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Thu Jul 28, 2011 6:35 pm
by lcl
I think I'll try to make a 2D worms like game with that 2 windows system in my demo :D

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Sat Jul 30, 2011 10:51 pm
by Camper1995
Wow nice. You guys rock.

Oh and GAG, can I use your player sprite sheet as a template for mine? I need some template with leg movement and your is perfect for what I need :)

+1 to both of you ;3

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Sun Jul 31, 2011 12:25 am
by Game A Gogo
Sure, but credit would be appreciated :)

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Sun Jul 31, 2011 10:45 am
by Camper1995
Of course GAG :wink:

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Mon Oct 03, 2011 5:57 pm
by JamesLeonardo32
Wow. Someday I'll learn how to do such style of advanced coding.

Very well done.

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Mon Oct 03, 2011 7:30 pm
by lcl
JamesLeonardo32 wrote:Wow. Someday I'll learn how to do such style of advanced coding.

Very well done.

Thanks! :)
And well the learning comes by itself if you're interested to challenge yourself to try to make something which goes to the limits of your coding skills. That's how I've learnt, by trying to do some things I've thought would be nice to be able to do. Of course it requires time and patience, and I know I'm just starting to learn, there is so much to learn still, and that's what keeps one interested, to always have something you want to learn! :)

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Mon Oct 03, 2011 8:00 pm
by tintran
brilliant. if we can map a file across the network. we can have multiplayer games. +1

Re: Make game with 2 windows! *Demo updated!*

PostPosted: Mon Oct 03, 2011 11:37 pm
by Fojam
so does this work by constantly loading saved variables from the other game over and over again? thats pretty interesting i never would have though of that.