2016-12-04 00:42:21

Hello, I'm trying to make a starship game, but the ai keeps targeting ships from the wrong faction.
Here is the code, in a zip file.
https://www.dropbox.com/s/e9kvlum520sog70/misc.zip?dl=0
run it, and you'll know what I mean.
There is also a bug where the player does less dmg then the ai whith there ships weapons
Please tell me what the problem is.

2016-12-08 15:48:11

Hello,
I think, that I know why ai is not working correctly, only before I will tell something concrete, I must get It to work, and that is actually the problem. Ai in me edited version seems to work good, howewer, game is crashing from time to time, to the index out of bounds error. To trace It, I will use source code, howewer knowing something more about code and programmer can make It faster and easyer.
I have 2 questions. 1. why are there 35 ships, when only 4 are actively playing?
And 2. what are your programming skills? I do not want to troll you or something like that, I am asking because you style is little bit complicatier that It can be, and I see some mistakes with arrays using, but do not know sure at this time if It is your mistake, or if I do not see something that can explayn It in large code structure.
So, if you can, answer please these questions, I will try to help you get the code working.
Best regards

Rastislav

2016-12-10 22:17:06

I think I had 35 ships to avoid a runtime, or maybe I had a problem while coding the game, set it to 35, then forgot to change it.
I don't think it matters, you can just use the is_canning bool to get it to tell you if the ship is active.

Well, I'm not that good, I picked up bgt, always wanted to try and write a program, and this is my first try to make something that has gotten this far off the ground.
So there you go! I'll keep this tab open for a few hours.

2016-12-10 22:19:18 (edited by keithwipf1 2016-12-10 22:28:15)

Its all my code, there might have been a few errors, like in the attack menu where, if the array had a length of 0, it could crash?
I've got a good idea of pretty much all BGB concepts.

2016-12-28 16:56:39

Hello,
sorry for long response time, I was vacationing last veeks, but now I am back, and can continue in solving programming issues. smile
I want to ask, is there some difference between ship's inactivity and inexistence? I mean, can inactive ships have influence to battle? Can they wake up or something like It?
Best regards

Rastislav

2016-12-31 21:51:40

No: maybe you could say what you think the problem is then I can try and test your thearrey or idea.

2017-01-02 00:40:31 (edited by Rastislav Kish 2017-01-02 00:42:35)

Hello,
okay, I will tell you what I think, so you can try to make some fixes yourself, and possibly solve the issue, you know your code and style better.

So, for first, line which catched me:
acter.lock=random(0, opar.length-1);
this is in turn procedure of ai scrypt. Problem is, that if lock means pointer to the target, It can not be assigned by this way. Lock is integer, so if you choose random number from length of array with selected good / evil ships, and assign it to aircraft's lock, you will gave incorrect result, because position in opar temporary array has nothing in common with position in ships array, so you can get correct result as well as incorrect, depends on order of good and evil ships and selected number.
I created two loops, because there is also second line of this type, and with them ai seems to work right, hovever with errors in some times, which cause I searching for.
What you think about this?
Hope this helps.
Best regards

Rastislav

2017-01-07 21:59:16

I guess it could be possible.
Could you please show me what you have on Dropbox or something?

2017-01-10 23:29:52

Hello,
yeah, I must only find version not damaged by my experiments with only these two cycles, I will upload it somewhere.

Rastislav

2017-01-16 01:08:09

Sorry if I'm being pushy.

2017-01-17 15:40:15

Hello,
no you aren't, only I have smaller amount of time now, but here is the code:
https://drive.google.com/file/d/0B0IeyG … sp=sharing
It contains those two cycles about which I wrote in my previous post, but also one change with indexes operations, compare source codes for more detayls, I can not remember now what all was done.
Only problem are runtime errors from time to time, choosing of target seems to work now, but this not, I guess that problem is somewhere in taking procedure, but not sure,.
Best regards

Rastislav

2017-01-21 20:28:49

Thanks!