Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

 
Reply to this topicStart new topic
> Two-player games
Tsukihime
post May 23 2012, 12:48 PM
Post #1


Level 25
Group Icon

Group: Revolutionary
Posts: 561
Type: None
RM Skill: Undisclosed
Rev Points: 25




Are there any scripts in any RPG maker that allows developers to write games that are meant for multiple people to play at the same time?

For example, you could plug in two controllers or use two separate sets of keys to control two different players on the map.


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
Night_Runner
post May 24 2012, 05:03 AM
Post #2


Level 50
Group Icon

Group: +Gold Member
Posts: 1,528
Type: Scripter
RM Skill: Undisclosed




RMXP had one, it had a split screen setup for the 2 players
http://www.hbgames.org/forums/viewtopic.php?t=6178

I remember it worked, but I'm not sure how it performed in practice

It uses the WASD buttons for player 2, but I don't believe that it works with 2 controllers.


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
Tsukihime
post May 24 2012, 10:47 AM
Post #3


Level 25
Group Icon

Group: Revolutionary
Posts: 561
Type: None
RM Skill: Undisclosed
Rev Points: 25




There doesn't seem to be links in that thread anymore lol
Unless I have to register.

I would like to assume it is a matter of spawning multiple fibers to handle each player, so when the game starts we immediately fork and have each fiber run an instance of the game (separate scene maps, etc).

I would probably need to create a custom "outer" viewport that will contain the multiple screens, where each screen is contained in its own viewport. This would allow me to extend it to more than 2 players if the specific RPG Maker supports more than 648x480 resolutions.

I would take my player-switching script for VXA and instead of switching between players, I would have each screen take one of those players and just control it.

But it probably isn't that simple lol

A bad implementation would likely be extremely laggy.

This post has been edited by Tsukihime: May 24 2012, 11:26 AM


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
Night_Runner
post May 25 2012, 08:52 PM
Post #4


Level 50
Group Icon

Group: +Gold Member
Posts: 1,528
Type: Scripter
RM Skill: Undisclosed




Look for link 2 under the demo's spoiler, the other two don't work (you need the password, which is why I didn't link directly to the demo RapidShare link)


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
Tsukihime
post May 25 2012, 09:18 PM
Post #5


Level 25
Group Icon

Group: Revolutionary
Posts: 561
Type: None
RM Skill: Undisclosed
Rev Points: 25




I got a simple implementation working for Ace
Getting multiple players was easier than I thought. Only reason I subclassed was to provide custom key controls, though I would prefer giving "player ID's" and having them look up a controller mapping based on their ID.

The issue now is to create split-screen and run a separate thread for each player.

CODE
module DataManager

  class << self
    alias :th_multiplayer_create_game_objects :create_game_objects
    alias :th_multiplayer_make_save_contents :make_save_contents
    alias :th_multiplayer_extract_save_contents :extract_save_contents
  end

  def self.create_game_objects
    th_multiplayer_create_game_objects
    $game_player2 = Game_Multiplayer.new

  end

  def self.make_save_contents
    contents = th_multiplayer_make_save_contents
    contents[:player2] = $game_player2
    contents
  end

  def self.extract_save_contents(contents)
    th_multiplayer_extract_save_contents(contents)
    $game_player2 = contents[:player2]
  end

  def self.setup_new_game
    create_game_objects
    $game_party.setup_starting_members
    $game_map.setup($data_system.start_map_id)
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    $game_player.refresh
    $game_player2.moveto($data_system.start_x, $data_system.start_y)
    $game_player2.refresh
    Graphics.frame_count = 0
  end
end

class Game_Multiplayer < Game_Player

  DOWN = Input::Y # S in Keyboard
  LEFT = Input::X # A in Keyboard
  RIGHT = Input::Z # D in Keyboard
  UP = Input::R # W in Keyboard
  ENTER = Input::L # Q in Keyboard
  RUN = Input::A # Shift in Keyboard

  def move_by_input
    return unless movable?
    return if $game_map.interpreter.running?
    if Input.press?(DOWN)
      move_straight(2)
    elsif Input.press?(LEFT)
      move_straight(4)
    elsif Input.press?(RIGHT)
      move_straight(6)
    elsif Input.press?(UP)
      move_straight(8)
    end
  end

  def update_nonmoving(last_moving)
    return if $game_map.interpreter.running?
    if last_moving
      $game_party.on_player_walk
      return if check_touch_event
    end
    if movable? && Input.trigger?(ENTER)
      return if get_on_off_vehicle
      return if check_action_event
    end
    update_encounter if last_moving
  end
end

class Spriteset_Map
  alias :th_multiplayer_create_characters :create_characters

  def create_characters
    th_multiplayer_create_characters
    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player2))
  end
end


class Scene_Map < Scene_Base
  alias :th_multiplayer_map_update :update
  def update
    th_multiplayer_map_update
    $game_player2.update if $game_player2
  end
end


This post has been edited by Tsukihime: May 25 2012, 09:29 PM


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 06:04 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker