2.5D FPS Game Theory

Discussion pertaining to resources, stories/characters and gameplay ideas in this forum dedicated to games that are just a faint glow.
Forum rules
Do not create a topic offering to produce resources. Click here for the reason.

Please use above resources section of site so everyone can have access to the resources you create.
User avatar
Kilatorian
001 Support
 
Joined: Sat Oct 18, 2014 12:11 am
Location: Planet Earth

2.5D FPS Game Theory

Postby Kilatorian » Thu Jul 07, 2016 10:48 am

A place to consolidate essential functions that are necessary for a 2.5D game. Perhaps this could lead to a 2.5D FPS template.

Setting the Camera View
1. Open System Triggers, edit the Introduction script.
2. You will need to create 4 events,
-Change Horizontal Orbit: Set the camera view to the field named "0" on the Full Screen interface and the horizontal orbit to
Code: Select all
Actor("main").Direction
.
-Change Vertical Orbit: Set to 0
-Change Distance: Set this probably somewhere from 0-10, experiment with this to see what feels right for you.
-Change Visual Range: You don't need this one, it will use the default (probably around 1000, I don't know), but use this to change how far the camera will render in the distance.

Example Introduction Trigger: http://www.engine001.com/script/9v9I1G

This will put the camera at the players feet. In order to raise it off of the ground you will need to create a timer in the Full Screen interface and use a Pan Camera event.
Pan Example: http://www.engine001.com/script/r35LhQ

Mouse Movement:
1. Create 3 Global Variables
- Mouse_Sensitivity - Set between 500 and 1500 or experiment.
- hor_orbit
- ver_orbit
2. open Input Triggers and in Regular Game add 2 inputs:
- Set a Key to 'Cursor Axis X' pressed, and add the script:
http://www.engine001.com/script/dDatAk
- Set a Key to 'Cursor Axis Y' pressed, and add the script:
http://www.engine001.com/script/96wQ0a


Player Movement
For multi-directional movement you will need to create a script inside of a fast timer. You just need a Control Branch, a Movement X and a Movement Y event, but you have to do them for each direction possibility, such as up,up-left,up-right,down,down-right,etc.

To simply move forward all you need is:
Movement X: Math.Cos(Actor("main").DirectionAngle)
Movement Y: Math.Sin(Actor("main").DirectionAngle)

Script for all 8 directions:
Timer Script: http://www.engine001.com/script/FXLWYq

2. Create key released scripts for Up,Left,Down, and Right setting Movement X and Movement Y to 0.
Key released script: http://www.engine001.com/script/ePzS3t


HUD Weapon Display
1. Place a Static Sprite field in your Hud interface and name it Main Weapon, set the width/height to your game resolution. Set the visibility to not appear if there is no weapon
Code: Select all
Actor("main").Equipment("Weapon")<>""
and place the field in the center of the interface.
2. Create your hud weapon sprite in the same resolution as your game and place your weapon where you want it to appear on screen. Name it after the item you're going to have equipped and add Hud aftewards. Ex: You have a weapon named 'Crossbow', so your sprite name would be 'Crossbow Hud'.
3. Open Items, and go to your weapons Equipped trigger. Add a Change Sprite event to change Main Weapon to your weapon name + " Hud"
Code: Select all
Actor("main").Equipment("Weapon")&" Hud"


Attack Frame:
4. I haven't gotten much beyond that with using animations, just a single attack frame, and it appears you can't use poses with hud sprites so you have to make your attack animation a different sprite. For this name it your weapon name plus " Attack Hud". Ex: "Crossbow Attack Hud".
5. Open Items, go to your weapons Source/Used Trigger and add a Change Sprite event to change Main Weapon to
Code: Select all
Actor("main").Equipment("Weapon")&" Attack Hud"
, then add a short delay and change it back to
Code: Select all
Actor("main").Equipment("Weapon")&" Hud"


