Two Players Single Screen Modules [4.1.5]

dale_coop

Moderator
Staff member
Here is a new core for making 2 players co-op games: simple platformer, maze, adventure games.
It's based on the Basic NoScroll one, but because a LOT of modifications have been made, it couldn't just be a patch of the current modules/core.
For NESmaker 4.1.5

This new core comes with two modules: the "Top Down Adventure" and the "Simple Platformer" module. They are both contains almost all the fixes and some custom scripts I shared on the forum (projectiles are working, melee sprite based or object melee... all can be enable/disable with user constants and scripts assignments. Monster drops, monster death animations, ... is fixed and can be enabled/disable with user constants).

More specific tutorials might come... if needed.

TwoPlayersSimple.gif



How to install the "Basic NoScroll Two Players" core

1/ Download the ZipScript from here: https://drive.google.com/open?id=1siDEnbf43rHAi8SvLq-Huz-jezr0KChJ
(don't unzip it / keep it zipped)

2/ Open NESmaker, go to the "Project" menu and select "Run Project Scrip".
2019-03-23-23-42-23-NES-MAKER-4-1-5-Version-0x159-Unsaved-Project.png


Navigate until your downloads folder and select the "Basic_NoScroll_TwoPlayers.zip" file you have just downloaded.

Wait some (long) seconds, a message should be displayed when the installation is finished:
2019-03-23-23-43-55-Script-Execute.png


Voilà, the new "Basic NoScroll Two Players" is installed.


How to install the new 2 players MODULES

1/ Download the 2 Players modules (zipped) from here: https://drive.google.com/open?id=1_s8HiB8Q_nq46UF2r2PBCalTI5WNZgqg

2/ Unzip the "2players_modules.zip" file. It should contain two files: "2Players_SimplePlatformer.MOD" and "2Players_TopDownAdventure.MOD"

3/ Copy the "2Players_SimplePlatformer.MOD" and "2Players_TopDownAdventure.MOD" in your NESmaker\Modules\ folder.

Voilà, the new 2 Players modules are installed.


If you make a new project in NESMaker, you will now have two new 2 players modules (using the new Two Players core).

2019-03-24-00-39-28-NES-MAKER-4-1-5-Version-0x159-Test2-Players-MST.png



TUTORIALS

The quick tutorial for a 2 PLAYERS ADVENTURE / MAZE GAME is here: http://nesmakers.com/viewtopic.php?f=35&t=2506
The quick tutorial for a 2 PLAYERS SIMPLE PLATFORMER GAME is here: http://nesmakers.com/viewtopic.php?f=35&t=2507

DEMOS

Here's some demo projects for those who want to start playing with a already configured project:
Download the zip file here : https://drive.google.com/open?id=1gT9UlNgI5MtVCNWmS96oIcV91C6d21K4
It contains "Adventure" and "SimplePlatformer" Projects + GraphicAssets.

Unzip the contain in your NESMaker folder. And you can then, open the demo project in NESmaker.
WARNING: if you have already projects with the same names, they will be replaced !!!



Small important notes

The Player 2 object:
By default in the 2 players modules, the second player is the last object from the Game Objects list.
2019-03-24-01-12-35-NES-MAKER-4-1-5-Version-0x159-Adventure-MST.png

If you want to use another game object, modify the "OBJ_PLAYER_2" constant in the "Project Settings > User Constants".

The Input Scripts:
One other big difference with the basic modules is now you have to set the "Target" when assigning the scripts in the Input Editor:
2019-03-24-13-23-27.png

So each script will be have to be assigned twice: to the "Player 1" and to the "Player 2".
(But maybe you want assign some script only to the Player 1... or only to the player 2? For example, the player 1 can use sword and the player 2 projectiles)

Start Screen Selection:
- The selection cursor is enabled on Start Screen.
Check the "Project Settings > User Constants":
STARTSCREEN_CURSOR_TILE: define the tile (from the gameobjecttiles.bmp) is used as cursor/selector (if you set "0" the selector will be disabled, so not been displayed).
SELECTION_POS_X and SELECTION_POS_Y are the pixel coords of the first item of the selection menu (it means the "1 PLAYER" item)
There are only 2 items (1 player or 2 players mode). By default the cursor is set to the value of the variable "player2Mode" (0 means 1 player only and 1 means two players mode)
- To move the cursor, assign the "SelectionStartScreen.asm" script to the input button you want (in the demo I used "press" "select"). This script modify the value of the "player2Mode" variable (the screen is updated and the cursor changed its position).
- To validate and start the game, assign the "StartGame.asm" script.

HUD variables for Health:
- In "HUD & Boxes > User Variables", there are now two variables: "myHealth1" and "myHealth2" for the Player 1 and the Player 2. Those variables NEED to have a value!
2019-03-23-23-59-43-NES-MAKER-4-1-5-Version-0x159-Simple-Platformer-MST.png

(If "0", the player will not spawn in most cases)

The Lives
In "Project Settings > User Variables", you will find the "myLives" variable to set your game lives value (when both players are dead, you lose a life).

Object Melee / Sprite base Weapon
By default the modules use sprite based weapon (it uses less memory) with the b_create_weapon_sprite.asm on B pressed.
You can use the object, just disable the sprite code in "Project Settings > User Constants" set the SPRITE_WEAPON constants to "0" and use the b_create_melee_object.asm for inputs..

The Monster Drops
Check the "Project Settings > User Constants", you will find the "OBJ_MONSTER_DROP_ITEM1", "OBJ_MONSTER_DROP_ITEM2" and "OBJ_MONSTER_DROP_ITEM3" constant, you can set the objects you want the monsters drop when they died (it's random between those 3 possibilities + no object). If you set the constants to "0" the monster will not drop any Item.

Some issues with screen transitions / edge collisions
In some screen, you can have issues with wrong collision detections when transiting from one screen to another (or warps). The result is glitchy, your player is stuck or blocked or warped to a wrong screen (not the screen it should be).
If you have those issue, make to place null walkable tiles (collision data) on the opposite side of your screen exit, like in this image:
2019-03-24-00-07-38-NES-MAKER-4-1-5-Version-0x159-Test2-Players-MST.png

(you could also use normal tiles and just change the tile type, via a right click>Modify attribute>0 Null walkable).



MOST IMPORTANT NOTE: this core and the modules are not official, I made this at first, for my personal use, for my game... it sure have issues, bugs, ... sorry in advance for that. Feel free to modify/fix/share...


Updates:
2019-03-25: fixed the collisions with a NPC (for the "player 1 make the collision, the player 2 press the b activate text button" thing)


Known bugs:
- Enemies fall through ladders when pressing down: a fix is available here: http://nesmakers.com/viewtopic.php?p=25626#p25626
 
So beautiful dale thank you :) do i have to load the core once for nesmakers or every time i want to make a 2 player game ? And for my normal 1 player game can I load this core without it interfering with the core i am using ?
 

dale_coop

Moderator
Staff member
Once only... them use as usual.
The 2 players modules and core are separate from the défaut. No interference.
 

mongolianmisfit

New member
Have you done any testing with 2players in the scrolling module yet?
I'd love it if I could get this to work with a scrolling module (aka Super Mario Bros.)
 

dale_coop

Moderator
Staff member
Gilbertmaxter said:
This os awesome dale working with this now and maybe copying the pause script for my 1 player game :)

