English Amiga Board


Go Back   English Amiga Board > Other Projects > project.Amiga Game Factory

 
 
Thread Tools
Old 23 November 2022, 11:35   #2621
earok
Registered User

 
Join Date: Dec 2013
Location: Auckland
Posts: 3,178
Back home from holiday and found a serious bug that I think nobody reported in the past couple of weeks heh (maybe they did, there's piles and piles of chat I haven't been able to read through).

Saving/Loading caused crashes, at least in some circumstances. It shouldn't do that anymore.

I was going to put on a feature freeze to get the release done, but reviewing the code after a complete break from it has highlighted some deficiencies I can maybe work on.

---

@skyzoo72 as flibble said, there's a "foreach" function under conditional that you can use to run code against every actor of a type. The simplest use of it is stuff like smart bombs that clear the screen of enemies ("foreach enemy of type myenemy do destroy_actor"), but with a little elbow grease you should be able to make it work out if there's another actor standing in the way of the current actor (though there's potentially lots of complications, you need to make sure you're not comparing one actor with it's own position for example)

An alternative that may or may not be a pain is using a kind of invisible block as a marker. That's kind of how the top down "CPU patrol" and "CPU pursuit" types avoid getting too stuck together. Basically you'd do something like:

- If an actor wants to move to the tile to the left of where it is now, check if there's any blocks of type "cpu blocker" (basically just an invisible block with no collision)
- If there isn't, place a "cpu blocker" block there, and move in that direction
- If there is, remove the block. Repeat the process from the start, but check for the right direction instead.

It's not completely foolproof but it should at least give the appearance that there's some intelligence to the AI.
earok is offline  
Old 23 November 2022, 14:33   #2622
flibble42
Registered User
flibble42's Avatar
 
Join Date: Apr 2006
Location: UK
Age: 49
Posts: 265
Maybe you could set a flag in the VARS to say which ACTOR is currently doing the comparing so it can be ignored, and then reset it after. Maybe

Create a codeblock eg Monster01

Set ACTOR type to run it every frame

Codeblock Monster01
------------------------

Set Actor_VAR1=1

Do For each LOGIC

Set Actor VAR1=0


Codeblock LOGIC
-------------------
IF ACTOR_VAR1=0 Then

*Monster logic here*

End If


Hope that makes sense.

Bob

Last edited by flibble42; 23 November 2022 at 14:59.
flibble42 is offline  
Old 23 November 2022, 16:54   #2623
Lemming880
Registered User

 
Join Date: Nov 2014
Location: Netherlands
Posts: 227
Quote:
Originally Posted by flibble42 View Post
I did try Tiled and it animated really nicely. As soon as i compiled the Map in Scorpion no animation, I can't remember the reason, so i went with blocks.
I've tested it and it works. Did you save the change to tileset.tsx after making the animation?


@acidbottle: You're welcome. I found out by chance. After trying out the backbone import function and loading the levels in Tiled I saw that one of the tiles had a film strip on it.

Last edited by Lemming880; 24 November 2022 at 18:57.
Lemming880 is offline  
Old 23 November 2022, 17:53   #2624
Lemming880
Registered User

 
Join Date: Nov 2014
Location: Netherlands
Posts: 227
Welcome back Earok. I'll add another question to your pile. Is it possible to have cpu_pursuit with line of sight? So as soon as there's a solid tile in between the player and enemy, the enemy will stop pursuit and go back to normal patrol.
Lemming880 is offline  
Old 23 November 2022, 19:13   #2625
flibble42
Registered User
flibble42's Avatar
 
Join Date: Apr 2006
Location: UK
Age: 49
Posts: 265
Quote:
Originally Posted by Lemming880 View Post
I've tested it and it works. Did you save the change to tileset.tsx after making the animation?


@acidbottle: You're welcome. I found out by accident. After trying out the backbone import function and loading the levels in Tiled I saw one of the tiles had a film strip on it.



Errm, Probably not.. I shall give it a go cheers.
flibble42 is offline  
Old 24 November 2022, 01:21   #2626
earok
Registered User

 
Join Date: Dec 2013
Location: Auckland
Posts: 3,178
Latest check in solves a minor issue that propped up investigating issues discussed by Mixel and Flibble.

The "load level" codeblock had a default behaviour where it would try and set the camera position to the player's center position. But if there wasn't a player, this could potentially put the camera out of bounds (and thus mess up expressions using camera_x).


---

I probably should have an official demo with animated tiles, I only have an unofficial one (the Zelda one in the unofficial repo has animated grass).

@Lemming880 Hmm, line of sight is maybe doable using a raycast algorithm (see: https://lodev.org/cgtutor/raycasting.html ). You'd do a raycast from the enemy tile to the player tile, using block_get on each tile to see if it's solid or not (it simply returns false if there's no solid tile and no block, you may need special handling for things like coins).

You could then change the actor type to a pursuit if it can see, or a non pursuit if it can't.

That sounds like another fun thing to try and make a demo of.
earok is offline  
Old 24 November 2022, 18:56   #2627
Lemming880
Registered User

 
Join Date: Nov 2014
Location: Netherlands
Posts: 227
Sounds tricky. I'm asking because backbone has a build in option to set an actor to 'Chasing Enemy' in combination with 'Limited Sight'. So I'm hoping for a build in solution for Scorpion too. Like a CPU_Pursuit_LOS or something. But if it can be done with codeblocks I'd be happy too.
Lemming880 is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
2D Platformer Engine carrion Coders. Blitz Basic 27 06 June 2019 15:35
New Chaos Engine!! arpz Retrogaming General Discussion 75 31 August 2013 23:20
F/S Warp engine 32 mb tabuhuso MarketPlace 0 24 February 2012 16:13
PC Engine CD TodaysForgotten Retrogaming General Discussion 47 14 May 2009 00:57
Scorpion (100% working) andreas request.Old Rare Games 13 01 August 2003 09:48

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


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