How To Make an Actors Sprite Face Relative To The Player Position
For example, if you have a enemy facing south, you will be able to walk to the west of it, look east and you will see the side profile, or you will see the enemies back if its moving away from you (if you have the sprite set up for those directions, its based on north being the back side and south being the front facing, I'll revise this later to add exactly what you need to do to the sprites)

1. Create an actor variable named FaceDirection.
2. Change FaceDirection to face where you want, in this example it faces towards the player. I've also included movement X and Y events (I need to add a section on movement). You can put this wherever you want depending on how much you want it to update its new internal facing direction and/or movement.
FaceDirection: http://www.engine001.com/script/VFXR83
3. In a while timer, I have it set to .1 so it constantly updates while the player moves around the actor, put:
Rotate: http://www.engine001.com/script/NmjFz7

Thanks to Scaveleon for filling in the missing piece of the puzzle on this one.


Sprite Setup
You will want to set all of your sprites to be either Billboard, or Face Z. When set to Billboard the sprite will always face towards the camera, when set to Z it will just rotate towards the camera, this is all preference to what you want and the size of your sprite. I usually set smaller objects like projectiles and short bushes to Billboard, with taller objects to Face Z.


Ill add more in the future and I can probably flesh out whats already here a little bit more, feel free for anyone to add ideas or suggest better ways to do things. Or ask questions if anyone has trouble doing what I've so far described here.
Last edited by Kilatorian on Fri Jul 15, 2016 11:42 am, edited 3 times in total.

User avatar
thebluejester
001 Enthusiast
 
Joined: Fri Jul 24, 2015 3:05 am

Re: 2.5D FPS Game Theory

Postby thebluejester » Wed Jul 13, 2016 5:27 am

I am VERY interested in this! :D
How do you get the camera/view to always be behind the character; rotate the map to match the direction the player is facing? I saw it in a screenshot of yours. VERY cool!

User avatar
Kilatorian
001 Support
 
Joined: Sat Oct 18, 2014 12:11 am
Location: Planet Earth

Re: 2.5D FPS Game Theory

Postby Kilatorian » Wed Jul 13, 2016 2:16 pm

I'm glad someones interested! I added the camera view and mouse aiming, these were mostly based on the 3D Demo. I'll add movement next.

User avatar
thebluejester
001 Enthusiast
 
Joined: Fri Jul 24, 2015 3:05 am

Re: 2.5D FPS Game Theory

Postby thebluejester » Thu Jul 14, 2016 1:37 am

I found that for my view to be facing the right direction I needed to have a negative value for Horizontal Orbit. So negative actor(main).direction. Is that right? Maybe I messed up elsewhere and corrected it with the negative...?

I also found I need to add a Z value to the camera so I wasn't "on the floor" view wise.
Thanks!

User avatar
Kilatorian
001 Support
 
Joined: Sat Oct 18, 2014 12:11 am
Location: Planet Earth

Re: 2.5D FPS Game Theory

Postby Kilatorian » Fri Jul 15, 2016 11:46 am

thebluejester wrote:I found that for my view to be facing the right direction I needed to have a negative value for Horizontal Orbit. So negative actor(main).direction. Is that right? Maybe I messed up elsewhere and corrected it with the negative...?

Try changing the direction your main character sprite is facing in the party window, I feel like that's messed with my controls before, try facing it down.

thebluejester wrote:I also found I need to add a Z value to the camera so I wasn't "on the floor" view wise.

Yeah, I didn't explain in the pan camera part, but in the script it shows Actor("main").Z + 32.

I also just added the way I do player movement.

User avatar
thebluejester
001 Enthusiast
 
Joined: Fri Jul 24, 2015 3:05 am

Re: 2.5D FPS Game Theory

Postby thebluejester » Fri Jul 15, 2016 9:42 pm

Thanks!
Your template is certainly coming along! :D

Sent from my VK700-MAX using Tapatalk
GG Maker Owner. Occasional 001 Subscriber.
Lvl 1 Mage. Chaotic Neutral.
Postgrad Science/IT student. Feed me I'm poor.

User avatar
SBG
001 Subscriber
 
Joined: Thu Jun 17, 2010 8:37 pm
Location: merca

Re: 2.5D FPS Game Theory

Postby SBG » Fri Jul 15, 2016 11:01 pm

Thanks for this post man. I will definitely use it one day if I ever make a first person game. I could always use 3D models for it, but there's something special about 2.5D. Plus it'd give me an excuse to work with renders again, which for some odd reason I kind of miss since switching to 3D.

Quick question though, without dissecting your scripts, does your actor facing script work with 4 or 8 direction?

User avatar
Kilatorian
001 Support
 
Joined: Sat Oct 18, 2014 12:11 am
Location: Planet Earth

Re: 2.5D FPS Game Theory

Postby Kilatorian » Sat Jul 16, 2016 5:05 pm

SBG wrote:Quick question though, without dissecting your scripts, does your actor facing script work with 4 or 8 direction?

Yes, these scripts should work for 8 directions. Theoretically they would work with 16 or 32 if 001 had the capability.


Return to Resource, Story and Level Design

Who is online

Users browsing this forum: No registered users

cron