Move mode relativity

Blitz3D Forums/Blitz3D Beginners Area/Move mode relativity

fox95871(Posted 2008) [#1]
http://h1.ripway.com/fox95871/index.html

I'm having a problem with my move modes only working right when I'm facing one direction. It's easier to see what I mean in the program itself. Hope someone can help.


Warner(Posted 2008) [#2]
Not sure what the problem is in your program. I tested it, but noticed nothing strange. That might have something to do with my laptop having no scrollbutton on the touchpad. I'm a bit too tired to really dive into the code, so I posted the code below. Hopefully it helps!



fox95871(Posted 2008) [#3]
I'll give that a try, thanks. The problem's described a little in the program, but basically it's that if you drag the level toward you when you're facing the direction you start at, it works just fine, but if you then turn the camera say 90 degrees and try to use move again, you can tell it's not relative to the camera, but to the world, and I want it to be relative to whatever direction the camera's facing at any given time. Long story short, when you're in move mode, dragging down should always move the level toward you. By the way, the top icon is to point the camera, the middle is to raise and lower, and the bottom is to move.


Warner(Posted 2008) [#4]
Okay, version 2.1, hopefully it is now closer to what you need:



fox95871(Posted 2008) [#5]
http://h1.ripway.com/fox95871/index.html

I tried your code and I think I'm at least partway there. If you don't mind could you please take a look at the new one? You can tell it's closer to what I'm looking for with the camera now moving relative to itself instead of the level, except that it's really hard to see that since it only changes for one frame before snapping back to where it was. It's really frustrating. Anyway I made the icons clickable for you now. I can handle that kind of stuff, but I really wish I was better at the rest. Please help if you can.


GIB3D(Posted 2008) [#6]
That was easy ;) Took me awhile but I got it



I added in the

TempX# = MouseXSpeed()
TempZ# = MouseYSpeed()


and

MoveEntity camera,-TempX,0,TempZ
				
cameraposition = EntityX(camera)
cameraheight = EntityY(camera)
cameradistance = EntityZ(camera)



_PJ_(Posted 2008) [#7]
Is this an issue with MoveEntity / TranslateEntity ?
Or perhaps using Local commands when they should be global or vice versa? Not sure what you're after...


fox95871(Posted 2008) [#8]
I wish I was. No, what I'm looking for basically is a way for the camera to move more and more each additional drag. When I first posted, it was doing that, but the relativity was all messed up, forward was only forward if you were facing forward. Now that's fixed, the camera moves forward no matter what direction you're facing, but now the part of the code that handles the continuation and recording of changes, cameradistance and startingcameradistance I think they're called, is broken. That's the story so far. Thanks Gia, I'll try your new suggestion sometime in the next few days, I'm kind of sick right now. Looks like you got it though, based on your confidence. Can't wait to try it when I'm feeling better. Contact me if you need any art for your game.


fox95871(Posted 2008) [#9]
It's perfect! Except...

I tried to lock the camera height, because mode 3 is supposed to be like the camera's moving on a dolly. It sort of works, but it's like the dolly has four flat tires, especially if the camera's pointing down. Not really sure how to fix that. Here's the code:



This should be the last thing I need for this.


fox95871(Posted 2008) [#10]
I still can't figure this out... maybe someone with really good programming skills will want to help/show off. Everything's exactly the way I want it now, except the dolly for the camera (mode 3) seems to have a very bumpy ride. I know the reason, but I haven't a clue how to fix it. The reason as far as I can tell is that each frame cycle, the code first tells the camera to move forward, and say down a little, depending on how much you're facing down. Then, the height adjuster attempts to return just the height back to it's previous camera rig (mode 2) setting, so you don't actually move down into the floor just because you're facing that direction. Depending on how fast you move, and how much the camera is pointing down, that small vertical adjustment can be very noticable every frame! Mode 1 by the way is, you guessed it, camera point. The three modes together are designed to be just like a camera vehicle on a movie set. Anyway, unrelated. Hope this explaination has been clear enough. If not, just run the program with the above code box amended to it, pick mode 3, and drag toward you. First slow, then fast. I'll post the newer link tomorrow. Hope someone can help, this last fix should finalize the camera placement part of my engine! :) Thanks for all the great help so far, I couldn't have gotten this far without it.

EDIT Okay, here's the new one:
http://h1.ripway.com/fox95871/index.html


Warner(Posted 2008) [#11]
So, you want to move the camera, taking in account it's yaw, and disregarding it's pitch ? If so, a way to do it would be attaching the camera to a pivot, and use the pivot to move the camera. Then the camera can rotate freely without affecting the direction of the pivot.
When the camera is turned, the yaw is applied to the pivot, and the pitch is applied to the camera itself.
I've changed the code I posted earlier to do that:



fox95871(Posted 2008) [#12]
Great! I'm not quite done yet converting your code over to my engine, but it looks like it's going to be perfect. Thank you so much. I'll post it when it's done. Interesting level creation technique by the way.


fox95871(Posted 2008) [#13]
It's not working out. Your suggestion moves the camera by arbitrary amounts, not absolute, so I have no way of tracking it and saving the camera's position to file. It also doesn't get along with the rest of my code for some reason. Amazing work though. I think I'll just live with it. It's such a minor bug: Camera goes diagonally toward the floor each frame before returning to the set height. No big. Thanks again to Gia. My camera dolly may have somewhat square wheels, but at least it has the ability to steer now thanks to you!


fox95871(Posted 2009) [#14]
Hi, I noticed some lichen starting to grow on this topic, and it's still only about 90% solved, so I thought I'd move it up a few pages. I hope that's okay. You don't have to read the above posts, the following is the story so far:

At first the camera would move forwards and backwards just fine - as long as you never turned left or right (why would you need to do that?) If you did, and say turned right to face the wall there, and then tried to move forward, the camera would not move toward the wall, but world coordinates for forward, basically strafing the wall left.

So then Gia came along and fixed everything. Almost. Though the camera now moves toward any wall with ease, it's a pretty bumpy ride getting there if the camera's facing down at all.

I keep thinking the answer'll be something really simple again that won't necessitate an entire rewrite of the camera movement system, like maybe a simple UpdateWorld somewhere, or maybe a sight order change to the function calls?

Remember, the camera must never move toward the floor unless it's in mode 2. The move mode icons represent, in order from bottom to top: a dolly, a raise and lower rig, and a camera aimer, and it can never be more than one at a time! So any code that moves it diagonally downward means it's trying to be both a dolly and a raise and lower rig, and that's not what I need.

Hope someone can help with this getting to be ancient bug! :)

Here's the link again: http://h1.ripway.com/fox95871/index.html


GIB3D(Posted 2009) [#15]
I'm lookin at it, but first off... the weird thing that gets me is that you use 'Quit' as a variable for a loadimage, and it's also a function name.

Global Quit=LoadImage("quit.png")

Function Quit()
End
End Function


That's probably not causing anything bad to happen, but it sure ain't right.
Same for...

Global AspectRatio#=1.6

Function AspectRatio()
CameraZoom camera,AspectRatio
If KeyDown(55)
AspectRatio=AspectRatio+.01
ElseIf KeyDown(181)
AspectRatio=AspectRatio-.01
EndIf
If AspectRatio<0.1
AspectRatio=0.1
EndIf
End Function


How you're actually getting a real variable number from that function... I don't know... but that's just freaky to me.


GIB3D(Posted 2009) [#16]
Ok I noticed something. Put this before Flip in your code and run in debug mode

DebugLog "CameraY = " + EntityY(camera)


Since cameraheight
PositionEntity camera,cameraposition,cameraheight,cameradistance

is the only thing moving the camera up and down, it's the part of the problem.

I noticed the camera Y axis only changes if you move forward and backward, never left and right, so that gives somewhat of a clue.

EDIT!:
I somewhat see a (not 'the') problem. You're trying to fight against the relativity.. or whatever. For some reason, while you're moving it, it adds on the speed somewhere, trying to fight it from going diagonally. I might know a way to fix it, it's not like, TOTALLY complex, but it's probably something new to you.


GIB3D(Posted 2009) [#17]
Got it ;)

I added in a TFormVector which, I guess, gives you coords depending on which direction you are facing. I don't totally understand it, but I use it on my 3D Map Editors. You just give it a X,Y,Z and it takes that and gives you the TFormed commands that you can put into TranslateEntity to move you in the right direction no matter which way you are facing.

Like if you want to go forward but not up or down and you are looking at an angle up, moveentity would make you go up.
But using the TFormedVector, you can put in
0,0,1,entity1,0 then,
TranslateEntity entity1,TFormedX(),0,TFormedZ() to make you go forward.

Hard to explain really. I don't quite understand the point of putting in a second entity, but other than that, it's simple once you play with it.


I also did some dirty work and moved the camera moving function above UpdateWorld where it should be and moved the image drawing out of the camera moving function and into DrawMenu function. Which is under the menu control label.

I did a couple other things like, where you made the variables at the start
cameraheight = 5.5
startingcameraheight = 5.5

I changed to
cameraheight = 5.5
startingcameraheight = cameraheight

So you would only have to change the cameraheight and the startingcameraheight would be defaulted to it. Instead of having to change them both manually at the start.

Also inside of the camera moving function, I change a few things to make them simpler, like the part that had the "If mousedown(1) and blablabla = 1 and imagescollide(bla bla bla)" part, I made it simpler so it doesn't need more than one if per... check or whatever.. heh..




fox95871(Posted 2009) [#18]
Great, looks like you did a lot. I'll check this all out tonight. Sometime let me know if you want to be put in my credits too. Even if the above code isn't what I need, the previous suggestion got things about 90% better than they were before :)

That's probably not causing anything bad to happen, but it sure ain't right.

How you're actually getting a real variable number from that function... I don't know... but that's just freaky to me.

Heh heh heh heh heh... because Gia, I just can! Mwa ha ha - No, some things are still pretty messed up, I know. But I'm really happy with how things are going so far overall. It's only my first program afterall!


GIB3D(Posted 2009) [#19]
There's a LOT of things I could change in that program to make it at least "look" like it runs better. I would except for, it's your program so I'm not trying to make it mine lol. You can add me to credits if you want to ;) It won't hurt me :O lol...


fox95871(Posted 2009) [#20]
Works perfect now, thanks for doing all that work. Email me if you need any art for your games.


GIB3D(Posted 2009) [#21]
OMG!

It's only my first program afterall!



Pretty good for a first program. It took me a lot of first programs (lol) before I could even do the Gorilla game.


fox95871(Posted 2009) [#22]
Well it's a lot better now. Hey, about what you said in post 19, if you're looking for something to do, you can do that if you want. I'm not going to stop someone who wants to improve my engine for me! :)

The link you already followed goes to my filefront page, which has a bunch of stuff I've made so far. Go to town, if you want.


GIB3D(Posted 2009) [#23]
!!! If I were to change your program... lol... it would change.. like.... a lot. I've learned how to make my own system for buttons, like for my map editor, using types. It's all quad based and I've figured out how to edit textures while the program is running, so like, if I wanted to change a "1" to a "55", I could. Bad thing about the textures is that they HAVE to be to the power of 2.

I've made it so the size of the texture when the button is made, is big enough to hold a string that I attach to it, like "Quit". That in blitz3D is 8(font width) * 4(string width) which would make the texture 32x32. Now if the string was "Quits" then it would make the texture 64x64 just because it's a little bigger than 32. Might be a bit confusing but you have to experiment in order to understand.

Also, I've change how I do variable names.
;E = Entity
;I = Integer
;F = Floating
;S = String
;T = Type Variable Handle or wtver
;TYPE = Type Name
;FUNC = Function

;examples

E_Camera = CreateCamera()
I_Score = 22
F_Velocity# = 71.4
S_Name$ = "CakeMaster"
T_NewButton.TYPE_Button = New TYPE_Button

Type TYPE_Button
   Field E_Point ; Point being the main entity/model/texture/camera
End Type

Function FUNC_Button.TYPE_Button()
   Local a.TYPE_Button = New TYPE_Button
      a\E_Point = FUNC_CreateQuad() ; A custom quad making thing that I use
   Return a
End Function


Edit: Didn't notice that each post shows the post number, that's cool.

I'm not sure if I'd actually work on converting your program to my... "ways"... of doing things, but I might... seriously... I might :O lol

Kind of like how a clean freak likes to clean up stuff, I'm not a clean freak, but more like a "upgrade" freak.... lol... maybe... not sure... D:


fox95871(Posted 2009) [#24]
Hm... as far as converting my program to types, picture Gary Oldman as Dracula seeing John Harker's crucifix for the first time. But other than that, if you're bored or something, just do what you want. I really respect your skills after fixing both my nightmarish past versions of my move modes.

you have to experiment in order to understand

Very true. I spent days getting my 2.1D image overlays perfect, which equated to hundreds of individual exparaments and quite a bit of caffeine! You gotta want it enough to give it your all. I try to only post when I'm practically dying for the help, like I was with my move modes.


GIB3D(Posted 2009) [#25]
Oh about your menu, I tried changing the resolution and the only the sprites stayed where they should be. Two bad things your doing is, positioning where you want the images, inside the images, instead of in the program, which, well, isn't the best way to do it. Second is, using images ;) I've been trying to change my ways by using "quads" and apply editable textures to them. They're not hard to position.

I gave each button (quad) a string variable for each one (in the button type), and created a function that loops through all the buttons, and does the "Select, Case" thing. The cases are the button string variables. If that button has that string, then, depending on the button, it checks if it's picked using CameraPick, and does it's own little function that I want it to do. Like I added a button for mine, in the top right corner, an "X" button. If you press it, it ends the program, easy. I'll try to put it up on the website (not the source) so you can see it :D

Direct link to the updated game... http://ias.bossyboy.com/forums/download/file.php?id=7 so you can take a look at the map editor.


GIB3D(Posted 2009) [#26]
MWAHAHAHA

I'm gonna go ahead and redo your program :D This'll be interesting. It'll give me something to do while I'm thinking of ideas for the Gorilla game.


fox95871(Posted 2009) [#27]
No stealing now...

Glad to have motivated you though. I owed you big time for that move mode fix, so I guess now we're settled up :)

Ideas? Try the water levels in The Legend of the Mystical Ninja. Here it is: http://www.youtube.com/watch?v=sLcPDBgrvp4

Graphics, man, you need graphics! And music. There are lots of free media sites.


GIB3D(Posted 2009) [#28]
No one has to worry about me stealing anything... except ideas ;)

I've never heard of The Legend of the Mystical Ninja, but the level you gave the link to reminds me of this one from Donkey Kong Country 3 http://www.youtube.com/watch?v=uD-odJWbeBM&feature=related

And lol @ "Graphics, man, you need graphics! And music." At the moment I don't actually NEED anything. It's mostly just a slap together of all my knowledge and seeing what I can make/mold it in to. I've gotten most of the ideas for the Gorilla game from Super Mario World, Donkey Kong Country games, and Super Smash Brothers Melee and Brawl.

All of the textures I've made myself using paint shop pro, except the skysphere which my computer generated from a panoramic generator program someone posted. I made ALL of the models myself, except of course, the ground pieces, I coded them in the game, but there's no model FILE for them ;) But the 2 Gorillas, Kangaroo, Banana, Orange, and the latest enemy the Tick (and future models) I made myself.

Thanks to the video you showed me, it gave me an idea for more than one type of AI. Right now the only thing the enemies can do is...
1. Targeting system that sees how far away you are, and targets a player if he's close enough. If the player gets to far away, it stops targeting that player.
2. Try to follow you depending on which side you are on.
3. Jump if you are higher than it

But now I can try to add an AI chooser that let's you input a number to determine it's AI. So 1 could be the jumping following AI. AI 2 could be a flying AI that drops junk on top of you because you said bad things about it's momma.


GIB3D(Posted 2009) [#29]
I just realized I can make my OWN music.. so now I have any future musicy stuff covered.. hopefully. Not sure how to get it to loop in-game though. But hey, I can play piano, I have made my own songs, here's proof... http://www.youtube.com/watch?v=WvqJ6F5gdNM

Making songs isn't like.. the MAIN thing I do in life.. but I have made songs. I never write them down because well, it'd take too long. I remember my songs, and I play by ear which means that I can listen to a song and play what I hear. Sometimes I get the song off key but I can still play the song, usually not ALL of the song because I'm only human, I can't remember everything in one go. I have learned one song from a music sheet, "Gary Jules - Mad World", easy song.

The song I made that I show in the video, is a mix of lots of different songs. The VERY FIRST SONG that started me making that song was, "The All American Rejects - It Ends Tonight". I got a glimpse of the beginning of the song with and the song developed from there.

Wow I just typed a finger full (said a mouth full)


GIB3D(Posted 2009) [#30]
:D IT'S ALIIIIVEEE!!!!!!
http://rapidshare.com/files/196858257/MoveModeRelativity2009-2-11.rar

It's not all the way done yet, but it's good enough so far ;) Using quad based buttons and shiz. I haven't removed all of the images yet because I'm still in the process of figuring out what I want to remove. The mouse image I'll keep but I'll have to change it because all of that black space DOES NOT need to be in there. I'd use a quad based mouse cursor but hey, I wouldn't know how to get it to work right, or work with the CameraPick.

The button text at the top left might look a bit wonky but I can't help it. But I did figure out I dont HAVE to have the textures like 32x32 64x64, they can be 32x16 and 16x128 :)


fox95871(Posted 2009) [#31]
I'm getting this, over and over and at different computers:

http://rs404tl.rapidshare.com/files/196858257/104996/MoveModeRelativity2009-2-11.rar

Any idea why?


GIB3D(Posted 2009) [#32]
What's the problem?


fox95871(Posted 2009) [#33]
What I said! :) It won't download no matter where I try to download it from. Wanna just send it to me? My email's on my profile.


GIB3D(Posted 2009) [#34]
Oh, how about I'll try uploading it to FileFront then?

[[Here it is]]


fox95871(Posted 2009) [#35]
Much better. That site I mean, I'll check out your Frankenstein tonight. I mean...I'll check out your adaptation tonight. Hopefully you didn't stitch anything together with arrays or that For/To stuff I hate. Well, I shouldn't say hate. Loathe, that For/To stuff I loathe.

Don't mind me, I'm sick today.


fox95871(Posted 2009) [#36]
It doesn't look like mine, bud! Ha ha ha ha ha ha ha!

Hey, one thing I like...the sine slowdown. Could you apply that (simply) to one of my older bbs without changing much else? I'd say I could do some art for you in exchange, but you never take me up on that offer, so how bout in exchange for the motivation I already gave ya! ;P

Looking at your code, man... considering yours is about ten thousand times more complex than mine, and it works, and mine's simple and it works, wouldn't you say I could just keep on going in the direction I'm going and end up with a perfectly well liked program that a lot of people use and enjoy, even though if any actual coders saw the source they'd probably laugh? What I mean is, what's wrong with coding like a five year old as long as the program works?


GIB3D(Posted 2009) [#37]
Not sure about what sine slowdown your talking about, I don't usually slow anything down on-purpose. I'd let you do art for me it's just, I wouldn't know what I'd need atm.

To me, my code is much much simpler. The way you've set up the button clicking is half ok, but the images are set up totally wrong, even though it works, it's just not proper. As long as it works, you should be fine, just don't be surprised if someone can't help you if you're having a problem... lol.


fox95871(Posted 2009) [#38]
No, sine... you know, sine and cosine? When you move anything now, it returns to the final position gradually. Maybe I'm using the wrong term, I'm not a math genius. But whatever it is, it was used everywhere in Metal Gear Solid to make all movements start and end more smoothly.

What are you, so good you used it without thinking about it?

Anyway the reason I start all my images at 0,0 is because I have so many to do. If I had to crop every single one in photoshop, then line every one up by number in the code, it would take way longer than just setting them all at 0 and knowing they'll end up in the right place no matter what. So some are bigger than they need to be, pngs are small, and my engine loads up fast enough for me.

See ya later :)

Oh, and see if you can put that slowdown thing in my older code now that you know what I'm talking about. "I'm going to need you to go ahead and come in on Sunday too..." Sorry, I didn't mean to say it like that! But if you could that'd be really helpful.


GIB3D(Posted 2009) [#39]
Um... I don't use any sine, tangent, cosine shiz when it comes to moving. Its just plain physics stuff.

X_Velocity = X_Velocity + X_Acceleration

X_Velocity = X_Velocity * X_Friction

X_Acceleration = 0


It does that with each axis.


fox95871(Posted 2009) [#40]
So where would you work that into my code at the end of post 17? That was when you got it to the point were I thought it was best, but past that point I can't understand anything. Just put a codebox of that code with what you did with the friction or whatever.

By the way, could you send me another link for your gorilla game? I have some art ideas for it :)


GIB3D(Posted 2009) [#41]
I'll show you an example for the basic movement part and you can stick it in there yourself so you, hopefully, can understand it more.



http://files.filefront.com/GorillaV6rar/;13283643;/fileinfo.html


fox95871(Posted 2009) [#42]





GIB3D(Posted 2009) [#43]
LOL holy sh** that's awesome :D Hehe, maybe I'll mess around with my image just to one up you (nicely though).

Edit: Hmmmm I don't know how YOU did it. What I'm messing around with doesn't look near as good as yours.

I'm not even going to show it lol, it's that bad.


fox95871(Posted 2009) [#44]
It's just color changes mostly, and retexturing some things. For the background, you could just copy mine and repeat it over and over in Photoshop so it's wider. Also, the banana peels and new gorilla texture could be copied pretty much directly over to the uv image with some not so fancy footwork (lasso and paste). As for blacking out the emptyspace, maybe try making some progressively larger level parts, so you don't have to use a bunch of smaller ones?

Looking forward to seeing the real thing! I'm an artist first, so I need help from good programmers like you, and I'm happy to offer my help in exchange.


GIB3D(Posted 2009) [#45]
I'm taking a break on the Gorilla game to try and remake some already made games like, The Sims, Spyro, Twisted Metal, other games that I like. I don't care about finishing them, I just want to learn as much as I can from them.

And about the banana peel, I'd rather keep the texture I have because, well, I made it out of a real banana (somewhat ripe banana). Nice effect on the sun though but I'm keepin it unreal and somewhat cartoony.


fox95871(Posted 2009) [#46]
Cool. You should do whatever you want to do most. Good luck with those other games!


GIB3D(Posted 2009) [#47]
I also might try TimeSplitters: Future Perfect, Wolfenstein 3D (because theres no jumping or pathfinding for AI). I was working on Spyro but I thought to myself that I could try to make something like Notepad, that'd be simple, callin it GIAPad. It's just to see how far I can get, and try to make things I normally wouldn't in a game, like word detection. Word detection, like when your typing gets to the end of the page, the whole word goes to the next line, not just the letters that are cut off.