Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - [Coding Competition 2023] Primates by willbritton

Reply to topic

Rate this entry!

1 (Terrible) 0% 0%
2 0% 0%
3 0% 0%
4 0% 0%
5 12% 12%
6 8% 8%
7 29% 29%
8 45% 45%
9 (Excellent) 4% 4%
This poll has expired.
Author Message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
[Coding Competition 2023] Primates by willbritton
Post Posted: Tue Mar 28, 2023 2:56 pm
https://www.smspower.org/Homebrew/Primates-SMS





Quote
Are you smarter than an ape?

Who amongst us can honestly say they’ve never lain awake pondering the answer to this age-old question?

Well now you can find out, as you pit your wits against murderous primates armed with exploding bananas. Use your knowledge of angles and projectile motion (don't forget to allow for wind conditions!) to plant a deadly banana in your opponent's furry face before he does the same to you.

Primates is a game for either 1 or 2 players. In 1 player you play against the CPU who may well be smarter than your average chimp. Play heads up with a buddy, family member, colleague or lover in 2 player mode. Great for parties.

Inspired by the classic 90s BASIC game gorillas.bas [https://en.wikipedia.org/wiki/Gorillas_(video_game)], Primates gives this old format a fresh kick with a rapid fire "Arcade Mode". However for all those nostalgia nerds out there also bundled is a more sedate but no less difficult "Classic Mode" where all apes must politely follow Queensbury Rules and take it in turns to hurl incendiary fruits at each other.

(Note: there are a few known bugs left in the game, and a few omissions that I didn't quite get time to implement in time for the deadline, but hopefully I'll get round to fixing them soon but I hope people have fun with this game!)

Sources: https://github.com/retcon85/sms-primates
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Tue Mar 28, 2023 3:56 pm
Thanks for uploading my game and I hope people enjoy playing it as much as I enjoyed writing it.

Could an admin please update the zip file on the download page with the latest copy from my github releases link? The one I had given before wasn't unzipping properly for people so I replaced it with a better copy. Thanks!
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Tue Mar 28, 2023 4:02 pm
Done!

(That also seems to have fixed the issue I had running in MEKA)
  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2006
  • Posts: 863
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Tue Mar 28, 2023 8:57 pm
Nice conversion of a MS-DOS classic.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 411
Reply with quote
Post Posted: Wed Mar 29, 2023 12:59 am
Ah! Good! Of course what some things need to be fixed. The scores dont are counting the partial results. The sun when had hit for a banana open the mouth. The animation when the gorilla win is missing too. Besides the intro music for classic is my request.
Congratulations!
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Wed Mar 29, 2023 7:16 am
What a demanding patron 😉

segarule wrote
The scores dont are counting the partial results.

What do you mean by this one?

All the other things were already in my snagging list and I may or may not get round to doing them soon as I need at least a short break from Primates right now 😂

(P.S. the original plan in Arcade Mode was that the sun should dispense random powerups when hit, but in Classic Mode just show surprised face as you say.)
  View user's profile Send private message Visit poster's website
  • Joined: 28 Mar 2022
  • Posts: 17
  • Location: UK
Reply with quote
Post Posted: Wed Mar 29, 2023 9:45 am
Well this is glorious. I'm exactly the age for gorillas.bas to be a thing and this is as good a conversion as I can imagine.

Incidentally you don't say if you were able to try it on hardware, it's very happy on my Alex Kidd SMS1.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Wed Mar 29, 2023 10:11 am
Aw, thanks @yesterzine!

I did try it once on my Retcon homebrew project and it worked fine - my partner and I had a blast playing arcade mode together. Although I haven't got round to simulating a Sega Mapper so it only worked while it fit into 48KB of ROM and the splash screen, etc. has pushed it over now.

Awesome to know it works on original hardware, thanks for confirming!
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 411
Reply with quote
Post Posted: Wed Mar 29, 2023 11:28 am
Quote
What a demanding patron

I will dema... suggest more later. Im kidding. The things is very good.


Quote
What do you mean by this one?

See picture attached. I selected a 5 games in Classic mode against CPU (1 player mode).
In case the i was in 4 match. Would for score to be 2 for me and 1 for CPU. You see?
Quote
(P.S. the original plan in Arcade Mode was that the sun should dispense random powerups when hit, but in Classic Mode just show surprised face as you say.)

Ok. I would must have explained that i played the Classic mode more.
Primates-SMS-0.2.png (26.18 KB)
Primates-SMS-0.2.png

  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Wed Mar 29, 2023 11:45 am
Oh right, I see the scores are missing completely from that screenshot, cool will take a look when I can, thanks for raising.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Oct 2015
  • Posts: 183
  • Location: Ireland
Reply with quote
I thought this was Rampage
Post Posted: Wed Mar 29, 2023 6:42 pm
When I first saw this I thought you redid the classic arcade game Rampage - the title screen graphics are cool - funny primate expression :)
NB: the game locked up for me a few times but I think this is the "known" bug?!?
Some future ideas:
- an option / hack to draw graphics immediately i.e. not wait.
- a rapid fire option / powerup if you hold the button down
- if you shoot the enemy first then you win the point i.e. enemy does not get point if bullet kills you a few frames later
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Wed Mar 29, 2023 7:58 pm
Thanks StevePro!

SteveProXNA wrote
When I first saw this I thought you redid the classic arcade game Rampage

Haha, that would be a lot of fun - maybe an idea for next year already 😉

SteveProXNA wrote
NB: the game locked up for me a few times but I think this is the "known" bug?!?

Possibly... I did think I'd fixed one lock up problem right before I submitted it but there could well be more. Thanks for flagging.

SteveProXNA wrote
- an option / hack to draw graphics immediately i.e. not wait.

Do you mean for the next level to be generated? If so, it's not artificially throttled - it really does take quite a long time to generate. I'm sure I could optimise but it would take some blood, sweat and tears to get it close to instant at least the way it's currently written.

SteveProXNA wrote
- a rapid fire option / powerup if you hold the button down

I had originally planned to have both multiple bananas available to both players, as well as a power up system - if you hit the sun it was going to randomly distribute one of three powerups or occasionally a booby prize. I reckon the power up system is pretty feasible but the multiple projectiles per player will currently hit a performance limit as tracking each projectile independently is fairly expensive in terms of CPU cycles. I might try refactoring the projectile code at some point, possibly in assembler to see how much I can squeeze it down to.

SteveProXNA wrote
- if you shoot the enemy first then you win the point i.e. enemy does not get point if bullet kills you a few frames later

I actually designed that in as I thought it felt fairer - if two people (or primates) launch explosive bananas at each other simultaneously then both will get exploded - the first one to hit doesn't somehow make the other banana disappear!
Could definitely make it an option though.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2015
  • Posts: 63
  • Location: Japan
Reply with quote
Post Posted: Wed Mar 29, 2023 11:53 pm
Nice! I have always been a big fan of Gorilla.bas!

The arcade mode is a fun a new idea! I could not stop playing. The CPU opponent is challenging, but not impossible. Perfect!

I wish the initial level drawing could be faster or skippable by pressing a button, but I read that above that it would be difficult. Perhaps the damaged environment could be kept as-is for a few rounds? (with the gorillas simply respawning in different positions over it?)
  View user's profile Send private message Visit poster's website
  • Joined: 19 Aug 2006
  • Posts: 69
  • Location: Brazil
Reply with quote
Post Posted: Thu Mar 30, 2023 12:27 am
Another Gorillas fan here. The Action mode is really cool, a great idea that I don't remember ever seeing in another Gorillas clone. I'm also kinda enamored with the initial level drawing, I think it helps building the suspense.
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Thu Mar 30, 2023 8:07 am
Since a few people have commented on the time taken to generate the scenery, and although I personally agree with mateusbond that it adds some atmosphere, having the option to skip it as if it were a cut-scene would seem to cover both cases.

I just tried turning the display off and using UNSAFE_ copy methods but it didn't make an appreciable difference. I do have to do a fair bit of reading back from VRAM and there's currently no unsafe variant of that in SMSLib, but I can quickly write one to see if it helps; but I suspect I'll need a deeper refactor to make this run noticeably quicker.

For those who are interested, the algorithm is currently as follows:

1. Clear the screen.
2. Generate random x positions for both players, ensuring that player 1 is on the left of the screen and player 2 is on the right.
3. Generate a random building height (between 24 and 88 pixels high), width (between 16 and 32 pixels wide) and colour (there are three building colours).
4. If the player x position overlaps with the current building, justify them so they are not overhanging the edge, and set their y position so that they are on top of the building. There's actually a bug here I haven't figured out yet where sometimes they "float" above the building by 1 pixel.
5. Calculate one row of tiles for the top of the building in RAM. If the building's left edge doesn't start on a multiple of 8 pixels, read the corresponding tile from VRAM which is the right hand tile of the previous building so they can be overlapped. Since buildings can be up to 32 pixels wide, there must be a buffer of 5 tiles in RAM to calculate the row.
6. Once calculated, send those buffered tiles to VRAM. If we are drawing the bottom 3 rows of a building, those tiles get sent to the second half of VRAM as the pixel-perfect banana collision mechanism won't work for these and they are the least likely tiles to be hit by bananas. If it's a new tile, set up the entry in the screen map.
7. Repeat from step 5 for the next row down, until we reach the bottom of the screen.
8. Repeat from step 3 for the next building, until we reach the right hand edge of the screen.

I was originally doing this with 1 pixel high strips, which is a little simpler to code, but takes way longer because of the overhead of sending data to the VDP like that.

An obvious optimisation would be to calculate an entire building and send all those tiles to the VDP in one hit, although I'm not entirely sure how big of a qualitative improvement that would make. It would take some 1,760 bytes of tile buffer in RAM so definitely feasible.

I don't really think calculating the entire screen in RAM is feasible, because it's currently a max of 302 tiles (I would actually like to increase this at some point) and for storing full 32 byte tiles that's more RAM than we have available (without some more in the cartridge!)
  View user's profile Send private message Visit poster's website
  • Joined: 07 Mar 2021
  • Posts: 55
Reply with quote
Post Posted: Thu Mar 30, 2023 12:53 pm
A classic very well worn on Master System! It brings back good memories! :p The arcade mode is very nice addition!
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Fri Mar 31, 2023 10:42 am
Latest bugfix release:

https://github.com/retcon85/sms-primates/releases/tag/0.3

Fixes two issues:

- The missing score on classic mode that segarule raised
- I never intended for the sound effects on collision / celebration to play on arcade mode and I didn't like the way they clash with the music so have made them only play on classic mode. This may possibly resolve the issue with the hanging audio notes on level finish that joe/slogra raised on Discord.

@SteveProXNA I haven't been able to reproduce the "locking up" you mentioned - any more idea whether it happens under certain specific conditions so I can try and track it down?
  View user's profile Send private message Visit poster's website
  • Joined: 25 Jul 2007
  • Posts: 716
  • Location: Melbourne, Australia
Reply with quote
Post Posted: Fri Mar 31, 2023 1:14 pm
This is some nostalgia for me, many hours in the school computer lab spent playing this game.

Physics and destructible buildings are spot on. I don't recall if the original had this issue but it's a pita having to remember and re-enter the angle and power again instead of remembering the last value.
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Fri Mar 31, 2023 1:53 pm
Thanks @thatawesomeguy!

thatawesomeguy wrote
I don't recall if the original had this issue but it's a pita having to remember and re-enter the angle and power again instead of remembering the last value.


Well yes you did have to remember the angle and power, but you also had a keyboard to enter them with so it was a bit less of a pain.

Here's the video I used to remind myself when I was coding this:

I debated whether or not to be completely true to the original or, like Arcade mode, to help the player by cueing up the previous values. In the end I decided that I wanted Classic mode to work as close to the original as possible, and I think it helps make Arcade mode feel like a totally different game by comparison.
That said, I think this could lend itself easily to a user option if and when I release a major version 2.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 411
Reply with quote
Post Posted: Fri Mar 31, 2023 5:57 pm
Sometimes the game is freezing in new version.
  View user's profile Send private message
  • Joined: 12 Oct 2015
  • Posts: 183
  • Location: Ireland
Reply with quote
Post Posted: Fri Mar 31, 2023 7:23 pm
willbritton wrote
Since a few people have commented on the time taken to generate the scenery, and although I personally agree with mateusbond that it adds some atmosphere, having the option to skip it as if it were a cut-scene would seem to cover both cases.

Another option could be to have a bunch or pre-canned sceneries and randomly choose one - esp.for those who don't mind a bit of repetition but are just super keen to get into the game play - just a thought,,,
  View user's profile Send private message Visit poster's website
  • Joined: 12 Oct 2015
  • Posts: 183
  • Location: Ireland
Reply with quote
Post Posted: Fri Mar 31, 2023 7:28 pm
willbritton wrote
Latest bugfix release:
https://github.com/retcon85/sms-primates/releases/tag/0.3
@SteveProXNA I haven't been able to reproduce the "locking up" you mentioned - any more idea whether it happens under certain specific conditions so I can try and track it down?

segarule wrote
Sometimes the game is freezing in new version.

Got the latest 0.3 build and sometimes when i fire a banana and the enemy fires one back at the same time and the 2x bananas collide - sometimes they "cancel" each other out and the game continues but other times the 2x become 1x banana that just spins "forever" without moving anymore - hence I thought the game was locking up - I'm not sure if this is the same experience for @segarule
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Fri Mar 31, 2023 8:42 pm
SteveProXNA wrote
Got the latest 0.3 build and sometimes when i fire a banana and the enemy fires one back at the same time and the 2x bananas collide - sometimes they "cancel" each other out and the game continues but other times the 2x become 1x banana that just spins "forever" without moving anymore - hence I thought the game was locking up - I'm not sure if this is the same experience for @segarule

That's really helpful, thanks.

I didn't change anything between 0.2 and 0.3 that would affect this, so it must have already been present. I definitely saw and thought I'd fixed a problem with banana collision before (my partner calls it the "duelling bananas bug") but I guess it seems like something remains.

@segarule would be great to know if you're freezing problem is also related to banana-on-banana action.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Fri Mar 31, 2023 9:14 pm
Speculative fix for duelling bananas bug:

https://github.com/retcon85/sms-primates/releases/tag/0.4

Finding it tough to reproduce myself, but think I see the opportunity for it to occur, so hope the above helps.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Oct 2015
  • Posts: 183
  • Location: Ireland
Reply with quote
Post Posted: Fri Mar 31, 2023 11:00 pm
willbritton wrote
Speculative fix for duelling bananas bug:
https://github.com/retcon85/sms-primates/releases/tag/0.4
Finding it tough to reproduce myself, but think I see the opportunity for it to occur, so hope the above helps.

Nice - FWIW the Command design pattern can be a life saver for hard-to-repo bugs like this but is something you usually want to implement from the outset - Lil Evel Knievel uses the Command pattern extensively and was very helpful for crazy edge case bugs during development - plus you can use it for showcasing a demo of your game!
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 411
Reply with quote
Post Posted: Sat Apr 01, 2023 12:31 am
Last edited by segarule on Sat Apr 01, 2023 11:18 am; edited 1 time in total
Seems that "freeze" in arcade was fixed. But i found other bug that will go attached.
I would like ask you something. Considering that Classic mode is base in turn rounds, you can give a option for 2 players + 1 controller (p1)? This would be cool for who have only 1 gamepad.
EDIT: Tested now with Emulicious and the problem is very very minimized and i can play it normally.
gorillas.mp4 (490.83 KB)


  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Sat Apr 01, 2023 11:15 am
SteveProXNA wrote
FWIW the Command design pattern can be a life saver for hard-to-repo bugs like this but is something you usually want to implement from the outset - Lil Evel Knievel uses the Command pattern extensively and was very helpful for crazy edge case bugs during development - plus you can use it for showcasing a demo of your game!

Very interesting - I've used the command pattern a great deal professionally at the system / application level but since I'm rather new to game development just hadn't considered it but yes I can see how that might apply here - I'll have a play. Thanks!
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Sat Apr 01, 2023 11:19 am
segarule wrote
Seems that "freeze" in arcade was fixed. But i found other bug that will go attached.

Without looking at it a bit more closely, the problem you posted in your video may be a known one - scenery collision is kind of "best efforts" at the moment based on a couple of different factors. Essentially there are some set of random building configurations that don't work as well as others. I'd like to improve it at some point. That said, this may be an entirely new bug so will investigate when I get the chance. Thanks for posting the video, very helpful.

segarule wrote
Considering that Classic mode is base in turn rounds, you can give a option for 2 players + 1 controller (p1)? This would be cool for who have only 1 gamepad.

That's a fantastic idea, I will build that into the next release.
  View user's profile Send private message Visit poster's website
  • Joined: 19 Aug 2006
  • Posts: 69
  • Location: Brazil
Reply with quote
Post Posted: Fri Apr 07, 2023 2:32 pm
The enemy hit me after I had hit him on the same round of the action game and we both scored a point - it drove me nuts. While I think it's fair, I also think it'd be cool to have an option to disable this and let the one who hits first win the round.
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Fri Apr 07, 2023 3:13 pm
Noted! When I get some time to sit down on this again I'll build an options menu in.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Mon Apr 10, 2023 11:05 pm
Version 0.5 now uploaded to homebrew page and github.

Changes:

- Fixed cram dots on intro screen fade in/out (NTSC mode only)
- Added two options to arcade mode: allowing both players to score points at the same time (defaults to true), and allowing a dying player to launch a last-minute banana (defaults to true).
- Added two options to classic mode: remember the previous throw parameters (defaults to true) and share controller 1 when playing a two player game (defaults to true).

Note that the option defaults in arcade mode maintain the same behaviour as in previous versions. The classic mode defaults give different behaviour from previous versions.

Thanks to everyone for the feedback!
  View user's profile Send private message Visit poster's website
  • Joined: 23 Jan 2010
  • Posts: 411
Reply with quote
Post Posted: Tue Apr 11, 2023 8:47 am
Nice update! Tested. Waiting animations and intro musics.
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Tue Apr 11, 2023 9:14 am
Thanks boss!
  View user's profile Send private message Visit poster's website
  • Joined: 12 Aug 2021
  • Posts: 73
Reply with quote
Post Posted: Wed Apr 19, 2023 9:34 am
I do like playing a Worms-like game, although I never played the version this is based on, so I can't vouch for authenticity!

The explosion in arcade mode is so overly animated and over the top, I love it! I also really liked seeing the generation of the terrain in real time :)

