Videopac / Odyssey2 forum

Programming the Videopac / Odyssey2 => Homebrews => Topic started by: Chris! on August 07, 2015, 01:50:19 PM



Title: Nice Ice 2
Post by: Chris! on August 07, 2015, 01:50:19 PM
Eli the Elf just won't leave Santa alone! It's December 23, and this time Eli has held Santa captive in the workshop. The workshop is a huge labyrinth, and it's up to Blitzen to free Santa from Eli's clutches. Hopefully once you free Santa, he has enough time to deliver his packages to the good little girls and boys!

This game actually has animation in it! I've got most of the engine done. I spent all night working on this. Let me know what you think. You can't really go anywhere yet, it's just one screen so far.


Title: Re: Nice Ice 2
Post by: Chris! on August 08, 2015, 03:01:19 AM
I worked a little on the room changing part of the code. There are only three rooms so far, though: One down and one across of the starting room. If you go beyond these, you may get trapped or disoriented. I don't know how many rooms to put in. I was thinking it to be like level 3 of my Jack and the Beanstalk game for the Atari 2600 where you're in a castle with a whole bunch of different rooms and the goal is to get (in the game) the harp and the goose that lays the golden eggs before you can exit. Those items are in a random place every time. I'll probably redesign the rooms so there's always a certain place to put the items to get (one of which would be Santa in this game.) I hope to have at least 25 different rooms, which I have programmed it for. And if I add more, the total number of rooms would have to be divisible by 5 (i.e. 30, 35...) the way I programmed it. Or I could change the code.


Title: Re: Nice Ice 2
Post by: Chris! on August 09, 2015, 11:08:07 AM
So I discovered that the maze can only have 23 rooms. It could probably have more, but I don't know of a way to make it bigger, with the code I've made for it, it seems like adding and subtracting to the room number and then show the grid for it. And even that way took me hours and a few attempts to get right. Which makes me wonder how big Mage is. What I have planned is this (to differ itself from that game): Put three items in the maze at random locations every time. The player then searches for the items and then once he has all them, goes to the exit (the same place you started). I want there to be a clock running, which would be the score (the lower the clock number, the better the score is). So that should be enough variety in game play to make the game interesting. This version has a 23-room maze. Let me know your thoughts on it. (Too big? Too small?) I also made a nifty title screen.


Title: Re: Nice Ice 2
Post by: Rene_G7400 on August 09, 2015, 03:52:21 PM
Which makes me wonder how big Mage is.

Mage 3 has 64 rooms, Tutankham has 100 rooms.


Title: Re: Nice Ice 2
Post by: daddy_scott on August 09, 2015, 03:54:15 PM
Love Tutankham!!  Wish I could find a copy.   :-\


Title: Re: Nice Ice 2
Post by: TomBeck on August 09, 2015, 05:57:38 PM
Both games are masterpieces. Tutankham from the eighties and the Mage series from the present. Martijn make a fantastic job. And Dieters Tutankham is wonderful. Too bad, that it is sold out. Maybe he make new ones when he go into retirement.  :D



Title: Re: Nice Ice 2
Post by: ScottyDont00 on August 10, 2015, 12:36:22 AM
Both games are masterpieces. Tutankham from the eighties and the Mage series from the present. Martijn make a fantastic job. And Dieters Tutankham is wonderful. Too bad, that it is sold out. Maybe he make new ones when he go into retirement.  :D



I vote for a second run of Tutankam!


Title: Re: Nice Ice 2
Post by: Chris! on August 10, 2015, 01:24:55 PM
I hid Santa's Magic Bag in the game. It's one of three items to get in order to exit the workshop. You can't grab it yet, though. But it's hidden in a different random location every time. Let me know if it doesn't show up.


Title: Re: Nice Ice 2
Post by: daddy_scott on August 10, 2015, 08:47:51 PM
Both games are masterpieces. Tutankham from the eighties and the Mage series from the present. Martijn make a fantastic job. And Dieters Tutankham is wonderful. Too bad, that it is sold out. Maybe he make new ones when he go into retirement.  :D



I vote for a second run of Tutankam!


I second that.  Motion carries.   :P


Title: Re: Nice Ice 2
Post by: Chris! on August 11, 2015, 02:09:30 AM
I need help with random numbers. They're not random enough. Each room has a number. At the beginning of the game, one item is in a random place, but the other item is in the room right next to it. Is there a way to make the numbers more random? I attached my code.


