Author Topic: Need help in battle engine  (Read 7345 times)

0 Members and 1 Guest are viewing this topic.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Need help in battle engine
« on: October 19, 2010, 09:24:45 pm »
So I'm trying to make BASIC battle engine that monster comes out depends on # of party (max=3)
The turn will be decided by the speed.
I've tried, but I'm stuck.
Can you guys give me general algorithm for it?
Sig wipe!

Offline guy6020665

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 481
  • Rating: +7/-1
    • View Profile
Re: Need help in battle engine
« Reply #1 on: October 19, 2010, 09:38:31 pm »
When you say monster come out does that mean at the very beginning? If so perhaps have a variable that holds the number of people in your party and use that for a loop?

like this?
Code: [Select]
(Number of people in your party)->B
For(A,B,1,-1
randint(1,(however many enemies you plan on))->C
If C=1
Theh
output(your choice,your choice+A,"enemy character"
enemy HP -> variable that holds the enemies hp
End
If C=2

"and so on"

That should display the enemies, you just have to add in numbers, thats just the beginning though.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Need help in battle engine
« Reply #2 on: October 19, 2010, 09:40:51 pm »
thnx!
Sig wipe!

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Need help in battle engine
« Reply #3 on: October 19, 2010, 09:42:51 pm »
I'm actually working on a very complex RPG that I believe follows some of these guildlines.  If you wish, I can post the battle engine's code in its current state for you to look at (though keep in mind it's a work in progress. :) )
http://www.omnimaga.org/index.php?board=63.0 I suggest looking at the screenshot thread. ;D

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Need help in battle engine
« Reply #4 on: October 19, 2010, 09:44:48 pm »
Ah! My computer froze trying to view the screenshots! :o
Sig wipe!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Need help in battle engine
« Reply #5 on: October 20, 2010, 02:38:19 am »
I'm actually working on a very complex RPG
I'M glad to see that in present tense, since it means it's still alive ;D

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Need help in battle engine
« Reply #6 on: October 20, 2010, 07:42:01 am »
One more question:
I got stuck where speed decides the turn.
it was no problem with 1v1 (Max())
but, is there any less-bytes-consuming way to decide who go first?(Speed-based)
Sig wipe!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Need help in battle engine
« Reply #7 on: October 20, 2010, 02:01:49 pm »
It depends, is it kinda semi real-time, where you can sometimes attack twice in one turn if your speed is very high, or is it more like the old FF games?

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Need help in battle engine
« Reply #8 on: October 20, 2010, 03:06:00 pm »
It depends, is it kinda semi real-time, where you can sometimes attack twice in one turn if your speed is very high, or is it more like the old FF games?
No.. Speed is just used for turn
Sig wipe!

Offline guy6020665

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 481
  • Rating: +7/-1
    • View Profile
Re: Need help in battle engine
« Reply #9 on: October 20, 2010, 03:27:21 pm »
Well I don't know an easy way to figure out who goes first, but after that you could put the order in a list and use that to decide the battle cycle.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Need help in battle engine
« Reply #10 on: October 20, 2010, 03:37:40 pm »
One more question:
I got stuck where speed decides the turn.
it was no problem with 1v1 (Max())
but, is there any less-bytes-consuming way to decide who go first?(Speed-based)

Whoever has the higher speed goes first. If there's a tie, then pick the first person.

For example, in Axe
Code: [Select]
100->A
102->B
If A≠B
If A>B
First player attack
Else
Second Player attack
End
Else
First player attack
End

This could be done very efficiently in Assembly.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Need help in battle engine
« Reply #11 on: October 20, 2010, 03:40:54 pm »
i meant 2v2 or 3v3
Sig wipe!

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Need help in battle engine
« Reply #12 on: October 20, 2010, 03:54:51 pm »
Here, this may help:
Find the element in L1 that's the smallest (defaults to the  biggest element number in case of tie):
max((L1=min(L1))cumSum(binomcdf(dim(L1)-1,0
Find the element in L1 that's the biggest (defaults to the  biggest element number in case of tie):
max((L1=max(L1))cumSum(binomcdf(dim(L1)-1,0

Ex:
{6,4,6,78,4,9001
max((Ans=min(Ans))cumSum(binomcdf(dim(Ans)-1,0
Would return 5

{6,4,6,78,4,9001
max((Ans=max(Ans))cumSum(binomcdf(5,0
Would return 6

I hope this helps! ;D
« Last Edit: October 20, 2010, 04:02:11 pm by ztrumpet »

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Need help in battle engine
« Reply #13 on: October 20, 2010, 03:57:40 pm »
thanks again!
Sig wipe!

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Need help in battle engine
« Reply #14 on: October 20, 2010, 04:05:21 pm »
I'm actually working on a very complex RPG
I'M glad to see that in present tense, since it means it's still alive ;D
It's in progress, but I want to finish Exodus before starting work on it again.  They conflict too much to be worked on together easily. ;D

thanks again!
Cool, I hope you got it to work. :D