Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Eeems on January 25, 2010, 10:36:25 pm

Title: Hunt z80 port
Post by: Eeems on January 25, 2010, 10:36:25 pm
So I made a simple game a little while back called hunt. The object of the game was to occupy the same space as the prey 99 times and in essence killed it. So as a few of you know I've been learning ASM and so with what free time I can get I've started to port Hunt to asm. So the actual game engine is done, but there is only one difficulty which is pretty easy, and you only have to hit it 20 times. Currently I am making the menu and fixing up the code. 
Here is a screenshot and the game, it's noshell so just run it with asm(prgmPROGRAM

Tell me what you think :D
Title: Re: Hunt z80 port
Post by: {AP} on January 25, 2010, 10:57:29 pm
What in the world is up with that screenshot? O.o
(I'll try it out though.)
Title: Re: Hunt z80 port
Post by: Eeems on January 25, 2010, 10:58:56 pm
No idea x.x it didn't look like that when I recorded it x.x must have the framerate up too far x.x
Title: Re: Hunt z80 port
Post by: {AP} on January 25, 2010, 11:03:21 pm
Anyway, just tried it out.
Interesting, but actually hurting the thing is difficult... never seems to get hurt while ON him, but only when we go through eachother.
Title: Re: Hunt z80 port
Post by: Eeems on January 25, 2010, 11:05:12 pm
Yeah I noticed that, no idea why though x.x I might have to put the damage check somewhere else in the code
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 25, 2010, 11:37:37 pm
Wow at first I thought you moved to Casio CFX9850G calc programming with the colors :P

I guess I'll have to try it

EDIT: Mhmm interesting, altough it seems a bit glitchy as {AP} described, I was on the enemy and he rarely took damage x.x

Glad you are learning ASM tho, I am happy you could get the grasp of some stuff alerady too. I guess it's a good thing since you don't have much access to a calculator at home atm...
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 12:04:27 am
lol :P well I have a new screenshot that should work better :P
yeah :/ I haven't been able to fix that yet for some reason though x.x

yeah :/ well I already a some knowledge of asm before though

EDIT: lol, wow nope. I guess I'll have to use the old wabbit for screenshots x.x
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 26, 2010, 12:33:15 am
mhmm I think he tried to fix contrast in  screenshots. He might have messed something up x.x
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 01:06:09 am
nope x.x just slowed down the framerate x.x didn't work
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 26, 2010, 01:08:10 am
I was talking about Buckeye Dude :P
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 01:35:40 am
oh :P lol sorry
well here is the menu'd one :D but for some reason the ai broke x.x oh well marvel at the menu :P

edit: also here is the original game :D
http://www.cemetech.net/forum/viewtopic.php?t=3625
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 04:45:38 pm
ok, so here is the most recent version, the menu works fine, and the AI is fixed :D also quits back to menu
source is included.
I'm using ion's iRandom routine for the AI but it doesn't require ion, I included the routine, so it's still no-shell :D
hope you like it!

EDIT: small update, more organized zip, and a readme. Also changed the win text a little.
Title: Re: Hunt z80 port
Post by: ztrumpet on January 26, 2010, 05:17:10 pm
Eeems, I tried the most recent one in Wabbit (The one I've always used used) and got this:

I don't know why, though. :(
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 05:17:53 pm
umm, wierd I'll fix that

EDIT Fixed
Title: Re: Hunt z80 port
Post by: Galandros on January 26, 2010, 05:30:01 pm
This topic is full of bugs. :o

Anyway an ASCII game in assembly is not an idea I didn't have already.
 Maybe we could explore some new effects in ASCII using ASM. One of the things could be using an custom font 4x4 or other size.
 I can't get other ideas right now...
PS: maybe something massive like lots of enemies moving around... There is an absurd amount of speed to spend on graphics. Maybe even ASCII grayscale? This is getting insane. Weregoose showed a curious picture of possible grayscale with TI font 8x8 font on UTI.
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 05:32:12 pm
lol, yeah :P

lol, well I'll get to that sometime, right now I'm just trying to learn the basics of ASM. What do you think of the gameplay? and the source?
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 26, 2010, 05:49:03 pm
Now I get ERR:INVALID when running Asm(prgmHUNT
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 05:54:04 pm
x.x wow, I'll fix that

EDIT: there you go
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 26, 2010, 06:04:38 pm
cool it works!

Btw, a bug: When you win then play again without exiting game, the enemy count is at 255 instead of 20. Also, if for example I always stay at the top, the enemy always seems to remain at the top of the screen
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 06:07:08 pm
lol oops, and yeah I noticed that, it's kind of wierd, I'll have to figure out a way to fix that

EDIT: fixed both, my random number thing wasn't going high enough, and I wasn't resetting the health x.x

EDIT2: uploaded an even better version, harder settings give them more health as well as speed :p

EDIT3: added a build info menu item, so you can check the version that's all that was done in this update
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 26, 2010, 07:08:22 pm
Cool ^^
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 07:12:25 pm
hope you like it!
any more bug reports?
anything you want added?
I will be adding "trees" that you can't move on top of later
Title: Re: Hunt z80 port
Post by: {AP} on January 26, 2010, 08:03:22 pm
Trees sound fun... but first. Reset the move counter after each match, mate.
After a couple of games I noticed I was starting an easy game with over 1000 moves already there. =P

Also, you have it damaging right, but you have to move again after the damage to get it to show up.
Not a big problem. Just pointing it out.
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 26, 2010, 08:04:40 pm
I wonder if in ASM, the dual layer ASCII BASIC trick could be easily applied without too much flickering...
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 08:10:44 pm
lol, oops, the one counter I forgot to reset x.x
I'll try to get tree's added tomorrow. the move again is because it checks at the start of the loop, I guess I could add it to the end...
hmm, well it could work. which one do you mean exactly?
Title: Re: Hunt z80 port
Post by: {AP} on January 26, 2010, 08:13:40 pm
The damage counter doesn't change til you move again. =)
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 08:52:49 pm
yeah, because it checks at the start of the loop, so essentially it checks after...I've changed it so it checks before it updates the screen, and it's actually a bit harder x.x
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 26, 2010, 10:27:50 pm
I mean dual layer ascii in the style of Elmgon or Serenity. Not tilemaps but dual layer ASCII enemy/char sprites
Title: Re: Hunt z80 port
Post by: Eeems on January 26, 2010, 10:40:40 pm
Hmm, I think it could work.
Title: Re: Hunt z80 port
Post by: Quigibo on January 27, 2010, 02:20:16 am
Maybe we could explore some new effects in ASCII using ASM. One of the things could be using an custom font 4x4 or other size.
 I can't get other ideas right now...
PS: maybe something massive like lots of enemies moving around... There is an absurd amount of speed to spend on graphics. Maybe even ASCII grayscale? This is getting insane. Weregoose showed a curious picture of possible grayscale with TI font 8x8 font on UTI.

How do you think the calculator puts text on the screen?  It uses a special sprite drawing routine for a table of ASCII characters.  But since it uses extra ROM calls and redundant error checking, it is actually MUCH slower than the standard method of drawing sprites.  If you wanted to, you can use the home screen as the 8x16 "grid" and a standard 8x8 drawing routine for your 8x6 "characters" or whatever size for a much faster result.  But that's essentially what lots of assembly games do already.
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 27, 2010, 02:44:59 am
True, for most RPGs I noticed they use the default fonts but I saw some use either custom routines or 8x8 sprites. When speed is essential, these can be useful.
Title: Re: Hunt z80 port
Post by: ztrumpet on January 27, 2010, 09:35:26 am
This is really interesting.
Eeems, I can't wait to get home and try this!
Title: Re: Hunt z80 port
Post by: Eeems on January 27, 2010, 10:01:19 am
Thanks! Hope you like it :D
Title: Re: Hunt z80 port
Post by: ztrumpet on January 27, 2010, 04:23:48 pm
Eeems, this is great!  It's really nice for your first game in a language!  Excellent job!  It dosn't hold attention for long, but it's great for your first game. :)
Title: Re: Hunt z80 port
Post by: Eeems on January 27, 2010, 05:02:08 pm
Thanks! In the next release I'll have tree's and the basic version that I originally created as well, so you can compare :P
I'm currently trying to get rid of a memory leak x.x
Title: Re: Hunt z80 port
Post by: ztrumpet on January 27, 2010, 05:17:44 pm
Wow, that sounds great!

How do you get a mem leak in Asm?
Title: Re: Hunt z80 port
Post by: Eeems on January 27, 2010, 05:19:56 pm
it's trying to write to an array, but it's not working right, and the whole RAM is filling up x.x
I've got Kerm Martian (creator of DCS) helping me solve it.

EDIT: ok here it is! you can currently move on tree's, but I'll add checks later
tell me what you think
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 27, 2010, 11:30:56 pm
Nice, what trees are supposed to do, though?
Title: Re: Hunt z80 port
Post by: Eeems on January 27, 2010, 11:39:07 pm
just look pretty right now, later I may implement hiding behind them so you are invisible, or they are just objects in the way.
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 27, 2010, 11:50:14 pm
Aaah ok cool ^^

I wonder if you'll switch to sprites soon? ^^
Title: Re: Hunt z80 port
Post by: Eeems on January 27, 2010, 11:53:18 pm
lol, I am in the process of switching to sprites, I'll have to completely re-write the displaying routines though. wish me luck :P
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 28, 2010, 12:01:38 am
Good luck!
Title: Re: Hunt z80 port
Post by: Eeems on January 28, 2010, 01:02:29 am
Thanks! I'll need it!
Title: Re: Hunt z80 port
Post by: ztrumpet on January 28, 2010, 07:48:08 am
Good luck!
Title: Re: Hunt z80 port
Post by: Galandros on January 28, 2010, 08:52:27 am
Good luck, learn from it and have fun!
Title: Re: Hunt z80 port
Post by: ztrumpet on January 28, 2010, 12:21:45 pm
I tried the new version.  It's great!!  Excellent job!  I like the basic version also. :)

I found one bug:  When trees are placed you can have them in the row with the score and time:
(Look by my score)
Title: Re: Hunt z80 port
Post by: Eeems on January 28, 2010, 02:23:08 pm
Thanks

yeah I'm aware of that one.  It's because of ions random routine, and nothing I do can stop it it seems x.x I might have to use a modified one for that.
Title: Re: Hunt z80 port
Post by: ztrumpet on January 28, 2010, 02:50:29 pm
Thanks

yeah I'm aware of that one.  It's because of ions random routine, and nothing I do can stop it it seems x.x I might have to use a modified one for that.
Could you do this: (In basic)
Repeat Ans>1
RandInt(1,8
End

I think in Asm it would be something like:
loop:
    xor a
    cp rand_ion_thing
    jr Z, loop

Am I close to right?
Title: Re: Hunt z80 port
Post by: mapar007 on January 28, 2010, 02:53:16 pm
Close ;D but it could be easier. (correct me if I'm wrong/I misinterpret)

it would be like
     call irandom
     and 7 ;(that is, a mod 8, row indexes are 0-7 in asm)


Title: Re: Hunt z80 port
Post by: calc84maniac on January 28, 2010, 02:58:36 pm
Code: [Select]
ld b,7
call irandom
inc a
Title: Re: Hunt z80 port
Post by: mapar007 on January 28, 2010, 03:05:26 pm
Ignore my post. I simplified xD. It should have been an integer from 1-7 I suppose. (use a mod 6\ inc a; with initial a random)
Title: Re: Hunt z80 port
Post by: Galandros on January 28, 2010, 03:13:16 pm
Code: [Select]
ld b,7
call irandom
inc a
I thought the same thing. And I should be rusted in z80 by now.
mapar why complicate things? :p
Title: Re: Hunt z80 port
Post by: Eeems on January 28, 2010, 03:36:51 pm
thanks for the help!
now to get it working with graphics x.x

what's the easiest way to clear the graphbuffer? (plotsscreen)
Title: Re: Hunt z80 port
Post by: calc84maniac on January 28, 2010, 04:32:43 pm
Code: [Select]
ld hl,plotsscreen ;copy from here
ld (hl),0 ;write first byte
ld de,plotsscreen+1 ;copy to here
ld bc,768-1 ;copy all but the first byte
ldir

Note, LDIR basically does this:
Loads value at (HL) to (DE)
Increases HL and DE
Decreases BC
If BC is not zero, rinse and repeat

Since in this case DE is the address directly in front of HL, the 0 gets copied to all the bytes in the buffer.
Title: Re: Hunt z80 port
Post by: Eeems on January 28, 2010, 04:39:17 pm
well I just found out that b_call _GrBufClr does it as well, which is faster though?
also I've got it working :D now to convert all the menu's to it :P

EDIT: I can't seem to get sprite masking working x.x anybody got a good AND routine?
EDIT2: nvm, got a good spritemask routine to use instead
EDIT3: here is v1.07b :D almost done :D now to add collision support for trees and add in tilemaps of a sort to make a different background every game.
Title: Re: Hunt z80 port
Post by: Builderboy on January 28, 2010, 07:13:16 pm
Yay assembly programing!  Its cool that your getting into this, and neat that you got sprites working so fast O.O Good job!
Title: Re: Hunt z80 port
Post by: calc84maniac on January 28, 2010, 07:39:02 pm
well I just found out that b_call _GrBufClr does it as well, which is faster though?
also I've got it working :D now to convert all the menu's to it :P

EDIT: I can't seem to get sprite masking working x.x anybody got a good AND routine?
EDIT2: nvm, got a good spritemask routine to use instead
EDIT3: here is v1.07b :D almost done :D now to add collision support for trees and add in tilemaps of a sort to make a different background every game.
I think that bcall has pretty much the same code, but you won't really want to have the extra overhead of bcalls when making a game.
Title: Re: Hunt z80 port
Post by: Eeems on January 28, 2010, 08:05:09 pm
Thanks builderboy!
@calc84: ah ok, I'll switch to it then.
Title: Re: Hunt z80 port
Post by: ztrumpet on January 28, 2010, 09:15:10 pm
Sounds great Eeems!  I wish I was at home to try this...
Title: Re: Hunt z80 port
Post by: Eeems on January 28, 2010, 09:43:25 pm
Lol, well I hope you like it!
Title: Re: Hunt z80 port
Post by: ztrumpet on January 28, 2010, 11:20:28 pm
Eeems, this is awesome!!  I love your sprites!  They're awesome.  You're pretty good at Asm. :)
How hard was it to transition to sprites on the graphscreen?
Title: Re: Hunt z80 port
Post by: Eeems on January 28, 2010, 11:39:14 pm
thanks :P I don't actually like them, and I would rather have better ones
lol, just wait until you see my horribly structured/unoptimized code x.x
it was kind of hard to figure out how to get the sprites working, then it was pretty simple, all I had to do was just multiply the location pointer by 8 on each of them, and it worked :)

EDIT: here is a small update
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 29, 2010, 12:15:53 am
I can't get past difficulty mode. It just goes back on Play/build/quit screen x.x
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 12:33:07 am
Sorry x.x forgot a 'ret' just go to the source folder open lib.asm go to the bottom add a tab and then type in 'ret' then run assemble.bat. That should fix it. If it doesn't then I don't know what the problem is x.x
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 29, 2010, 01:04:23 am
I will wait when you release new 8xp build. I am a bit too lazy to compile stuff myself :P
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 02:24:03 am
Lol, ok, that may take a little while though, I'm working on backgrounds. Also, it doesn't take that long to make the edit and compile it  30 seconds tops ;)
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 29, 2010, 02:49:17 am
Listen,

in my view when you provide a software avaliable for download you have to give an easy to launch build. I personally can't be arsed to spend time to setup an asm ide or folder just to build a game. Even if in your case, you provide the entire ASM tools (I haven't checked), the user shouldn't have to spend all this time to compile the thing just to try it.

Oh well, I'm backing out of this topic now. I'll post feedback when final version is done

Stop posting such narrow-minded comments.
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 03:25:36 am
Wait what? I wasn't trying to be narrow minded. You were being humerious when you said your were too lazy to do it yourself, and I was just playing along. I'm sorry if you saw it that way. 
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 29, 2010, 03:46:10 am
well i wasn't that humerious as you said, but oh well. I also dislike when people insist on making us do something even after we said we won't do it.
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 04:27:41 am
Ok, I guess it wasn't.
I wasn't trying to make you do it. I was just pointing out that it would be really simple to do.
Title: Re: Hunt z80 port
Post by: mapar007 on January 29, 2010, 11:06:25 am
(about calc84's post yesterday):
shouldn't that be:
Code: [Select]
ld b,6
call irandom
inc a

(I didn't know irandom could take an upper bound, which explains my 'strange' way of working)
Title: Re: Hunt z80 port
Post by: ztrumpet on January 29, 2010, 11:35:50 am
Lol, ok, that may take a little while though, I'm working on backgrounds. Also, it doesn't take that long to make the edit and compile it  30 seconds tops ;)
It took me 80 seconds from downloading till it assembled. Whom do I sue? ;D <jk>

Eeems, I don't see the update.  What was it?
Here's 1.08b after being Assembled correctly. :)
Title: Re: Hunt z80 port
Post by: calc84maniac on January 29, 2010, 01:27:19 pm
(about calc84's post yesterday):
shouldn't that be:
Code: [Select]
ld b,6
call irandom
inc a

(I didn't know irandom could take an upper bound, which explains my 'strange' way of working)
I'm pretty sure irandom generates a random number from 0 to B-1.
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 02:27:53 pm
It generates a number that is 0=<a<=b, so yeah, what calc said.
Ztrumpet, Thanks! I'll try to get the randomly generated background working today.
Title: Re: Hunt z80 port
Post by: ztrumpet on January 29, 2010, 02:37:39 pm
Great!  I can't wait to see the backgrounds!  Will they be grayscale? ;D  I'm pretty sure you're not there yet, but I am wondering... ;)
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 02:56:28 pm
lol, nope not yet, but that should be easy to do later.
Title: Re: Hunt z80 port
Post by: Builderboy on January 29, 2010, 06:03:10 pm
Its nice to see that this is progressing so fast!  I might want to have another look at assembly at some point :P
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 06:07:17 pm
thanks! well calc84 helped me fix the problem! here is v1.09b!
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 29, 2010, 06:27:37 pm
Nice ^^

Ok suggestion: In the future, I wonder if adding stuff that you must not touch (else game over) and maybe more enemies at once might be cool?
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 07:12:39 pm
hmm, well right now I'm working on animations, but later I might add that although that will be a bit harder to do.
Title: Re: Hunt z80 port
Post by: ztrumpet on January 29, 2010, 10:08:16 pm
Wow, that's nice.  It's really cool how quickly you can code.  I'm also thinking about dabbling more in Asm... :)
Title: Re: Hunt z80 port
Post by: Eeems on January 29, 2010, 10:50:31 pm
lol, thanks, well it's because I've had all day to work on it :P
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 29, 2010, 11:27:16 pm
Wow, that's nice.  It's really cool how quickly you can code.  I'm also thinking about dabbling more in Asm... :)
Finish Elmgon first tho D:
Title: Re: Hunt z80 port
Post by: ztrumpet on January 30, 2010, 11:08:02 am
I'll finish Elmgon first for sure. ;D
Title: Re: Hunt z80 port
Post by: DJ Omnimaga on January 30, 2010, 11:25:34 pm
Phew... thanks :P

But seriously I am looking forward for Elmgon
Title: Re: Hunt z80 port
Post by: ztrumpet on January 30, 2010, 11:27:37 pm
Thanks! ;D  I'm making progress, but the battle engine's progress is slow. :)

And Eeems, I'm looking foreward to Hunt.