Title: Re: Nice Ice 2
Post by: ScottyDont00 on August 11, 2015, 07:01:52 PM
I need help with random numbers. They're not random enough. Each room has a number. At the beginning of the game, one item is in a random place, but the other item is in the room right next to it. Is there a way to make the numbers more random? I attached my code.

Can't offer help but I did watch the video and looks good!


Title: Re: Nice Ice 2
Post by: ScottyDont00 on August 11, 2015, 07:02:48 PM
Both games are masterpieces. Tutankham from the eighties and the Mage series from the present. Martijn make a fantastic job. And Dieters Tutankham is wonderful. Too bad, that it is sold out. Maybe he make new ones when he go into retirement.  :D



I vote for a second run of Tutankam!


I second that.  Motion carries.   :P

If motion carries whos starting the pre-order list??   ??? ;:) ;)


Title: Re: Nice Ice 2
Post by: ccc--- on August 11, 2015, 09:48:16 PM
I hear you guys  ;)


Title: Re: Nice Ice 2
Post by: TomBeck on August 11, 2015, 11:14:30 PM
You have many fans Dieter.

They only want to have the best from you... your games.  :D

So much things you want to do, but not much time.  ;:)


Title: Re: Nice Ice 2
Post by: Rene_G7400 on August 12, 2015, 09:42:55 AM
I need help with random numbers. They're not random enough. Each room has a number. At the beginning of the game, one item is in a random place, but the other item is in the room right next to it. Is there a way to make the numbers more random? I attached my code.

In the "titlescreenloop" you could start your own counter (increment a certain register), then when the player presses the action button the value of the counter will depend on the time that the player has waited. This value could be used as a second random value. (Or add it to the timer value first before using it.)

In your random function it would be better to replace "anl a,#016h" by "anl a,#01fh", otherwise you'll lose at lot of different values. After it you'll probably need to check if the value that you got is not too high.


Title: Re: Nice Ice 2
Post by: Chris! on August 12, 2015, 08:36:16 PM
Now no items will display. The relevant code (the code that gets the random number for the bag) begins at line 936. Why can't I get anything to show up? I don't care about the cane now. I just want the bag to show up first.


Title: Re: Nice Ice 2
Post by: Rene_G7400 on August 13, 2015, 09:40:51 AM
I think I see two problems:
- you've used MOVX a,@R0, but you should have used MOV (without X) (several times)
- after adding #0e8h, you need to use JC instead of JNC


Title: Re: Nice Ice 2
Post by: Chris! on August 13, 2015, 12:23:10 PM
I got it working, except for the Voice broke, so I took it out (so much for having little extra things.)
But now I can't test it on real hardware since my C7050 broke (see other topic in Hardware forum.)


Title: Re: Nice Ice 2
Post by: Chris! on August 13, 2015, 12:50:29 PM
My C7050 cart began working again. I tested it and it works OK on real hardware. Too bad I had to get rid of the Voice stuff, though.


Title: Re: Nice Ice 2
Post by: Chris! on August 13, 2015, 02:20:45 PM
I have one more item I want to randomly place in the game: Santa Claus. I was going to use two sprites for him (sprites 0 and 3) to make him multi-colored. Since I've used two different ways to randomly place things, I was wondering if there was a third way? How would I choose a room number for Santa?


Title: Re: Nice Ice 2
Post by: Rene_G7400 on August 13, 2015, 02:27:43 PM
You could try to use the value of register A5 of the VDC. You first need to enable this option with the following code at the start of your game:
(VDC access should be enabled)

mov r0,#0a0h
movx a,@r0
orl a,#002h
movx @r0,a


Title: Re: Nice Ice 2
Post by: Chris! on August 13, 2015, 03:29:55 PM
Then how would I make sure it stays between 1-23? Wouldn't the value be the same as the cane, since I'm constantly adding one to it and having it loop back to 1 if it gets over 23? Or would it be a different value?


Title: Re: Nice Ice 2
Post by: Chris! on August 13, 2015, 03:34:06 PM
Also, I'm using similar code already to allow the grid to be squares:
Code:
mov r0,#0a0h
movx a,@r0
orl a,#080h
movx @r0,a


Title: Re: Nice Ice 2
Post by: Rene_G7400 on August 13, 2015, 05:43:01 PM
You can combine the code by using:
orl a,#082h
between the movx instructions at the start of your game.

