English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 24 August 2017, 11:23   #1
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Advanced enemy paths and connected sprites on old hardware

TL;DR : How were these things made back then?

Hi! In a game I'm currently making, I made a sea monster with tentacles built up of several sprites. I'm using GameMaker Studio and the available tools to create paths helped a lot.



On old hardware (like the Amiga), this wouldn't be as easy. I have done some research on how these things could have been made, and these are some ideas:
  • Arrays with relative x and y coordinates that directly sets the position of an object, or work as waypoints that the object moves between.
  • Lookup tables or approximation functions for trigonometric functions.

Examples of this are some of the bosses in R-Type, the snakes in First Samurai and the enemy flying patterns in Galaga. The snake in R-Type has a quite advanced moving pattern, flying into and out of holes, so positioning needs to be exact. From the looks of it, it either moves in a straight line or an arc (@ 3:30 in the video):

[ Show youtube player ]

It would be great to hear your thoughts on techniques used to create these things, maybe you even have direct experience and have done something similar on the Amiga!

Examples:
[ Show youtube player ] (@ 2:05 in the video)
[ Show youtube player ] (@ 20:35 in the video)

Last edited by MickGyver; 24 August 2017 at 11:31.
MickGyver is offline  
Old 24 August 2017, 12:23   #2
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
In R-Type I think it is all just lookup tables with the coordinates predefined. Same in Galaga, but with the ability to specify an offset and mirroring etc.

For First Samurai it looks like they use a simple spline algorithm. You can do them pretty efficiently in assembler with integer maths and some lookup tables. An even simpler option is to have every object in the chain move slowly towards a straight line between the base and the anchor, which with movement will create nice curves.
zero is offline  
Old 24 August 2017, 12:29   #3
Old_Bob
BiO-sanitation Battalion
 
Old_Bob's Avatar
 
Join Date: Jun 2017
Location: Scotland
Posts: 151
Quote:
Originally Posted by witchmaster View Post
On old hardware (like the Amiga), this wouldn't be as easy. I have done some research on how these things could have been made, and these are some ideas:
  • Arrays with relative x and y coordinates that directly sets the position of an object, or work as waypoints that the object moves between.
  • Lookup tables or approximation functions for trigonometric functions.
For something like the big snake in R-Type, or the attack patterns in Galaga, I'd think a simple array would be both the easiest to program, and the fastest to execute. You have to blow a bunch of memory, of course, but there's no time consuming calculations to be done and if everything behaves the same way, every time, i'm thinking it would be the best method.

What has puzzled me for a while is stuff like the tentacle type things coming out of the Huge-Brain-With-Eyeball boss at the end of the first level of Salamander that follow you around the screen. Very mysterious. Possibly some of this trigonometry witchcraft, of which you speak?

B

Last edited by Old_Bob; 25 August 2017 at 23:37.
Old_Bob is offline  
Old 24 August 2017, 17:00   #4
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
If you look at Galaga is seems that the enemies are programmed with a simple Logo like language. "Move x+1, y-2, repeat 25 times" kind of thing. That way only the changes in direction need to be stored.

At the time they would likely have been hand coded by the programmers, as I doubt there were any prototyping tools available.
zero is offline  
Old 24 August 2017, 23:30   #5
invent
pixels
 
invent's Avatar
 
Join Date: May 2014
Location: Australia
Age: 52
Posts: 476
Hi Witchmaster, you may be able to use software like this. https://phaser.io/tutorials/coding-tips-008

coders here will be able to say if this tool or others like it are useful. Good thread as it will be one of our issues for next Amiga game.
invent is offline  
Old 25 August 2017, 07:26   #6
MickGyver
Registered User
 
MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 643
Thanks so far @zero, @Old_Bob and @invent, I appreciate the input. I like that simple idea of moving the sprites towards a line between the base and anchor.

About that Salamander boss, yeah, the arms are slowly changing direction towards the player. The video below shows the MSX version and by the looks of it, the parts of the boss are not updated every frame to ease up the work for the processor.
[ Show youtube player ] (@ 5:44 in the video)

@invent, that tools seems useful, I was working all yesterday on something similar for GameMaker. Good tutorial also btw.
MickGyver is offline  
Old 25 August 2017, 15:11   #7
Amiga1992
Registered User
 
Join Date: May 2001
Location: ?
Posts: 19,645
Quote:
Originally Posted by Old_Bob View Post
What has puzzled me for a while is stuff like the tentacle type things coming out of the Huge-Brain-With-Eyeball boss at the end of the first level of Salamander that follow you around the screen. Very mysterious. Possibly some of trigonometry witchcraft, of which you speak?
Wasn't there an Amiga game that did something similar?
I'm thinking of a Turrican boss or something, maybe. But can't quite place it.

Interesting thread all round! Looking forward to learn more.
Amiga1992 is offline  
Old 06 December 2017, 05:51   #8
OmegaMax
Knight Of The Kingdom
 
OmegaMax's Avatar
 
Join Date: Feb 2016
Location: It's a bald world!
Posts: 179
Quote:
Originally Posted by zero View Post
If you look at Galaga is seems that the enemies are programmed with a simple Logo like language. "Move x+1, y-2, repeat 25 times" kind of thing.
This is from Section Z,Capcom nes game.

Code:
;================================================== 
;Data 
;Byte 1 = NmeXVelocity
;Byte 2 = NmeYVelocity
;Byte 3 = NmeMovementPatternTimer
;==================================================
MansaLogicTable: 
 06:871A:FE 02 05            ;Move x-2, y+2, repeat 5 times
 06:871D:FE 02 05            ;Move x-2, y+2, repeat 5 times
 06:8720:FE FE 05            ;Move x-2, y-2, repeat 5 times 
 06:8723:FE FE 85            ;Move x-2, y-2, repeat 5 times ,Reset Marker
;================================================== 
LeagoLogicTable: 
 06:8CE6:FE 00 0A            ;Move x-2, y+0, repeat 10 times
 06:8CE9:FE 03 0A            ;Move x-2, y+3, repeat 10 times
 06:8CEC:FE 05 0A            ;Move x-2, y+5, repeat 10 times
 06:8CEF:FE 09 0A            ;Move x-2, y+9, repeat 10 times 
 06:8CF2:FE 05 0A            ;Move x-2, y+5, repeat 10 times
 06:8CF5:FE 03 0A            ;Move x-2, y+3, repeat 10 times
 06:8CF8:FE 00 0A            ;Move x-2, y+0, repeat 10 times
 06:8CFB:FE FD 0A            ;Move x-2, y-3, repeat 10 times
 06:8CFE:FE FB 0A            ;Move x-2, y-5, repeat 10 times
 06:8D01:FE F7 0A            ;Move x-2, y-9, repeat 10 times
 06:8D04:FE FB 0A            ;Move x-2, y-5, repeat 10 times
 06:8D07:FE FD 8A            ;Move x-2, y-3, repeat 10 times ,Reset Marker

Sorry for replying to an old thread but maybe someone would be interested in this.

Last edited by OmegaMax; 06 December 2017 at 06:22.
OmegaMax is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vbcc multiple include paths krustur Coders. C/C++ 2 20 October 2014 23:46
relative paths do not apply to new files thomas support.WinUAE 1 13 August 2013 19:10
Relative paths (WAS: Has anybody ever gotten Shiftrix to work?) rsn8887 support.WinUAE 9 27 August 2010 06:56
Relative paths Toni Wilen request.UAE Wishlist 0 16 August 2009 16:06
paths OSH support.WinUAE 3 07 January 2009 12:31

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:38.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.27615 seconds with 15 queries