English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 30 December 2021, 23:30   #1
sovenyimre
Registered User
 
sovenyimre's Avatar
 
Join Date: Jul 2020
Location: Hungary
Posts: 94
Smooth 8 way scroll (Project Horizon Engine part)

-------------------------------------------------
Project Horizon - simple 8 way Scroll Engine part
Created by
Electric Black Sheep
Soveny Laszlo, Soveny Imre
(2021.12.30.)
-------------------------------------------------

Simple, fast, adjustable TOME.Map Viewer.
I think it is a good base for any game.
AMOS PRO 2.0 Extensions: TOME, AMCAF, TURBO PLUS 2.15

How it works:
Any screen and tile size and scroll speed can be used.
The rest of the parameters are calculated automatically, so no further calculation is required.
The size of screen is as big as the visible scren and the size of a tile (ex: 320 * 256-> 352 * 288) Within this area, the camera follow.
The essence of the scroll is that the player moves inside a predefined area of the screen (middle).
If it moves or stays inside the middle frame, the visible area is centered (with speed 1). ...I know it is not simpler but nicer than a simle scroll stop.
If you exit the middle frame by moving, the coordinate system will follow.
I use screen offset command so it is 32x32 hw scroll. (or 16x16 if the tile size is 16x16)
If we reach the edge of the 32x32 scroll area when moving, then the following things happen:
1. turn off the bobs
2. copy the visible screen in the opposite side direction to the direction of movement
3. replace the missing tile parts (stripes)in the direction ahead of us.
4. check movement and I start again if necessary until double buffer is identical.
This is necessary because if I exit the field at a corner point, an error may occur and the two buffers may be different at the end.
So all of this is done at least twice because displaying flicker-free bobs requires a double buffered screen with the same content
and turning off the bobs is necessary because if I dont, bob will (blink) appear in bad position after screen copy and the previous image is being restored bellow th bob when it moves (causing visual errors).
On the one hand, to be fast and on the other hand more handy (not to cause any trouble), so I turned off a couple of automated systems.
Screen copy is slow but almost invisible at 25 FPS and there is enough CPU time left for other things (the background processes of a game), You just
only have to insert in the correct place (like Gosub DUMMY).
Could run faster than 25 fps but in that case because of the speed difference, Screen copy is visible.
For faster results, I used Turbo Plus Icons instead of AMOS icons and Turbo Plus Scene command instead TOME.(TOME editor can be used, the program will convert the map to scene format)
I'm not a professional programmer. I just had an idea of ??how such a system could work and I share the above because I haven’t found fast/working solution I can use.
If anyone has an idea of ??what could be improved or simplified, I look forward to your comments.
Attached Files
File Type: zip PH-ScrollEngine.zip (28.1 KB, 117 views)

Last edited by sovenyimre; 31 December 2021 at 14:28.
sovenyimre is offline  
Old 31 December 2021, 02:48   #2
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
Could you explain a bit about how it works?
idrougge is offline  
Old 31 December 2021, 14:27   #3
sovenyimre
Registered User
 
sovenyimre's Avatar
 
Join Date: Jul 2020
Location: Hungary
Posts: 94
Quote:
Originally Posted by idrougge View Post
Could you explain a bit about how it works?

For explanation, I edited the description.
sovenyimre is offline  
Old 31 December 2021, 17:13   #4
Predseda
Puttymoon inhabitant
 
Predseda's Avatar
 
Join Date: Mar 2007
Location: Tromaville
Age: 46
Posts: 7,538
Send a message via ICQ to Predseda
Sovenybros rock!
Predseda is offline  
Old 01 January 2022, 16:38   #5
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
Quote:
Originally Posted by sovenyimre View Post
For explanation, I edited the description.
Thanks!
idrougge is offline  
Old 29 January 2022, 21:48   #6
sovenyimre
Registered User
 
sovenyimre's Avatar
 
Join Date: Jul 2020
Location: Hungary
Posts: 94
Light and Magic :)

-------------------------------------------------
Project Horizon - simple 8 way Scroll Engine part (+Light/Shadow)
Created by
Electric Black Sheep
Soveny Laszlo, Soveny Imre
(2022.02.05.)
-------------------------------------------------

Light+Shadow:

How it works:
It is not raycast! Imagine a circle divided into predefined angles.
The program checks each tile in a predefined spiral path (from inside->out) to see if its value is below a certain value (I use 0...161 values for Walls),
if so, it calculates its angle and distance from the flame.
If the angle of a tile not already "in shadow", it means that its distance is less than the smallest distance stored for the angle, I update one belonging data to the angle.
The result is a "distorted circle"?!
like this toy: https://www.google.com/search?q=Grap...+Puzzle+Boards
The drawing is quite simple.
Palette use 16 normal color and 16 half tone color.
I use blitter lines on the last bitplane to draw the circle and fill it.
So watever is under this area.... it will be darker.

The demo:
- arrow keys to move the flame
- +/- keys to adjust shadow resolution

Anyone who is curious can see how a game looks like if we use this.
https://electricblacksheep.itch.io/p...ready-to-play-

I wanted to share it because I want to use it in my game.
The drawing is fast but the calculation itself is pretty slow.
The program must check 80 tiles, generating 3 points inside to fill gaps in angles, so that the result does not look like a hedgehog.
Since I am not a professional or a mathematician this came to my mind as the best solution but I am sure there is a better one as well.
If anyone has a suggestion, please comment.

(2022.02.20)
Also extended with a program to convert maps from Tome to Tiled (.MAP to .TMX), and Tiled maps back to Tome (.TMX to .MAP).
I used a "simple approach" and Since it is also the first time I used Tiled , I dont know that it will work in every case.
Attached Thumbnails
Click image for larger version

Name:	gum.jpeg
Views:	91
Size:	20.8 KB
ID:	74562   Click image for larger version

Name:	598.png
Views:	115
Size:	85.5 KB
ID:	74564   Click image for larger version

Name:	Screenshot.jpg
Views:	74
Size:	325.3 KB
ID:	74750  
Attached Files
File Type: zip PH-ShadowEngine+.zip (267.8 KB, 66 views)

Last edited by sovenyimre; 20 February 2022 at 00:50.
sovenyimre 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
Smooth Scroll and Sprite Channel 7 Shatterhand Coders. Blitz Basic 5 22 December 2023 23:40
Project Horizon gyagyagyerek project.Amiga Game Factory 140 04 June 2022 21:37
Smooth Scroll Text KS1.3 Octopus66 support.WinUAE 2 01 July 2017 23:54
help me smooth scroll rusty71 support.WinUAE 7 21 November 2011 15:36
Scroll not totally smooth with sound on of FullScreen: known problem? Gaula92 support.WinUAE 21 08 May 2009 16:15

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 11:05.

Top

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