To read A5, just use:
mov r0,#0a5h
movx a,@r0
anl a,#01fh

Save the result in some register, and use ADD and JC to further limit the value, just as you have done with the timer value.


Title: Re: Nice Ice 2
Post by: Chris! on August 13, 2015, 06:24:31 PM
Why won't Santa display on the first screen?


Title: Re: Nice Ice 2
Post by: Chris! on August 15, 2015, 06:49:41 PM
OK, I massively rewrote the code so it works again. I made it so Santa appears when his room is set to one, but not when it's set to a5. So there must be something wrong with my Santa-s room getting code. It's at the very end and goes like this:
Code:
get_santa_room


mov r0,#0a5h
movx a,@r0
anl a,#01fh


mov a,@r0 ; get blue car speed
mov r7,a ; store in R6

mov r0,#santaroom
mov a,@r0
mov a,r7 ; adjust x pos
mov @r0,a


mov r0,#santaroom
mov a,@r0
add a,#0e8h
jc get_santa_random_2

mov r1,#santaroom
mov a,@r1 ; get blue car speed
mov r6,a ; store in R6




mov r1,#santaroom
mov a,@r1 ; get blue car speed
mov r6,a ; store in R6

mov r0,#bagroom
mov a,@r0
xrl a,r6 ; adjust x pos
jz get_santa_random_2


mov r1,#santaroom
mov a,@r1 ; get blue car speed
mov r6,a ; store in R6

mov r0,#caneroom
mov a,@r0
xrl a,r6 ; adjust x pos
jz get_santa_random_2




ret

get_santa_random_2
mov r0,#santaroom
mov a,@r0
mov a,#001h
mov @r0,a

ret
Yes, I remembered to make the orl thing 082h. What am I doing wrong here? I've also posted the full code if it helps.


Title: Re: Nice Ice 2
Post by: Rene_G7400 on August 15, 2015, 10:38:00 PM
In line 4 (mov a,@r0) you overwrite the value that you got from A5.

It looks like you need to remove line 4, 5, 7 and 8 (twice mov a,@r0 and mov r7,a).


Title: Re: Nice Ice 2
Post by: Chris! on August 15, 2015, 11:35:20 PM
That doesn't seem to help at all. I have noticed something odd, though. If I force the santa room value to be 2, it doesn't show up, but if I force it to be 1, it does. Something must be screwing up something here.


Title: Re: Nice Ice 2
Post by: Chris! on August 16, 2015, 05:50:24 PM
I knew it. Something is odd. I still don't know what, and I am able to get Santa into the game, but only as a character. It won't even allow me to put a beard on him. So I guess this will have to do. Up next is collision detection on the characters. I am hesitant to begin work on it, though, since putting Santa in the game didn't go as well as I had hoped.


Title: Re: Nice Ice 2
Post by: Chris! on August 17, 2015, 03:42:20 AM
Collision detection added. It only took a day. Problem: Sometimes one of the three objects don't show up. I have not gotten this bug on real hardware, so perhaps it is an O2EM thing? I don't know.


Title: Re: Nice Ice 2
Post by: Chris! on August 17, 2015, 06:25:39 PM
I played this for a good 30 minutes. 15 on O2EM and 15 on real hardware. Every time, the three objects showed up. I thought on real hardware it didn't once, but I guess I missed a room somehow because I eventually found the missing bag. So when you get a chance, play this and see if all three objects show up for you.


Title: Re: Nice Ice 2
Post by: Chris! on August 17, 2015, 11:48:48 PM
Turns out I didn't fix it after all. Can someone look at my code and tell me what I'm doing wrong? The part I'm having trouble with is the bag and Santa random room getting numbers, which is lines 735-870 in my code. I cleaned up the code erasing multiple blank spaces so it's easier to read. The cane random room getting number is just fine, it's just the bag and Santa numbers I'm having trouble with. Valid room number values are between 1-23 only.


Title: Re: Nice Ice 2
Post by: Rafael on August 17, 2015, 11:58:50 PM
I tried it. But for some reason in soem random point the game returns to open screen ???


Title: Re: Nice Ice 2
Post by: Chris! on August 18, 2015, 12:25:38 AM
I've never had that happen to me. I wonder if it's a Videopac thing or if I just haven't experienced it yet. It would be kind of odd that I haven't if it does that.