Yep, yohr pause script should work...
(Else Take a look at my pause.asm in the Input folder)
 

dale_coop

Moderator
Staff member
mongolianmisfit said:
Have you done any testing with 2players in the scrolling module yet?
I'd love it if I could get this to work with a scrolling module (aka Super Mario Bros.)

No, didn’t.
I started the two players mode months ago, in 4.0 when Scrolling wasn’t existing yet.
Now, I could take a look... but I’d like to wait for a solid scrolling engine before make all the work that needed to be done. Else it’ d be a waste.
 

mongolianmisfit

New member
dale_coop said:
mongolianmisfit said:
Have you done any testing with 2players in the scrolling module yet?
I'd love it if I could get this to work with a scrolling module (aka Super Mario Bros.)

No, didn’t.
I started the two players mode months ago, in 4.0 when Scrolling wasn’t existing yet.
Now, I could take a look... but I’d like to wait for a solid scrolling engine before make all the work that needed to be done. Else it’ d be a waste.

Yeah, I definitely understand your reasoning there. The scrolling, while functional, is unoptimized and can be very buggy at times.
 

dale_coop

Moderator
Staff member
I made a quick tutorial for a 2 PLAYERS ADVENTURE GAME, here: http://nesmakers.com/viewtopic.php?f=35&t=2506
 

TolerantX

Active member
I was asking about the NPC Tile (which I understand does not work in 4.1) and the AutoText.asm you have in the 2 player adventure module. You mentiontioned posting here about it, and the code:
AutoText.asm

CPX player1_object
BEQ +
CPX player2_object
BEQ +
JMP finishedWithAutoText
+
LDA tileCollisionFlag
BEQ +
JMP finishedWithAutoText
+
LDA #$01
STA tileCollisionFlag

LDA collisionTable,y ;<<-- check the current tile collision data
BEQ finishedWithAutoText

ChangeTileAtCollision #$00, underSecret ;<<-- change the collision data of the current tile to null walkable and graphics to undersecret

;; activate the text-box:
LDA #$00 ;;<<-- it will use the "Text 0" of your screen
STA textVar
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler

;TriggerScreen screenType

finishedWithAutoText:


I tried it in the module and it wouldn't work when my player was standing on the tile.
 

dale_coop

Moderator
Staff member
Looks like a problem with the tile collisions...
Try commenting out the lines:
Code:
 	; LDA collisionTable,y		;<<-- check the current tile collision data
	; BEQ finishedWithAutoText
 
Top Bottom