Pages: 1 ... 6 7 [8] 9 10
  Print  
Author Topic: Online Spelunky Coop Mod  (Read 13440 times)
Thespis
Shoot
*
Posts: 20


View Profile
« Reply #105 on: August 19, 2010, 12:16:13 PM »

I messed around with making a oPlayer2 last night, starting off with basic ideas:
1. If you drop multiple instances of the oPlayer1 object in a room, you control them both simultaneously without error.
2. If you change the code for the controls on the duplicate oPlayer1, you can play with a friend on the same computer as long as you set different controls and share a keyboard. I haven't run through too many levels with this configuration because, alas, I have nobody here to play with and I lack the coordination to control both hero's at the same time AND keep them alive.
3. If you can control a duplicate of oPlayer1 with different keys, then you can control him via connection if you host and another computer controls.
4. If oPlayer1 is too hard to make into a oPlayer2, then let both players share whatever items are picked up and used passively, and when they pick up and item that they must hold in place of their whip, let it assign both players that item, including a code that destroys items that are duplicates inside the level so nobody can make an infinite amount of items.

I'm implementing these changes to the best of my ability, I'll post my source Friday, I have a busy night tonight.
Logged
kinnik
Bean
*
Posts: 193


View Profile
« Reply #106 on: August 19, 2010, 03:29:59 PM »

When you post your code, I'll give a try at writing a function to select the proper oPlayer1.  I'm glad your giving this a try! Keep it up!
Logged
Bae
Mossy
*
Posts: 1605


Taste Sensation


View Profile
« Reply #107 on: August 19, 2010, 03:56:29 PM »

Sounds like you're on the right track, good show man, see I knew we'd make progress via sharing sources
Logged


[2/14] + [0/3] complete

(ナ˚ロ˚)ナ [ ▪д▪]ノ 彡┻━┻ Fuck Everything You Just Did

TEACH ME YOUR ASIAN WORDS
Thespis
Shoot
*
Posts: 20


View Profile
« Reply #108 on: August 20, 2010, 06:24:49 PM »

Ok, so this source is effed up right now, but its only because I'm in the process of configuring the connection business. I'll try to post it if I get finished with this big step tonight.
Logged
Patrick
Bean
*
Posts: 219



View Profile
« Reply #109 on: August 20, 2010, 08:19:18 PM »

I'll see if I can get Twitch to share his source...
Logged
KarjamP
Mossy
*
Posts: 2170


Meet Miijam!


View Profile Email
« Reply #110 on: August 21, 2010, 08:40:20 AM »

Tried that, but alas no. All the functions in the game basically refer to oPlayer1 and so do all the objects, just trying to get the whip working was hell since he uses 3 or 4 objects for the whip and whatnot.
Do you know that if you create object a, and give it the parent of object b, object a would be treated in the game as if it was object b?

