Need help with FPS

Blitz3D Forums/Blitz3D Programming/Need help with FPS

Berserker [swe](Posted 2004) [#1]
Need some help with how to move just like in a regular FPS-Game.


Berserker [swe](Posted 2004) [#2]
Short:
I cant move around in my maps with a camera that rotates when i move the mouse. But if i'd like to move in X and Z i cant look up or down.

I have tried and tried!
My problem is this:

* Either the camera move fine and the player doesent.

* Or the player moves in different directions depending on where the camera are.

* Or neither...

Please help me someone!


puki(Posted 2004) [#3]
Graphics3D 800,600; change this to whatever you want
HidePointer

walkspeed#=.1; speed at which the camera/player moves at - originally set to .1 (just in case you changed it)

scenery=CreateCube()

;create the ground
floor1=CreatePlane()
EntityColor floor1,50,255,50
PositionEntity floor1,0,-2.3,0 
EntityType floor1,2

;create camera/player
Global player=CreatePivot()
Global camera=CreateCamera(player)
CameraRange camera,1,100
CameraClsColor camera,50,50,200; colour the sky
PositionEntity player,5,1,-2
EntityType player,1

; MAIN LOOP
While Not KeyHit(1)

pz=EntityZ(player)
px=EntityX(player)

Gosub MoveCamera

UpdateWorld
RenderWorld
Flip
Wend
End

;---------------------------------------------------------------
.MoveCamera
mx#=-.25*MouseXSpeed()
my#=.25*MouseYSpeed()
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2

TurnEntity player,0,mx#,0,1
TurnEntity camera,my#,0,0,0

If KeyDown(200) Or KeyDown(17) Then MoveEntity player,0,0,walkspeed
If KeyDown(208) Or KeyDown(31) Then MoveEntity player,0,0,-walkspeed
If KeyDown(205) Or KeyDown(32) Then MoveEntity player,walkspeed,0,0
If KeyDown(203) Or KeyDown(30) Then MoveEntity player,-walkspeed,0,0
Return
;-----------------------------------------------------------


Edit: this is actually a quick and simple fix - not necessarily perfect - but at least you get the idea.


Berserker [swe](Posted 2004) [#4]
Thank you very much!

Unfortenetly it doesent work any better then what i've accomplished =(

You see the player should alwas move straight ahead (in the direction the camera is pointing. Not just X=X+1 cuz then it will change as you look at a nother direction.

Thank you anyway!


puki(Posted 2004) [#5]
I don't understand? In my code the player walks in the direction of the camera - that's why I put the cube in there so you could walk at it from any angle.

Do you want it so that you can walk in one direction and look around whilst walking in another direction? - a bit like a tank turret does - like in a 'Mech' game.


Berserker [swe](Posted 2004) [#6]
I'm so verry sorry!

It does work... 'm so sorry, thats just the way i want it!
You will be added in my "Special Thanks" if my game ever gets ready =)


Berserker [swe](Posted 2004) [#7]
I found another problem though...
I get a "Entity does not exist" on the player if i have a function called MainLoop().

I've experienced similar problems before but i have ignored them and put almost all code in the mainloop instead (but i think that looks bad) =) im use to the BlitzBasic and BlitzPlus (i'm actually new to Blitz3D) anyway maybe there some major codestructure-change that i should be aware of ??

anyway thanks once again for the help!


Kev(Posted 2004) [#8]
have you made the varables Global?

kev


puki(Posted 2004) [#9]
Oh, that's just my test code for him "Kev", I was just showing him the idea - he'll lift the code that he needs out of it.

However, it is probably a 'global' problem when setting up the camera/player.

Edit:

'Global variable'

Parameters:
variable = any valid variable/TYPE name

Description:
There are two types of variables in Blitz Basic; local variables and global variables. Global variables can be utilized anywhere in your program (i.e. the main program look and all functions. Use global variables when you need to track a value across your entire program (player score, lives, etc). You can also define TYPEs as global as well.

Example:
Global player=CreatePivot()
Global camera=CreateCamera(player)


Berserker [swe](Posted 2004) [#10]
Well i know all that stuff but i cant figure out why it doesent work for me. I mean everything works fine if i have everything in one loop.

I think it might have something to do with UpdateWorld, maybe all changes to an Entity has to be changed at the same time before a UpdateWorld ??


Rob Farley(Posted 2004) [#11]
A function will not see an entity if it has not be delared global...

This won't work:
;main loop
box=createcube()
repeat
movebox(5)
renderworld
flip
until keyhit(1)

function movebox(d#)
moveentity box,0,0,d
end function


This will work
;main loop
global box=createcube()
repeat
movebox(5)
renderworld
flip
until keyhit(1)

function movebox(d#)
moveentity box,0,0,d
end function


But this is best
;main loop
box=createcube()
repeat
movebox(box,5)
renderworld
flip
until keyhit(1)

function movebox(entity,d#)
moveentity entity,0,0,d
end function



Dirk Krause(Posted 2004) [#12]
@Berserker [swe]: there are at least two examples siiting around somewhere; at least one from jfk is in the code archives, the other from rob cummings is also somewhere.

@rob farley: is there a speed penalty on the third (clean) version?


Rob Farley(Posted 2004) [#13]
I doubt it as passing an entity isn't actually passing an entity. You're just passing it's handle which is an int (4 bytes). So yes, you will the the overhead of shifting 4 bytes to a function.


Dirk Krause(Posted 2004) [#14]
oh my god. this is way too much for my highly optimised game :-).

thanks.


Zethrax(Posted 2004) [#15]
Here's an example of basic first person perspective movement and mouselooking.




Berserker [swe](Posted 2004) [#16]
Wow! Thank you all!


Berserker [swe](Posted 2004) [#17]
New problem...

I seem to have some problem adding a weapon to my game.
I've looked at other codes but i dont quite know how to do anyway.

Ive sucessfully added the gun but it's in the wrong place; deep underneath the map.

Maybe someon can help me with a small peace of code?
Thank you all!


Jeremy Alessi(Posted 2004) [#18]
Check this out. It's a fully functional networked FPS example I did up using only Blitz stuff:

http://www.blitzbasic.com/codearcs/codearcs.php?code=1142


Zethrax(Posted 2004) [#19]
Try using ResetEntity on the gun after you've positioned it.


Dirk Krause(Posted 2004) [#20]
Rob Cummings to the rescue - where is your FPS example code? It had everything in it that this guy wants!

I just can't find the original link anymore!


N(Posted 2004) [#21]
You could try his signature, for one.

http://www.redflame.net/files/fpstest.zip


Dirk Krause(Posted 2004) [#22]
You maybe right - but then again, it was easy :-).

(That's a thank you)


Berserker [swe](Posted 2004) [#23]
I'm on vacation in Americ right now, so i'll look it up when i get back.

But i think that in youre example Jeremy Alessi the gun is hard-coded and not a .b3d-file. Maybe it doesent matter... but i don't know.

Thank you very much for youre cooperation!


Jeremy Alessi(Posted 2004) [#24]
You want to place the gun to the camera right? It would be the same as placing the cube I used. Only you'd LoadMesh("Gun.b3d") instead of CreateCube().


Berserker [swe](Posted 2004) [#25]
Allright i'll look in to that as soon as im back from my vecation.
Thanks!

I really like when you contribute open source so that newbies like me migh have a chanse to learn!
Cuz that's whats its mostly about for me, i hope i can leran as much as possible to take some eas of the work im facing in Gamedevelopment-school.


Berserker [swe](Posted 2004) [#26]
Now im back from my vaccation in America and ave settled down in Sweden again. Much interresting and America and beutiful weather but i have missed my hobby-proggramming...

Anyway i have fixed my level abit so it's almost done, i have startded coding some simple AI for my enemies (wich is Zobies btw) but i still cant get the gun to work out =(

Should i have it fixed
(PositionEntity(gun,ScreenWidth/2,ScreenHeight/2,8))
or should i update it all the time
(TranslateEntity) ???

Please someone give me a smal example.


jfk EO-11110(Posted 2004) [#27]
I have no idea how your code looks, but try to parent the gun to the camera, then you don' t have to care about it any longer. just load it with the camera as the parent, then translate it to the screen position you want it to be.
camera =createacamera()
gun=loadmesh("ak47.3ds",camera)
translateentity gun,.2,0,-.1,1 ; find values by trail'n'error

maybe you also need to scale the weapon.


Berserker [swe](Posted 2004) [#28]
Thank you very very much!

I didnt work either at first, but now i finally worked it out. Although i dont use the TranslateEntity command, only PositionEntity.

I will continue post questions in this forum since i have alot of problem coming up, enemy AI etc...

But thank you alot!


Berserker [swe](Posted 2004) [#29]
Hi there everybody!

It's been a little while since i sat down infront of my computer and a even longer while since i programmed. Becdause i have joined the army now...

Anyway i have one week vacation now and i wreally need some help with my game. Here's the problem:

When i fire my gun a small hole appears on the walls of the map. These small holes dissapear after a while and im happy about it.
But if i hit one of my zombies the hole attaches to an invisible square (not on a polygon) and most importently i cant kill the zombie! I think it has something to do with me using CameraPick ... heres the code...

If (Timer_Fire# + 200) < MilliSecs()
Shot = CameraPick(camera,(ScreenWidth/2),ScreenHeight/2))
If Shot
Hit(PickedX(),PickedY(),PickedZ())
EndIf
Timer_Fire# = MilliSecs()
EndIf

Function Hit(x#,y#,z#)

For Zombie.Zombies = Each Zombies
If ((Zombie\X# = x#) And (Zombie\Y# = y#) And (Zombie\Z# = z#))
Then
If Zombie\Life# <= 0 Then
FreeEntity(Zombie\Ent)
Delete Zombie
Else
Zombie\Life# = (Zombie\Life# - (30 + (Degree * 15)))
EndIf
EndIf
Next

---

And this is a zombie:

Zombie.Zombies = New Zombies
Zombie\ID = I
Zombie\X# = Rnd(-126.0,65.0)
Zombie\Y# = 1
Zombie\Z# = Rnd(64,167)
Zombie\Life# = 100.0
Zombie\DestinationX# = 0.0
Zombie\DestinationY# = 0.0
Zombie\DestinationZ# = 0.0
Zombie\Ent = LoadMD2("gfx/Zombie/Zombie.md2")
Zombie\Tex = LoadTexture("gfx/Zombie/Zombie.bmp")

EntityTexture Zombie\Ent,Zombie\Tex
ScaleEntity Zombie\Ent,0.2,0.2,0.2
EntityType Zombie\Ent,Col_Zombie
EntityPickMode Zombie\Ent,Pic_Zombie
ScaleEntity Zombie\Ent,0.05,0.05,0.05
EntityColor Zombie\Ent,Rand(1,255),Rand(1,255),Rand(1,255)
PositionEntity(Zombie\Ent,Zombie\X#,Zombie\Y#,Zombie\Z#)

End Function

I think it all has something to do with the "EntityPickMode".

Please help me my zombies wont die!


jfk EO-11110(Posted 2004) [#30]
Probably the Problem is the usage of the MD2 Format, not sure of that. You have no access to the Vertices of a MD2, so maybe the linepicking is limited as well. Try it in a small, controllable test code, just load the MD2. point the camera to it, and use Camerapick, then position a tiny cube at pickedx(),pickedy(),pickedz() and check if the cube is now on the surface of the MD2.

If it seems to be impossible to pick the MD2s surface accurately, you ma try to convert it to B3D. Maybe UltimateUnwrap3D can convert it, but I am not sure.

Additionaly I have to say, you Hit Function only checks if XYZ is equal the Zombies position. But you should rather check if the Value that is returned by the camerapick fits the Entity Handle of the zombie:

For Zombie.Zombies = Each Zombies
If Shot = Zombie\Ent
...

Of course EntityPickMode of Zombie\Ent must be Polygonal. I don't see any definition of Pic_Zombie - it should be 2.


Berserker [swe](Posted 2004) [#31]
Thats right, the Pic_Zombie is 2 but i cant seem to understand what you mean with "If Shot = Zombie\Ent" Shot can only be 0-3 right?

This is what i dont get... I will try this after i've got some sleep.
My Zombie anyway is for this moment the Gargoyle that came with a FPS-example... So it's just for test my real zombie will be in B3D after a friend of mine made one =)
3D graphics is a whole new spectra for me, i'll just try to hang in the programming.

As you may have noticed this thread has helped me with pretty much everything sofar, im just in the early ages of learning Blitz3D. My project will in no way be spectacular or even good it's solely for learning purposes.

Im new to this Blitz3D but not to Programming as is. Im eager to learn and i have nice people like you to thank for my success!

Im very grateful even though i might be a pain in the arse... On day i might be able to learn other beginners such as my selfe =)

I'll get back as soon as i got some sleep. I've been up all night waiting for this reply =)

And please excuse my english (i'm from Sweden)

Thank you and Good Night!


jfk EO-11110(Posted 2004) [#32]
No Problem. CameraPick and all Linepicks will return the Entities Handle. Of course, the Pickmode of the entity must be set. Psionic has some 3D models, including a real Zombie btw.


Damien Sturdy(Posted 2004) [#33]
you dont seem to quite have the language down yet, so keep practicing on smaller programs to learn how things in 3d work.


Berserker [swe](Posted 2004) [#34]
OK now i did exactly as you said, and even though i dont wreally understand what values a CameraPick carries... It does work now !!!

What a relief! Now i can finally move on and make blood, ammo-control, AI and such.

Thank you very very much!

I have a plan for the AI and i want to know what you think about it:

For Zombie.Zombies = Each Zombies

If EntityInView(Zombie\Ent,Camera) Then

Zombie\DestinationX# = EntityX(Player)
Zombie\DestinationY# = EntityY(Player)
Zombie\DestinationZ# = EntityZ(Player)
Zombie\MovingTimer# = MilliSecs()

If MilliSecs() < ((Zombie\MovingTimer# + 1200.0) - (10 * Degree)) Then
Zombie\X# = Zombie\X# - (Zombie\DestinationX# - (Zombie\X# - 2.0))
Zombie\Y# = Zombie\Y# - (Zombie\DestinationY# - (Zombie\Y# - 2.0))
Zombie\Z# = Zombie\Z# - (Zombie\DestinationZ# - (Zombie\Z# - 2.0))
EndIf

Text Zombie\X#,Zombie\Y#,Zombie\Z#,Zombie\ID;<<-This is for me to know that the zombie is in view...

EndIf

PositionEntity Zombie\Ent,Zombie\X#,Zombie\Y#,Zombie\Z#
AnimateZombie("Walk",Zombie\ID);<<-This is a function i made...

Next

I will sit down now all day to fix it.
Allthough the Trees i use for zombie-substitutes may not be able to move around realisticly =)


jfk EO-11110(Posted 2004) [#35]
Probably I'd rather PointEntity the enemy to the camera or player, then MoveEntity the enemy towards him. BTW EntityInView does only check if the player is behind the camera or in front of the camera, but it will ignore Walls etc as far as I remember. I'd rather use EntityVisible, and you need to make the target pickable, as well as the walls between the both. Don't use it too much, it can slow things down. EG when the enemy is way out of place, you don't need to check it at all (use EntityDistance).

But then there is still a problem with Pathfinding, unless you want the enemies to act silly. Pathfinding is a heavy chapter and personally I reduced the entire AI to simple waypoints. These are tracks the enemies may walk on, no matter what they do. So they ain't got free movement, but have to use "legal ways". it is then a further job to make them use the best ways to achieve their goal, but probably it's already pretty AI-ish if they try to shoot you from their Current position, or, by random decision, keep on running and continue firing from an other point on their waypoint track(s).

There have been several approaches to automaticly calculate legal ways and best paths from any point in a level to any other point, but sometimes this is pretty slow, ram-costy and complicated. Currently I use a waypoint recorder tool that is simply recording the way that I am walking in the level, then assigns it to an enemy in the game.


Berserker [swe](Posted 2004) [#36]
I have solved it now, at least a littlebit. Actually i solved it before youre answer by looking at a example that came with Blitz3D. But what youre saying is offcourse correct and programming an AI is hard. In the school for gamedevelopment wich i am applying for after the armie theres a speciall class just for AI-programming.

I think i'm gonna solve it in a easy way...
My zombies will roam around as they wish and only strike at me when "EntityDistance(Zombie\Ent,Player) < 50" or something. It's easy for me since i have zombies and not soldiers to fight (zombies are a bit dumb, so i heard) =)

Anyway this is my solution now:

For Zombie.Zombies = Each Zombies
If EntityDistance(Zombie\Ent,Player)>2
If (MilliSecs() > (Zombie\MovingTimer# + (12.0 - (10 * Degree)))) Then
PointEntity Zombie\Ent,Player
AnimateZombie("Walk",Zombie\Ent);<< My own function for animations
MoveEntity Zombie\Ent,0,0,0.01 Zombie\MovingTimer# = MilliSecs()
EndIf
EndIf
Next

;<< Degree is "Easy = 1, Medium = 5, Hard = 10" >>;

i will look closer into the EntityVisible command cause my zombies can now see me werever i go... I understand what has to be done i'm just notr sure how to do it...

Once again Thank you for youre help, youre very kind!


Berserker [swe](Posted 2004) [#37]
OK, i have worked it out now.
The Zombies (wich are cubes now) are attracted to me and moves constantly towards me. But when one of them has found me and stands just berfore me he/it covers the sight for all the other zombies, so when they cant see me the run away...

Well i have a temporary sulotion to that but i just wanted you to know that it can be a problem. Also my zombies doesent bump in to walls on the map as i do. Must be something with the "Collide"-command. Allthough i think i've got it right.

Hopefully i will be able to release a beta version of the game at the end of this week. Im soon going back from my vaccation in to the army again so i'll have to work alot now these final days (wich i dont mind cause i love it).

See ya


Berserker [swe](Posted 2005) [#38]
* Problem Update *

I finally got a Zombie to use in my game, i have trouble with the animations ofcourse but im working on it.

The real problem lies within the fysiks of the zombies they don't collide to buildings or the ground, they wont be affected by gravity, i think it has something to do with the "Collisions"-command.

This is how i've "solved" it:
;_____/Collision\___,
Col_Bana      = 1  ;|
Col_Player    = 2  ;|
Col_Camera    = 2  ;|
Col_Zombie    = 2  ;|
Col_AmmoBox   = 3  ;|
Col_HealthBox = 3  ;|
;-------------------'

Type Zombies
  Field ID
  Field X#
  Field Y#
  Field Z#
  Field Riktning#;<<------- Wich direction it's looking
  Field Life#;<<----------- Zombie Life
  Field MovingTimer#;<<---- Zombie Speed
  Field Ent
  Field Tex;<<------------- The Texture
  Field Direction
End Type

;_____/Collisions\________________________,
Collisions Col_Player,Col_Bana,2,2       ;|
Collisions Col_Player,Col_Zombie,2,2     ;|
Collisions Col_Zombie,Col_Bana,2,2       ;|
Collisions Col_AmmoBox,Col_Bana,2,2      ;|
Collisions Col_HealthBox,Col_Bana,2,2    ;|
;-----------------------------------------'


The Player can't collide with Zombies but he is affected by gravity and collides with walls. You think you know what could be wrong?

Thanks!


jfk EO-11110(Posted 2005) [#39]
FIrst: probably you better use entitydistance for the ammo- and health-boxes to save some speed.

The other thing: I am not sure I I understood what you're after, I guess you want the zombies to have collision and gravity and all?

Well, as far as I see you are using the same number for Player and Zombies. In theory they should be handled the same way now, tho, you need to apply gravity to the zombies as you did it with the player, if you want this at all.

If you use the same number (2) for both, player and zombie, then you will not be able to define some special collision behaviour for the zombies. Furthermore, defining "Collisions Player,Zombie..." (that is 2,2) will force Blitz to check Collisions of Type 2 against themselves, eg: Zombie1 against Zombie2 and visa versa etc.

Maybe it's easier to use a diffrent type for the zombies.


Berserker [swe](Posted 2005) [#40]
Well ok, that explains alot. The Zombies are extremly slow sometimes and the whole game gets slow. Allright! Thanks!

Now i know what is wrong but i still don't know how to get it better. How would you do it?

I mean in the help it says:
"
method - collision detection method.
1: ellipsoid-to-ellipsoid collisions
2: ellipsoid-to-polygon collisions
3: ellipsoid-to-box collisions

response - what the source entity does when a collision occurs.
1: stop
2: slide1 - full sliding collision
3: slide2 - prevent entities from sliding down slopes
"

And this is hard for me to understand.
Can i just type Col_Zombie = 87 ?


jfk EO-11110(Posted 2005) [#41]
For gravity and "real" collision you will need method 2: ellipsoid vs polygon. The Player, Zombie etc. will be the Ellipse and the floor, wall etc. the polygons.

A Self-Check (eg. Zombie vs Zombie) should only be performed by Ellipse vs Ellipse, this is much faster since it does the same as Entitydistance, and ignores the Meshes number of Polygons.

It's hard to say what's best for you since I don't know your kind of NPC Ai. In my simple Engine the NPCs always walk along waypoints, so I was able to completely skip gravity and collision for them since I got collision and gravity on while I record their ways. Only when a NPC is coming closer than a specific range to the player, I turn on collision to prevent the player from walking trough the NPC and visa versa.

But when your NPCs, be it Zombies or anything else, have their own Ai, Pathfinding, gravity, collision and everything (which is CPU costy too BTW.), of course this is a completely diffrent situation. In this case I would reccommend to

EntityType Level,1
EntityType Player,2
EntityType Zombie,3

Collisions 2,1,2,2 ; player > floor = ellipse > poly
Collisions 3,1,2,2 ; same for Zombies
Collisions 3,3,1,2 ; Ellipse > ellipse for Zombie > zombie
Collisions 3,2,1,2 ; the same for Zombie > Player
Collisions 2,3,1,2 ; as well as for Player > Zombie

and as I said, use a simple Entitydistance Check for Ammo etc., that's even faster and won't force a Collision reaction.


jfk EO-11110(Posted 2005) [#42]
Oh yeah, there is a further problem with Collisions when both parts are moving towards eachother: Collision will sometimes be missed unless you do an UpdateWorld after every single Meshes Movement. So, maybe it's a good idea to use an other method than collision (like waypoints) or a combination of diffrent methods.


Berserker [swe](Posted 2005) [#43]
I'm sorry i haven't answered sooner, im a busy man right now, im doing the "Lumpen" as its called in Sweden. Meaning im training to become a soldier for a couple of month.

Anyway im not home too often so that's why i havent replied. I did get a chanse to test youre code but it didnt work. it might have something to do with my "SpawnZombie()"-function... Im not sure i have the right code there and im experiencing problem with "Zombie\Ent = CopyEntity(Zombie)". Here is the code:
Function Spawn_Zombies(Degree)
Local TempScale
  
  For I = 1 To (3 * Degree)  
    Zombie.Zombies           = New Zombies
    Zombie\ID                = I
    Zombie\X#                = Rnd(5,90)
    Zombie\Y#                = 3
    Zombie\Z#                = Rnd(3,63)
    Zombie\Life#             = 100.0    
    Zombie\Ent               = LoadAnimMesh("gfx/Zombie/Zombie.b3d")
    ;Zombie\Ent               = CopyEntity(ZombieMesh)
    Zombie\Direction         = CreatePivot()
    Zombie\Status$           = "Roam"
        
    TempScale = (0.60+(Rand(0.21)))
    ScaleEntity Zombie\Ent,TempScale,TempScale,TempScale

    PositionEntity Zombie\Ent,Zombie\X#,Zombie\Y#,Zombie\Z#    
    PositionEntity Zombie\Direction,(Zombie\X#+Rnd(-20,20)),Zombie\Y#,(Zombie\Z#+Rnd(-20,20))    

    NameEntity Zombie\Ent,"Zombie nr."+Zombie\ID
    
    EntityType Zombie\Ent,Col_Zombie;<<<<<<<<< Maybe this is a problem.
    EntityPickMode Zombie\Ent,2    
    EntityAutoFade Zombie\Ent,90.0,250.0
        
    ShowEntity Zombie\Ent

  Next  
  
End Function


I've runned some test and it seems like only one of the zombies are correct. It all seems right to me but im new to programming in 3D.

Thank you for youre help but i wont be able to answer until next week again.


jfk EO-11110(Posted 2005) [#44]
well, if Col_Zombie is set to something other than zero, and the other entities are using something diffrent, this should work well (and yes, EntityType simply expects a number, eg. 87)

I don' tknow exactly how the zombies collision don't works correctly, does it completely fail, or is it only a problem of zombie vs zombie collision?

I'd suggest you make the collision of zombie vs floor working first, so that's

collisions Col_Zombie,floor,2,2
; start of mainloop

of course, make sure Col_Zombie is global when you assign it inside a function.

If the zombie vs floor is once working, you can start implementing zombie vs zombie collision by adding this

collisions Col_Zombie,Col_Zombie,1,2


Berserker [swe](Posted 2005) [#45]
Allright, now im just tired of this. As i have only one week of military service left i look forward to study "Game Development-Programming" in highschool here in Sweden... But how will i manage?? If i cant even build a map and walk around on it.

I have now killed my projekt and started on a new one, as i have done so many times before. All i decire is to make my map in BlitzMaplet (i can't afford any other hitec software as for now) and walk around on it.

Surely i have learnt alot since i started programming and i learn something new everytime i sit down with it, but is it healthy to learn on youre own? Some say it's the best, you'll get to think alot more then with teacher-guidence but you will also learn to avoid certain problems. Am i right?

Now im desperate to make this work, i have looked in to the "Death Island" located in the "Hi-Toro"-map in "Samples" and tried to make a similar program with my own textures and some other camerasets, but it still doesent work! I cant make the most simple of things, perhaps i dont understand the most basics of 3D-programming yet. Afterall its all in english (wich isn't my first language). Sofar i understand that it's in the Collisions that most failures are. That and multi creation of enemies etc.

Now could someone please help me from scratch or send some code or anything? Im no threat to you (yet), i just need to improve my selfesteem aswell as my skills in programming before i join school.

I dont know what else to say, im gonna play Morrowind till i find inspiration again =(

BTW Excuse my english, im from Sweden.

Thanks and see y'all later.


Andy(Posted 2005) [#46]
>Now could someone please help me from scratch or send some
>code or anything?

.main
Print "Hello World!"
Goto main

Good luck ;)

Andy


Ross C(Posted 2005) [#47]
It's not really too hard to have a map and run around on it. You should start by just moving the camera around on the map first. Basically:

1. create a camera
2. load the map
3. position the camera
4. set up collisions. Give the map and the camera "EntityTypes"
5. set up a while/wend loop, so that pressing the key escapes. eg...

While Not KeyHit(1)

   MoveEntity camera,0,-1,0
   Flip
   UpdateWorld
   RenderWorld
Wend


6. Put some movement code in there to move the camera. eg...

If KeyDown(200) then MoveEntity camera,0,0,0.1
If KeyDown(208) then MoveEntity camera,0,0,-0.1
If KeyDown(203) then TurnEntity camera,0,1,0
If KeyDown(205) then TurnEntity camera,0,-1,0


You should be able to move around on the map now :o) If you can get that working, paste your code in here, and we can start to add things to it. Get the basics working first ;)


WolRon(Posted 2005) [#48]
Have you seen my FPS example code at my website? May be what you are looking for...


Berserker [swe](Posted 2005) [#49]
Surely i have suceeded with having the player moving around on a map made with BlitzMaplet. But i havent been able to make the enemies work they just hover in thin air. Also i havent manage to make an landscape to work.

Shouldn't there be a pivot named player and a
Global PlayerCame = Camera(Player) ;?
.

Well im just of the hook now as far as military training concerns so after som heavy partying tonight and heavy recovering tomorrow i will be eeger lto get starting (once again) on my FPS.

Thanks for all the help except you "Andy" =(


WolRon(Posted 2005) [#50]
Shouldn't there be a pivot named player and a
Global PlayerCame = Camera(Player) ;?


Well, like I said, my FPS example code does just that. Take a look. Others have said it helped them...


Alienforce(Posted 2005) [#51]
Berserker:

Do you whant help ??

I havent read all the posts but give me a descprtion of
your game and i will try to help you... Or mail me some sourcecode to look at.

/Alenforce


Berserker [swe](Posted 2005) [#52]
@Alienforce

Well look through the post again and youll see, there some source code there as well. What has been on this thread is still a problem to me but now i have managed to loose the maps and modells to that project =(

I still need help with it though as im starting on a new project.

The very most basic Collision checks seems to be the largest problem right now when walking around on a map made by BlitzMaplet.

@WolRon

I know youre a great programmer and alot of help, i'll look in to it as soon as my hangover goes away. Goodnight for now.


Berserker [swe](Posted 2005) [#53]
@WolRon

I have now looked in toyoure site and read most of it, the basic stuff was not new for me but still its a good site for thouse who are even more new to blitz then me.

Youre code works fine and i belive its a good ground to stand on if tou wanna make a simple FPS-game.

But still when im sorting the code up do different functions so that it lookes nicer and maybe with some Swedish variable names, it completly fails.

Once again its the COLLISIONS that want seem to work. One thing that i've learnt from youre code was the importence of where to put the "UpdateWorld" and "RenderWorld" commands and i get it now, but it want work!

Is it ok if i mail you my slightly edited code so that you can se why it want work?

If youre response to this takes a while maybe i can even make a small map instead of the cube.

Thank you very much for youre help, if my game ever get finished =( i'll add you to the credits for sure!


WolRon(Posted 2005) [#54]
Is it ok if i mail you my slightly edited code so that you can se why it want work?
I suppose. No promises on how quickly I can respond though...


Berserker [swe](Posted 2005) [#55]
Alright, i have mailed it to you but i doesent matter. Somehow i managed to get it to work. Im constantly improving the code so that it might meat my demands.

You dont actually need much more then that if youre gonna do a small Singleplayer schooter, and i have you to thank for alot of things.

Still, my map (made in BlitzMaplet) wont show on the rihgt place. This is what it looks like:
Global level = LoadMesh("maps\1_map.b3d")
PositionEntity level,0,0,0
EntityType level,COL_LEVEL
EntityFX level,1
EntityPickMode level,2
;EntityOrder level,2 <-- don't know if its usfull
;
;
;Later On
;
Function StartValues()

  ;Blablabla
  ;Blablabla
  ;Blablabla
  ;Blablabla
  MoveEntity player,EntityX(level),EntityY(level),EntityZ(level)

End Function


anyway, im pretty happy now anyway so, have a nice day1


WolRon(Posted 2005) [#56]
my map (made in BlitzMaplet) wont show on the rihgt place. This is what it looks like:
Well, you are setting in at 0, 0, 0.
PositionEntity level,0,0,0
If this is correct, then you probably don't have the meshes origin located in the correct place when you created the mesh.

You can fix it either by moving the origin (in Maplet) or by repositioning the mesh in Blitz with code using PositionMesh. Read up on the PositionMesh command before you use it though...


WolRon(Posted 2005) [#57]
By the way, I never did get an email. Are you sure you sent it to the correct address?


Berserker [swe](Posted 2005) [#58]
well, no you have never given me one so i took the one that shows if i click on your nick: rwolbeck @ hotmail dot com.

it doesent seem right...

At this moment my development is progressing good, some few gliches plus the dam map problem.


WolRon(Posted 2005) [#59]
it doesent seem right...

You DO REALIZE that you are supposed to remove the spaces from the email address, and replace 'dot' with '.' (an actual period)? ;)

That's obviously why I didn't receive the email...


Berserker [swe](Posted 2005) [#60]
Hehe, yes and i did so aswell.
You wreally should have recieved one.

I'll sit down with my game and add some comments. I send you a new mail tonight.

Btw you can reach me on ICQ if you wanna chat sometime: 112796345


WolRon(Posted 2005) [#61]
OK, I got it. I'll take a look at it when I can...


Berserker [swe](Posted 2005) [#62]
I know that i have thankt you over e-mail but i want everybody to know what a nice person you are and that youve helped me very much! I sincerly appreciate it.


Berserker [swe](Posted 2005) [#63]
Now i have a small problem with a HUD that ive mad for my game, by makíng sprites childs of a parent i dont know how theire coordinates work for one. But after alot of testing it now looks allright even though i dont know why.

But one problem is that the HUD along with the weapon can melt in to my map and dissapear. Im pretty sure it has something to do with the Z-value of my sprites and also wich order they are rendered to the screen (EntityOrder HUD,1)?

Am i right?