Hard Light Productions Forums
Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: AndrewofDoom on July 12, 2011, 01:10:44 am
-
It has come to my attention that this place is a barren wasteland when it comes to shoot em ups. It. Is. Driving me NUTS. Therefore, I have arisen from my rage to this point to talk about this very concept.
While there is Spoon's Top Down Shooter (TDS), it is very incredibly rudimentary and barely like a real shmup (as much as I love it, Spoon, it's the painful truth :P). But as I thought over how I would make the amazing, grand, and eternally GLORIOUS SHMUPSpace, I ran into one, insanely huge show stopping issue. I have no clue how I would get the game to scroll like it were a shmup in the first place, because even if I were to make a static camera and have it scroll, the player ship would move out of view. Not only that, I have no clue how to keep the player on the screen. Any ideas to work around this somehow?
-
Shadows of Lylat has this kind of feature. But I didn't remember if it used lua or SEXP or both.
-
Are you talking about scrolling in one direction only like Raptor, Raiden, Tyrian, Touhou, and all that jazz? As is when activating 2D Mode in the Mission Specs is when it acts like Fraxy, Flatspace, or Starscape.
-
Shadows of Lylat has this kind of feature. But I didn't remember if it used lua or SEXP or both.
Shadows of Lylat is a rail shooter, not what I'm looking for. I'm looking for along the lines of Gradius, R-Type, and Thunder Force, which are 2d side scrolling shooters. I do know, however, that they did lua scripting for that to work though.
Are you talking about scrolling in one direction only like Raptor, Raiden, Tyrian, Touhou, and all that jazz? As is when activating 2D Mode in the Mission Specs is when it acts like Fraxy, Flatspace, or Starscape.
Scrolling in one direction like Raptor, Raiden, yadda yadda. If I wanted an arena shooter like Fraxy, I wouldn't have come here to ask. :p
-
has the AI been fixed for 2D, if i recall around the time spoon did his TDS the ai did strange things because it tried to use up and down causing spinning madness, waypoints could be used to some point but fighter vs player was impossible.
-
has the AI been fixed for 2D, if i recall around the time spoon did his TDS the ai did strange things because it tried to use up and down causing spinning madness, waypoints could be used to some point but fighter vs player was impossible.
Thing is that the 2d mission flag still doesn't necessarily constrain you to 2-dimensional space. AI most likely hasn't been changed to fit the 2d mission stuff yet, but it doesn't bother me, since I will be using sexp-based movements for enemies, since I'm hoping to has stages with obsticles and AIs on waypoints always pause slow down at nodes, but I desire smooth movements since most enemies won't be on screen for more than 2-3 seconds.
-
has the AI been fixed for 2D, if i recall around the time spoon did his TDS the ai did strange things because it tried to use up and down causing spinning madness, waypoints could be used to some point but fighter vs player was impossible.
yes, and homing missiles of any kind also don't work because of this.
-
...as I thought over how I would make the amazing, grand, and eternally GLORIOUS SHMUPSpace, I ran into one, insanely huge show stopping issue. I have no clue how I would get the game to scroll like it were a shmup in the first place, because even if I were to make a static camera and have it scroll, the player ship would move out of view. Not only that, I have no clue how to keep the player on the screen. Any ideas to work around this somehow?
You can do what you're talking about, but it takes a fair amount of patience with FRED's cut scene sexps. I never tried doing this in 2d so it might not work...
Step1: create a camera that is not the player's using set-camera
Step2: Use the set-position to position the camera directly on top of the player ship in FRED.
Step3: Use the set-facing to point the camera straight down
Step4: use a second set-position sexp which will run for the duration of the level. Set the movement time to the amount of time the level will be and set the acceleration to 0. If you play with it enough, it should give you a camera that moves along the level, showing the player's position.
Step4: Assign 2 variables, one called FrontBound and one called BackBound. These variables represent the position of the edge of the camera (which should be measured) as it moves. A counter sexp should increment these values to simulate movement.
Step 5: assign 2 hardcoded numbers to check if the player has gone too far up or down. A sample sexp
If (get-position-x > hardcoded value) , then do step 6
Step 6: If the player goes 'out of bounds' you can set the player into the middle of the screen, wrap the player to the opposite side of the screen or kill the player.
-
If you use set-object-position with every-time, NOTHING WILL COLLIDE D:
unless you mean setting the camera position.
-
The set-camera-position (or whatever it's called) sexp, the one that moves the camera to a designated x,y,z space over an ammount of time. It should only be used once per level.
-
Good morning, everyone. If you have already noticed elsewhere, my dream is finally getting somewhere, but I have one big problem....I didn't want to show it, but there seems to be a bug where the player can manage to escape the left and right bounds (which is the z axis) of the screen...which is not good. I've had a few people take a look at it and they can't seem to figure out why it's doing it.
Here's the script I've made (It's really just a fairly heavily modified corridor mode script (http://www.hard-light.net/wiki/index.php/Script_-_Corridor_Mode))
tube-sct.tbm
#Conditional Hooks
$State: GS_STATE_GAME_PLAY
$On Frame:
[
--if the initShmup() function hasn't been called, don't bother running any of this.
if booleanInitScroll == true then
objectPlayer = hv.Player
if objectPlayer:isValid() then --Player Validity Check
--Make sure that we needed info
if orientationLast == nil then
orientationLast = objectPlayer.Orientation
end
--Get Position and Orientation and Speed
orientationCurrent = objectPlayer.Orientation
vectorCurrentPos = objectPlayer.Position
floatPlayerSpeed = objectPlayer.Physics:getSpeed()
vectorPlayerVelocity = objectPlayer.Physics.Velocity
--Set the 3D aiming aid system
---Get Aiming Aids
vectorPointer = orientationCurrent:unrotateVector(vectorFrontDirection)
--Update chase camera position and orientation
--objectCCamera:setPosition(vectorCCameraPos)
--objectCCamera:setOrientation(orientationCCameraNew)
--Get current rotational velocity data
vectorRealRotVel = objectPlayer.Physics.RotationalVelocity
--Set limit for turning for horizontal axis
if math.pow(orientationCurrent["h"],2) > math.pow(orientationLast["h"],2) then
vectorRealRotVel[2] = vectorRealRotVel[2] - 1*(orientationCurrent["h"])/3
else
vectorRealRotVel[2] = vectorRealRotVel[2] - 1*(orientationCurrent["h"])/5
end
--Set limit for turning for vertical axis
if math.pow(orientationCurrent["p"],2) > math.pow(orientationLast["p"],2) then
vectorRealRotVel[1] = vectorRealRotVel[1] - 1*(orientationCurrent["p"])/3
else
vectorRealRotVel[1] = vectorRealRotVel[1] - 1*(orientationCurrent["p"])/5
end
--Prevent rolling
floatCurrentRoll = orientationCurrent["b"]
if floatCurrentRoll ~= 0 then
vectorRealRotVel[3] = -2*floatCurrentRoll/2
end
--Horizontal Position Limit
if objectPlayer.Position["x"] > floatHLimit then
vectorPlayerVelocity["x"] = 300
vectorPointer["x"] = vectorPointer["x"] + (vectorCurrentPos["x"] - floatHLimit)
elseif vectorCurrentPos["x"] < floatHRLimit then
vectorPlayerVelocity["x"] = -300
vectorPointer["x"] = vectorPointer["x"] + (vectorCurrentPos["x"] + floatHRLimit)
end
--Forward Position Limit
if objectPlayer.Position["z"] > floatFLimit then
vectorPlayerVelocity["z"] = -300
vectorPointer["z"] = vectorPointer["z"] + (vectorCurrentPos["z"] - floatFLimit)
elseif vectorCurrentPos["z"] < floatFRLimit then
vectorPlayerVelocity["z"] = 300
vectorPointer["z"] = vectorPointer["z"] + (vectorCurrentPos["z"] + floatFRLimit)
end
--Vertical Position Limit
if objectPlayer.Position["y"] > floatVLimit then
vectorPlayerVelocity["y"] = -300
--vectorPlayerVelocity["y"] = vectorPlayerVelocity["y"] - (vectorCurrentPos["y"] - floatVLimit)
vectorPointer["y"] = vectorPointer["y"] + (vectorCurrentPos["y"] - floatVLimit)
elseif vectorCurrentPos["y"] < floatVRLimit then
vectorPlayerVelocity["y"] = 300
--vectorPlayerVelocity["y"] = vectorPlayerVelocity["y"] - (vectorCurrentPos["y"] + floatVRLimit)
vectorPointer["y"] = vectorPointer["y"] + (vectorCurrentPos["y"] + floatVRLimit)
end
---Set 3D aiming aid positions
vectorNewTargetPos = vectorCurrentPos + vectorPointer/(1/1.25)
objectAimingAid1.Position = vectorNewTargetPos
vectorNewTargetPos = vectorCurrentPos + vectorPointer/(1/2.5)
objectAimingAid2.Position = vectorNewTargetPos
vectorNewTargetPos = vectorCurrentPos + vectorPointer/(1/5)
objectAimingAid3.Position = vectorNewTargetPos
--Update Player Rotational Velocity, Position and Orientation
objectPlayer.Physics.RotationalVelocity = vectorRealRotVel
objectPlayer.Physics.Velocity = vectorPlayerVelocity
--Reference Orientation for next frame
orientationLast = objectPlayer.Orientation
--AndrewofDoom's mod: addition of scrolling
intSavedCamPosX = intSavedCamPosX + floatScrollX
intSavedCamPosY = intSavedCamPosY + floatScrollY
intSavedCamPosZ = intSavedCamPosZ + floatScrollZ
vectorCCameraPos = ba.createVector(intSavedCamPosX,intSavedCamPosY,intSavedCamPosZ)
objectCCamera:setPosition(vectorCCameraPos)
gr.setCamera(objectCCamera)
floatHLimit = floatHLimit + floatScrollX
floatVLimit = floatVLimit + floatScrollY
floatFLimit = floatFLimit + floatScrollZ
---Set movement limits again for the rear. The original version makes the assumption that the player's postion will be along the origin and thus symmetrical, which will not be the case if the camera is scrolling.
floatHRLimit = floatHRLimit + floatScrollX
floatVRLimit = floatVRLimit + floatScrollY
floatFRLimit = floatFRLimit + floatScrollZ
---Keep player moving relative to camera
local movedVector = objectPlayer.Position
movedVector["x"] = movedVector["x"] + floatScrollX
movedVector["y"] = movedVector["y"] + floatScrollY
movedVector["z"] = movedVector["z"] + floatScrollZ
objectPlayer.Position = movedVector
--new section to remove excess enemy fighters and bombers
integerShips = #mn.Ships
--Get rid off excess enemies
for g=1,integerShips do
objectDisposableShip = mn.Ships[g]
--Check team and hitpoint status
stringDisposableShipTeam = objectDisposableShip.Team.Name
floatDisposableShipHitpoints = objectDisposableShip.HitpointsLeft
if stringDisposableShipTeam ~= "Friendly" and floatDisposableShipHitpoints > 0 then
--Only fighters & bombers
stringDisposableShipType = objectDisposableShip.Class.Type.Name
if stringDisposableShipType == "Fighter" or stringDisposableShipType == "Bomber" then
--Move ship only if it has flown past the player
vectorDisposableShipPosition = objectDisposableShip.Position
floatFrontDistance = vectorDisposableShipPosition["z"] - vectorCurrentPos["z"]
if floatFrontDistance < -100 then
vectorDispose = ba.createVector(0,0,-50000)
--Update the moved ships position and get rid off it
objectDisposableShip.Position = vectorDispose
objectDisposableShip.HitpointsLeft = 0
objectDisposableShip:kill(objectDisposableShip)
end
end
end
end
end --Player Validity Check
end
function initShmup()
---Create 'blank' orientation
---these rotations are in RADIANS, not degrees.
orientationBlank = mn.Ships[1].Orientation
orientationBlank["p"] = 0
orientationBlank["b"] = 0
orientationBlank["h"] = -1.57
intSavedCamPosX = 250
intSavedCamPosY = 0
intSavedCamPosZ = 0
---Set movement box limits
floatHLimit = 30
floatVLimit = 80
floatFLimit = 20
--- Set movement limits again for the rear. The original version makes the assumption that the player's postion will be
--- along the origin and thus symmetrical, which will not be the case if the camera is scrolling.
floatHRLimit = -30
floatVRLimit = -80
floatFRLimit = -20
---Scroll rates for each axis
floatScrollX = 0
floatScrollY = 0
floatScrollZ = 0.5
vectorCCameraPos = ba.createVector(intSavedCamPosX,intSavedCamPosY,intSavedCamPosZ)
orientationCCamera = orientationBlank
---Create chase camera
objectCCamera = gr.createCamera("Chase Camera",vectorCCameraPos,orientationCCamera)
---Use the new chase camera
gr.setCamera(objectCCamera)
---Create front vector
vectorFrontDirection = ba.createVector(0,0,100)
objectAimingAid1 = mn.Ships["AimingAid I"]
objectAimingAid2 = mn.Ships["AimingAid II"]
objectAimingAid3 = mn.Ships["AimingAid III"]
booleanInitScroll = true
end
---Modifies the scroll speed of the camera on any axes a man desires.
---Each parameter is the scrolling speed for each axis specified in meters/frame
function setScrollSpeed(x,y,z)
floatScrollX = x
floatScrollY = y
floatScrollZ = z
end
]
#End
Be easy on the new guy. I just started scripting literally yesterday afternoon. :P
-
Well from the perspective of someone who does not know how to read that, It looks pretty impressive.
Is there some kind of way to say
float x_position;
const max;
const min;
IF x_position > max THEN x_position = max
IF x_position < min THEN x_position = min
In game that would look like the player is sliding against the wall, which is what most schmups do no?
Where does one go to learn scripts anyways? :nervous:
-
here? (http://programming-mother****er.com/become.html)
-
here? (http://programming-mother****er.com/become.html)
seriously?
go to hell..
as for your issues andrew of doom, you could always print out the var's to the hud, notably the ones concerning the movement limits. i'll give it a look tomorrow, but a hunch tells me you should be subtracting instead of adding to the rear Z limit. in short, have a printout of the vars and try to replicate the "ship goes out of bounds" thingy.
-
After taking the advice of SCP programmers, I've come up with a new version of the boundary checking (http://pastebin.com/vpThTbPt)
I'm having trouble with that one too, Since it does nothing like its advertised as shown in this video. (http://www.youtube.com/watch?v=uZF-E6_tysM) :(
-
After taking the advice of SCP programmers, I've come up with a new version of the boundary checking (http://pastebin.com/vpThTbPt)
I'm having trouble with that one too, Since it does nothing like its advertised as shown in this video. (http://www.youtube.com/watch?v=uZF-E6_tysM) :(
xD
Sorry. :nervous:
-
You can always terminate the player if they go out of bounds. The unforgiving nature would be the fastest way to present the atmosphere of an old school game.
-
That solution works quite well...until you die and restart the mission anyway. Because I end up getting this :p
edit: nvm I got it to work. I just force the scrolling script off as soon as the player dies.