Let me make it more clearer: If you want to destroy all enemies in the room (even if they're represented by different objects (like oSnake and oCaveman), if the enemies' parent is oEnemy, them all you have to do is:

with oEnemy
{
     instance_destroy()
}

and then all the enemies dissapear.

Easy as that.

edit: I forgot to say that, unless the events of the object has at least one action (even if you put in a comment), the game would automatically copy the events over to those events in the object, making them behave exactly like their parents. If you want have actions in your objects, while still having this behavior, then use the action "Call parent event" (or it's script equivalent; "event_inherited").
« Last Edit: August 21, 2010, 09:07:06 AM by KarjamP » Logged

Meet Bodyless!

3DS friendcode: 4210 - 4681 - 1626



Join Dropbox!
kinnik
Bean
*
Posts: 193


View Profile
« Reply #111 on: August 21, 2010, 02:25:47 PM »

Does GM support multiple inheritance?  oPlayer1 is child to oCharacter right?  If GM did multiple inheritance then you could have a children of oPlayer1 (called maybe oPlayer11, oPlayer12 ect..). So it would be  oDrawnSprite -> oCharacter -> oPlayer1 -> oPlayer1x ! (just realized GM does support multiple inher, duh.)  Then when all the code that talks about oPlayer1 wouldn't need to be changed.

Is my thinking right?  Something feels like it's missing..  Anyone?
Thanks Karjam, for the idea!!
Logged
hyperme
Mosskid
*
Posts: 677



View Profile
« Reply #112 on: August 21, 2010, 02:27:19 PM »

Is my thinking right?  Something feels like it's missing..  Anyone?
Thanks Karjam, for the idea!!
You'll need to setup controlling scripts and stuff for each player, but otherwise your good.

Best to copy oPlayer1, rename, edit and parent.
Logged
kinnik
Bean
*
Posts: 193


View Profile
« Reply #113 on: August 21, 2010, 03:08:17 PM »

Keep the shared elements to oPlayer1 and put some things in oPlayer1x.. ??

What would we do with all the globals tho??  ie global.plife, global.has'Item'

Do these globals get called from objects other than oPlayer1? Thus making local variables more difficult to implement.


I love this kind of brainstorming!  Much more fun than actually playing any games.  Wink
Logged
KarjamP
Mossy
*
Posts: 2170


Meet Miijam!


View Profile Email
« Reply #114 on: August 22, 2010, 06:47:08 AM »

Thanks Karjam, for the idea!!
You welcome, although it was directed to Twitch. Shocked
Logged

Meet Bodyless!

3DS friendcode: 4210 - 4681 - 1626



Join Dropbox!
Thespis
Shoot
*
Posts: 20


View Profile
« Reply #115 on: August 22, 2010, 05:04:40 PM »

Wow, I wish I'd checked this before messing around with it today. I'm having trouble with M_play, if anyone can help feel free. Right now I'm only concerned with making the two players visible to each other while moving around the title page, and I can't do it. I'm lame, I know. I got it to work, but the players were blinking.

https://docs.google.com/leaf?id=0BwusbxKg2FH-NjY0NTBhYzgtMjRmMi00MzhiLTg0ODEtMzk5ODMwZTFmYjYx&hl=en

So, I can't figure it out. Help is awesome.
Logged
Twitch
Shoot
*
Posts: 20

me@tw1tchy.com
View Profile Email
« Reply #116 on: August 23, 2010, 03:28:16 AM »

Well, have fun working out what the crap is what, but I'm uploading my whole 33mb Spelunky folder, since everything I worked on is in there, probably along with a few mods that aren't mine + the actual game, but I am NOT going through that and figuring out what's what. Have fun.

http://www.mediafire.com/?pap7n7izdwxj4fo
Logged
Thespis
Shoot
*
Posts: 20


View Profile
« Reply #117 on: August 23, 2010, 04:14:32 PM »

Okay, so scrap that last release and someone help me brainstorm: I'm starting all over with the vanilla source, because I have no clue how to configure the multiplayer aspect. I thought I did, but I'm doing something wrong or I'd have it by now. I'm moving back towards an earlier post by creating a oPlayer2, modifying his controls, and going through ALL of the code by making duplicates of any code involving oPlayer1, replacing instances of oPlayer1 with oPlayer2, and renaming the scripts, including a  if global.master{} and if global.slave {} tag under the two players, and that should do it as far as playing on a single computer. You should be able to configure player one and two controls that way, and it should easily transfer over into an online game. I'm hoping that, once I release this, someone will help me with connecting the slave to the master and running this thing. The reason I'm modifying all of the oPlayer1 into oPlayer2 instead of making oPlayer1x a slave of oPlayer1 is that I think that we'll still have to do all of the copying work regardless so that players have individual health, gold, and items. If anyone sees me going in the wrong direction feel free to point my in the right one. I'll post my work once I've copied it all.
« Last Edit: August 23, 2010, 04:16:08 PM by Thespis » Logged
kinnik
Bean
*
Posts: 193


View Profile
« Reply #118 on: August 23, 2010, 05:22:42 PM »

I tried the inheritance route yesterday and discovered it's problems.  Basically, it works in all aspects when it's functions are being called from the oPlayer but it breaks down whenever oPlayer1 is referred to by another object. (example: in oItem it talks alot about oPlayer1.held but it doesn't know which oPlayer1 it's referring to)  I remember in the single computer multiplayer mod I was working on with Keglunky we solved that problem by adding a variable "heldBy" to the oItem...   

I think it would be a good idea to work from Keglunky's mod and either just continue on from his code or copy across his code into vanilla so you know exactly whats been added and why.   I will post his code here I guess.... I hope that's not disrespectful.  I have no way of contacting him and he VERY rarely come on here anymore.  But in terms of line by line changing EVERYTHING to work, he's is defiantly the furthest along.

On a side note, if you look into 'scripts -> platform engine-> gameStepEvent' you'll see that Derek Yu started writing the game with the option to add multiple player but then changed his mind at some point and abandoned.  He uses an array to keep track of instances of oPlayer.  for example in line 7:

with oCharacter
{
  //necessary to reset the "viscid" movement from a moving solid
  viscidMovementOk=1
  //store the characters in the oGame.players variable
  oGame.players[oGame.players_length] = id
  oGame.players_length+=1
}

This is where he adds all oCharacters to an array.
oGame.players[?] = id  //adds the pointer of the oCharacter to the array.

Then instead of a 'with' statement he uses a 'for' statement to iterate though players.

I haven't fully though out the implications of this but I have a sneaky feeling that this could be really helpful.

I will be out of town from wed for a week but I'll help out as best I can till then and after.  I'll post Keglunky's today as well.  If anyone knows how to contact him, please do and ask for permission to share his code.   I think I'll post a new thread to try and get a hold of him.
Logged
Thespis
Shoot
*
Posts: 20


View Profile
« Reply #119 on: August 23, 2010, 05:30:12 PM »

I noticed that too! He even puts in a variable for the number of players in one line. At any rate, I'm almost done creating oPlayer2, I've replaced any instances of oPlayer1 with oPlayer2 and will import all the resources into a vanilla source game for a start, I'll post that later tonight. Quick question though: a lot of objects include oPlayer1 in their steps, while other only mention oCharacter, are the two interchangeable for all intents and purposes? I would be skeptical to think so unless someone REALLY knowledgeable confirmed it, so that's why I'm asking all of you.

Edit: Instead of replacing oPlayer1 with oPlayer2, should I simply tack "or oPlayer2" right next to oPlayer1?
« Last Edit: August 23, 2010, 05:53:16 PM by Thespis » Logged
Pages: 1 ... 6 7 [8] 9 10
  Print  
 
Jump to: