Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Efficientisizing my code

Author
Message
1sk8kr3w
14
Years of Service
User Offline
Joined: 24th Oct 2011
Location:
Posted: 24th Oct 2011 10:05
Other than the fact that the zombies all run into each other, any one who has time to look over a somewhat noobies code (project files included) and just tell me general problems or how i could do certain things better maybe with a more advanced technique. There aren\'t many guides for intermediate DBP users.

Project Files:
http://www.megaupload.com/?d=8IUJ0WNX

1sk8kr3w
14
Years of Service
User Offline
Joined: 24th Oct 2011
Location:
Posted: 24th Oct 2011 19:55
oh and does any one have any idea how i can get hem to stop going inside eachother
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 25th Oct 2011 02:12
Hi 1sk8kr3w

I can't run your code you've posted as I don't have the AI plug in.

However, I have noticed this line:



You don't need the ABS command here as any number that is squared will always be positive.

(10-3)^2 = (+7)^2 = 49
(3-10)^2 = (-7)^2 = 49


I also think that you should be calculating the value "distance#" after the zombie has moved but before this bit:



I would move the zombie, calculate the distance then make the decision to attack, which is dependant on distance. Thinking about it, what you have is the zombie making the decision to attack based on the distance# the last zombie was from the player (i.e. zombie 3 is making its decision based on how far zombie 2 is from the player).

To stop the zombies going through each other you need to determine if the zombie is or has moved into another zombie. If it does/has then do something to stop the zombie going through the one it's walked into (i.e. put it back to its old position, turn it into a bat and have it fly away, have it move to the side, kill the other zombie or whatever).


As I said, I can't run your code so I can't see how the zombies are moving around. I took out all the AI stuff and replaced the media with primatives and got a third person camera view when I ran it. Based on this, I've come up with a demo of how I would start a game like this, without all the media, plug ins and what not, just primatives and native DBP code.



The best tactic so you can see what the zombies are doing is to move backward and strafe either left or right.

Quote: "There aren't many guides for intermediate DBP users"


It's time to make the transition from beginner to intermediate and start figuring things out for yourself. Example's and tutorials will only take you so far, they're mainly to show you what is possible as opposed to telling you everything that you might want to do. What you need to do, and I'm not intending to offend, is to learn how to solve problems. That's the real difference between a beginner and an expert

I hope my demo gives you some ideas.

Login to post a reply

Server time is: 2026-07-11 14:36:11
Your offset time is: 2026-07-11 14:36:11