Title: Re: Nice Ice 2
Post by: Chris! on August 19, 2015, 09:48:34 PM
It only took two tries to add in a timer, but dozens to make it work right. The timer will stop at ten minutes. Because that's a time limit. I had to move some boundaries around on the screen in order for everything to work correctly. I'm still having a problem with the random functions for the bag and Santa. If you want to help, they're at lines 745-880 in this new, improved code. I figure a redesign of the maze is in order once I get the random function fixed. It's too easy to go from room to room. I need dead ends and stuff. Anyway, here's the code and the latest binary file.


Title: Re: Nice Ice 2
Post by: Chris! on August 20, 2015, 05:14:10 AM
OK, so here is another attempt to fix the bag and Santa not showing up. This involves a new value called "addition" which serves its purpose since I cut the random number getting from 31 down to 15. The addition number is added to the bag and Santa's value (which is now anywhere between 1-15), so since 15+7=22, it fits perfectly in my game, since it has 23 rooms. Here is the code I used:
Code:

mov r1,#addition ; new value to add to the room numbers since they
; only go from 1-15.
mov a,t
anl a,#007h  ; you will only get values from 00 to 07
mov @r1,a


mov r1,#bagroom
mov a,t
anl a,#00fh  ; you will only get values from 00 to 0f
add a,#001h ; add 1 in case it's 0
mov @r1,a

mov r0,#bagroom
mov a,@r0
add a,#007h
mov @r0,a



get_random_places_1
mov r1,#addition
mov a,@r1
mov r6,a

mov r0,#bagroom
movx a,@r0
add a,r6 ; add addition to bag room
movx @r0,a


mov r1,#bagroom
mov a,@r1 ; put bagroom in
mov r6,a ; store in R6

mov r0,#caneroom
mov a,@r0
xrl a,r6 ; compare two digits
jz get_random_places_3

jmp get_random_places_2

get_random_places_3
mov r0,#bagroom
mov a,@r0
add a,#0ffh
mov @r0,a

jmp get_random_places_2


get_random_places_2
mov r0,#0a5h
movx a,@r0
anl a,#00fh ; get santa's value between 1-15
add a,#001h ; add 1 in case it's 0


mov r0,#santaroom
mov @r0,a



mov r1,#addition
mov a,@r1
mov r6,a ; store addition in R6

mov r0,#santaroom
movx a,@r0
add a,r6 ; add the addition
movx @r0,a

get_place_s_0
mov r1,#santaroom
mov a,@r1
mov r6,a ; store in R6

mov r0,#bagroom
mov a,@r0
xrl a,r6 ; if santa and bag room are the same, go to get_place_s_1
jz get_santa_random_2

get_place_s_1
mov r1,#santaroom
mov a,@r1
mov r6,a ; store santa's room info in R6

mov r0,#caneroom
mov a,@r0
xrl a,r6 ; compare santa's room value with cane room's value
jz get_santa_random_22

get_place_s_2
ret

get_santa_random_2
mov r0,#santaroom
mov a,@r0
add a,#0ffh
mov @r0,a ; if santa's room and bag room are the same, subtract 1 from santa's room

mov r0,#santaroom
mov a,@r0
xrl a,#000h
jz santa_random_4 ; if santa's room was subtracted 1 from,
; make sure santa's room number isn't 0.

jmp get_place_s_1

get_santa_random_22
mov r0,#santaroom
mov a,@r0
add a,#0ffh
mov @r0,a

mov r0,#santaroom
mov a,@r0
xrl a,#000h
jz santa_random_4 ; if santa's room was subtracted 1 from,
; make sure santa's room number isn't 0.

jmp get_place_s_2



santa_random_4
mov r0,#santaroom
mov @r0,#23 ; put santa's room as 23 as a last resort.

