forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

artificial coding

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
omar_omar



Joined: 21 Jul 2006
Posts: 6
Location: Ontario

PostPosted: Fri Jul 21, 2006 8:50 am    Post subject: artificial coding Reply with quote

im making a small shooting game and i want some artificial coding help wut type of codes do i have 2 use and is math.randoomseed(os.time()) needed?
thnx in advance ;)
_________________
im not gay
no no ways
Back to top
View user's profile Send private message Send e-mail MSN Messenger
omar_omar



Joined: 21 Jul 2006
Posts: 6
Location: Ontario

PostPosted: Fri Jul 21, 2006 9:29 am    Post subject: Reply with quote

can some body replay ASAP!!!
_________________
im not gay
no no ways
Back to top
View user's profile Send private message Send e-mail MSN Messenger
JC



Joined: 02 Jun 2006
Posts: 16

PostPosted: Fri Jul 21, 2006 9:47 am    Post subject: Reply with quote

You need the math.randomseed(os.time()) to ensure you random numbers really are random. If you don't seed the random number generator (or if you seed it with a known value) then the number sequences will be the same each time. By using os.time to seed it you use a different number each time the program runs.


As for what type of code you need, I think you'll need to be a bit more specific.

Let us know a bit more detail and I'm sure someone can help.

HTH,
JC
Back to top
View user's profile Send private message
omar_omar



Joined: 21 Jul 2006
Posts: 6
Location: Ontario

PostPosted: Fri Jul 21, 2006 10:34 am    Post subject: Reply with quote

ok as i said before i need to code an enemy

so wut exactly this enemy is supposed to do is shoot with a gun at the player
run towards the player if the player is far etc
so do u get the idea :S ?
_________________
im not gay
no no ways
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Fri Jul 21, 2006 11:04 am    Post subject: Reply with quote

This is not an "OMG TEACH ME TO CODZ0R!" forum. This is ps2/psp specific homebrew dev discussion. Learn how to code before you come here, because we are not going to teach you.
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
omar_omar



Joined: 21 Jul 2006
Posts: 6
Location: Ontario

PostPosted: Fri Jul 21, 2006 11:11 am    Post subject: Reply with quote

i already know how to code but i just need alil help with artificial coding thats all can some one help me with my previous question if thats not a prob.
thnx
_________________
im not gay
no no ways
Back to top
View user's profile Send private message Send e-mail MSN Messenger
JC



Joined: 02 Jun 2006
Posts: 16

PostPosted: Fri Jul 21, 2006 12:14 pm    Post subject: Reply with quote

It's pretty easy once you break down what you want to do:

1) See if you enemy is lined up with your character (check the X or Y setting were appropriate)
2) If he is lined up use a random number to decide whether or not to shoot (if math.random(1,3) = 1 then ......... end)

As far as movement is concerned this is slightly more complicated. You first need to decide if your enemy will 'chase' your character or just move randomly.
Back to top
View user's profile Send private message
omar_omar



Joined: 21 Jul 2006
Posts: 6
Location: Ontario

PostPosted: Sat Jul 22, 2006 3:20 am    Post subject: Reply with quote

thnx man that helped
and for the math.random()
the # i pot between the bracets e.g. 2,6
it will chose a random # between 2 and 6 right :S ??
_________________
im not gay
no no ways
Back to top
View user's profile Send private message Send e-mail MSN Messenger
JC



Joined: 02 Jun 2006
Posts: 16

PostPosted: Sun Jul 23, 2006 2:37 pm    Post subject: Reply with quote

Yep, that's correct.

Check out these links, they are pretty usefully

http://www.lua.org/pil/
http://www.lua.org/manual/5.0/manual.html
_________________
Remember, don't sweat the petty things
and don't pet the sweaty things.......
Back to top
View user's profile Send private message
omar_omar



Joined: 21 Jul 2006
Posts: 6
Location: Ontario

PostPosted: Mon Jul 24, 2006 11:24 am    Post subject: Reply with quote

thnx DC, that was alot of help.
and i know i shoud'nt be askin this but
wuts the definition of
math.pi
math.( dunno diffrent words here )
can somebody answer my question please if thts nnot a prob.
thnx so much ;)
_________________
im not gay
no no ways
Back to top
View user's profile Send private message Send e-mail MSN Messenger
be2003



Joined: 20 Apr 2006
Posts: 144

PostPosted: Mon Jul 24, 2006 11:50 am    Post subject: Reply with quote

pi =3.14
pi is a number used when messing with circles, maybe you should take an online geometry review(alot of the math.something is based on geometry and algebra and maybe some trig)
_________________
- be2003
blog
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group