All around, this is fun, I did not expect this sort of game to be possible on SMS, this is really cool!
  View user's profile Send private message
  • Joined: 15 Jan 2018
  • Posts: 70
  • Location: Tokyo
Reply with quote
Post Posted: Mon Apr 24, 2023 6:18 am
Why is this so fun?!

It's so simple and yet it works so well.
I guess this somehow taps into the same primal instincts that Worms does, lol.

I see this is a port of Qbasic Gorillas. The SMS adaptation is just great.
I love the options, and most of all the 2 player mode with one controller.
You bet there will be some of us that will carry around our Game Gear or Pocket and challenge friends from time to time.

You get top marks from me. Thank you for creating this.
  View user's profile Send private message
  • Joined: 14 Apr 2013
  • Posts: 623
Reply with quote
Post Posted: Wed Apr 26, 2023 8:03 am
I just killed the enemy and it still threw a banana that hit me and scored him a point. Not fair! :D
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Wed Apr 26, 2023 8:16 am
Hehe. All is fair in bananas and war.

But actually in the latest version there is an option that controls whether throwing bananas during explosion is allowed, so you can turn it off although it defaults to on.
  View user's profile Send private message Visit poster's website
  • Joined: 14 Apr 2013
  • Posts: 623
Reply with quote
Post Posted: Wed Apr 26, 2023 8:24 am
willbritton wrote
Hehe. All is fair in bananas and war.

But actually in the latest version there is an option that controls whether throwing bananas during explosion is allowed, so you can turn it off although it defaults to on.

Ahh, that's called something like "death throw"? I remember seeing that option.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Wed Apr 26, 2023 8:41 am
Calindro wrote
willbritton wrote
Hehe. All is fair in bananas and war.

But actually in the latest version there is an option that controls whether throwing bananas during explosion is allowed, so you can turn it off although it defaults to on.

Ahh, that's called something like "death throw"? I remember seeing that option.

Yes that's it!

The other option controls whether or not both players can die on the same screen, e.g. if one player gets hit while the second player's banana is already in flight.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!