jmp get_place_s_2
I took out the old comments and put in new ones. Looking at this code, I noticed an error that I just now fixed. On the second to last line I put 023h. That is 35. So I fixed it by omitting the h. (h = hexadecimal. b = binary. nothing = decimal.
So let me know if I did anything wrong.


Title: Re: Nice Ice 2
Post by: Chris! on August 20, 2015, 05:41:03 AM
Forgot to check if bag's room value is 0. If it is, the game will put it in room 22. If Santa's room value is 0, it will put it in 23. Both Santa and the bag's room value cannot be the same value of 22 since if it was, the game would put santa's room value as 21. Or am I wrong somehow? My brain hurts.


Title: Re: Nice Ice 2
Post by: Chris! on August 20, 2015, 06:26:21 PM
I was pretty tired when I posted that code last night. Looking at it with fresh eyes, I saw two things:
#1 - On one occasion, I put "santaroom" instead of "bagroom," that has been fixed.
#2 - I didn't take into account that I had added 1 to the 0-15, so instead of it being from 0-15, it would then be 1-16, not 1-15. Well, thankfully my game has 23 rooms, but I had to look and see if anything was affected by that oversight. It doesn't look like it, as the room being 23 for multiple room values would be checked by the program. So here is the latest ROM. Working on this reminds me that it's like a dreaded math class, with story problem or logic puzzle logic. Again, if you spot anything wrong between lines 746-887 of my code (or if you want to be really adventurous and check the whole thing), let me know.


Title: Re: Nice Ice 2
Post by: Chris! on August 21, 2015, 03:14:23 AM
Using the code from version 13b, I made a new version 14. In this one, there is a finish. Once you get three items, you must go back to the first screen and use the exit to your left. Then your final time will be displayed. You can press ACTION to start a new game.


Title: Re: Nice Ice 2
Post by: Rafael on August 21, 2015, 04:13:38 AM
Silly question: Why the game is called Ice NIce 2 and its screen is predominantly hot? Perhaps it would be better to use icy colors and mirror various pines across the screen to make the game more joyful.
Not so silly question: who will be the game's enemies?


Title: Re: Nice Ice 2
Post by: Chris! on August 21, 2015, 12:37:20 PM
The game's colors are red and green - for Christmas. But I will change them. Hadn't thought of putting enemies in.How would that work?


Title: Re: Nice Ice 2
Post by: Rafael on August 22, 2015, 12:13:11 AM
The game's colors are red and green - for Christmas. But I will change them. Hadn't thought of putting enemies in.How would that work?

There´s a X-mas Jim Carrey´s movie with ghosts. If I´m not wrong there was 3 ghosts. maybe you can use ghosts with 3 diferent colors to represent they.
Some sugestions: Maybe you can put 3 diferent houses somewhere in the maze, so instead to get  all itens and return to start point the player should take each present a different house.
Maybe he could only carry this one at a time?
Maybe if a ghost caught him he would steal the gift and put elsewhere in the maze?
Perhaps, instead of using a timer could start the game on December 1 (DEC 01) and the deadline for delivering the gift would be until the 25th?
Perhaps the day could be divided into day and night (I think this is easy to do)
Well, just some possibilties...


Title: Re: Nice Ice 2
Post by: Chris! on September 16, 2015, 11:02:21 AM
I'm trying to make the maze bigger but I can't. The grid ends up being scrambled and I can't tell what's wrong:
Code:
get_a_room_4

mov r0,#room_number
mov @r0,#001h

mov r0,#room_number ; only R0 and R1 can be used as pointers to intram
mov a,@r0




add a,#get_2room_2 & 0ffh - 1
movp a, @a ;get byte
mov r1, a

mov r0,#0e0h
mov r7, #9

get_a_room_5
mov a,r1
movp a,@a ; get byte
movx @r0,a
inc r0
inc r1
djnz r7,get_a_room_5


jmp loop

room23: db 010h,01Eh,002h,01Eh,070h,040h,07Eh,00Bh,008h
room24: db 004h,004h,07Eh,040h,05Ch,054h,074h,004h,004h
room25: db 004h,004h,07Eh,040h,05Ch,054h,074h,004h,004h

get_2room_2:
db  room23 & 0ffh
db  room24 & 0ffh
db  room25 & 0ffh


Title: Re: Nice Ice 2
Post by: Rene_G7400 on September 17, 2015, 09:41:50 AM
You've used too many ROM pages, your game is now larger than 2k.


Title: Re: Nice Ice 2
Post by: Chris! on September 17, 2015, 11:33:13 PM
But it says I only used 1,700 or so bytes.


Title: Re: Nice Ice 2
Post by: Rafael on September 18, 2015, 01:19:19 AM
But it says I only used 1,700 or so bytes.

Try to compile it as 3k rom, maybe the values will change. Maybe you have some pages with free space ???


Title: Re: Nice Ice 2
Post by: Rene_G7400 on September 18, 2015, 09:23:25 AM
But it says I only used 1,700 or so bytes.

That's because it doesn't count the empty bytes at the end of a page before the align instruction.