First the easy question to answer:
Quote from: jamesreg on Wed 06/02/2019 17:04:11
(can ags gradually reduce/increase transparency or should I look into the tween mod for this?
Yes and yes. AGS can do it, and you should probably use the tween mod to make it as easy as possible.
As the lack of responses perhaps indicates, the rest is potentially not an easy task, depending on exactly what you expect.
I take it what you're trying to achieve is some kind of space combat sim, sort of like
Wing Commander, only from the viewpoint of the gunport of a "stationary" ship (so that you can't actually fly around dogfighting)?
The approach you've chosen has a few limitations:
- "Have some intelligent movement going on" â€" What do you mean by this? What sort of movement and behavior do you want from them?
- As you've currently coded it, they fly in a straight line from Point A to Point B, then immediately "bounce" and head in some other straight line to Point C. Is that the sort of movement you want, or do you want to try to get something that seems more physically realistic?
- You don't have any notion of "distance" to the ships, they're all moving along a flat invisible surface in space (or, I guess technically around the surface of an invisible sphere with you in the center, assuming that's what the wraparound effect is mean to simulate). Is that OK, or do you want ships to come closer and move further away from you?
And another observation that raises further questions: Since your visible screen is only a small part of the whole room, ships will often be outside of the visible region. Should they still behave the same way when out of view? Should they be able to attack even when you can't see them, for example? Should new ships only spawn in the visible part of the room, or anywhere? Do you need some kind of indicator letting you know where they are?
The conventional way building something like this would probably be to do it in 3D, which would allow for fully "realistic" movement in space. But if you're not too comfortable with coding or with the trigonometry it takes to do the 3D calculations, you'll have to see how well you can fake it in 2D. You have some decisions to make:
Decision 1: Use Walk or move the ships around yourselfWalk is easier (you already have it), but very limited: the ships are only going to move at a fixed speed in a fixed line from Point A to Point B, and you won't be able to get them to wrap around in any reasonable way. (If you've done the wraparound the way I told you to, they'll also suddenly disappear or appear as your scrolling wraps around the edge.)
The other approach is to move them by changing their X and Y coordinates yourself. This gives you complete freedom to create curved paths and varying speeds, and you can implement the correct wraparound behavior relatively simply. But like I said, more complicated overall. To get somewhat realistic ship movement, you could store a movement and acceleration vector (which is simply a pair of X and Y values) for each ship, and each game loop you would:
1. Adjust the acceleration vector according to some rules (representing what the ship currently "wants to do")
2. Change the movement vector by the acceleration vector
3. Change the position by the movement vector
4. Wrap around
Decision 2: Implement any kind of "AI"Enemy intelligence in games is usually pretty simple. The most common way is to give each enemy a few different "states" to switch between. In each state they follow some particular simple rule of what to do, and then they switch to another state when some condition is fulfilled. For example, ships could have states like "circling", "dodging", "distracting", "attacking" and "fleeing". Here, "circling" would be some variation of the "random movement" you already have implemented. "Dodging" would tell it to change direction more often, maybe speed up. "Distracting" would head towards the region of your viewport, close to but not directly under the targeting aim. "Attacking" would carry out an attack (if you have several, just pick one at random), and "Fleeing" would, well, flee (maybe engaging cloaking if available).
Then you have a rule that says, for example: If you're in the "circling" state and the player shoots somewhere closer than 10 pixels from you, switch to the "dodging" state. And another rule that says: If you've been in the circling state for more than 40 seconds, switch to the "attack" state. And another that says: If the player attacks another ship and its health/shield level is less than 33%, and you're less than 300 pixels away, go to the "distract" state. And so on. You add rules for transitioning from each state to each of the other states that make sense. (Usually you have at least a transition back to the "default" state, "circling", from every other state.)
The collection of states and rules for transitioning between them is called a state machine, and is very common for this kind of task. You can achieve surprisingly complex, "intelligent" behaviors with just a few states, some very basic behaviors in each state, and smart rules for transitioning between them.
QuoteI take it what you're trying to achieve is some kind of space combat sim, sort of like Wing Commander, only from the viewpoint of the gunport of a "stationary" ship (so that you can't actually fly around dogfighting)?
Yes Pretty much like Wing Commander and very much like Star Trek 25th Anniversary and Judgment rites set up where you see stuff though the view screen. you never see your ship just the enemy ships in the screen.
Quote"Have some intelligent movement going on" â€" What do you mean by this? What sort of movement and behavior do you want from them?
As you've currently coded it, they fly in a straight line from Point A to Point B, then immediately "bounce" and head in some other straight line to Point C. Is that the sort of movement you want, or do you want to try to get something that seems more physically realistic?
You don't have any notion of "distance" to the ships, they're all moving along a flat invisible surface in space (or, I guess technically around the surface of an invisible sphere with you in the center, assuming that's what the wraparound effect is mean to simulate). Is that OK, or do you want ships to come closer and move further away from you?
1) More Physical Realistic
2) A distance system where they will appear closer and further away at times.
3) The wrap around was meant to keep you from hitting the edges and stopping. But I do not like how the characters disapear when you are close to one. id like for them to be able to wrap to or confine them far enough away from the borders you never notice anything odd with them appearing disappearing strangely.
QuoteAnd another observation that raises further questions: Since your visible screen is only a small part of the whole room, ships will often be outside of the visible region. Should they still behave the same way when out of view? Should they be able to attack even when you can't see them, for example? Should new ships only spawn in the visible part of the room, or anywhere? Do you need some kind of indicator letting you know where they are?
Yes I am working right now on a radar system that will show My location and enemy ships locations as a little dot on a grid. I used hot spots to separate areas of the background off then move the dot to the location on the radar grid if they were in that hot spot area. However I thought I could do the same thing with my location using if mouse is over hot spot beings my mouse is always center screen figured it would work but it does not for some reason.
As far as rather they can attact or react if still in my viewport but off the part thats out of the viewscreen in the middle that is fine as your know you close to them because of radar and its not an issue.
QuoteNo nowhere near comfortable enough coding it that way or good enough at math to do it that way. Besides faking it out even though less perfect will go with the retro look of the rest of the game like other games from that era did.
QuoteDecision 2: Implement any kind of "AI"
Enemy intelligence in games is usually pretty simple. The most common way is to give each enemy a few different "states" to switch between. In each state they follow some particular simple rule of what to do, and then they switch to another state when some condition is fulfilled. For example, ships could have states like "circling", "dodging", "distracting", "attacking" and "fleeing". Here, "circling" would be some variation of the "random movement" you already have implemented. "Dodging" would tell it to change direction more often, maybe speed up. "Distracting" would head towards the region of your viewport, close to but not directly under the targeting aim. "Attacking" would carry out an attack (if you have several, just pick one at random), and "Fleeing" would, well, flee (maybe engaging cloaking if available).
Then you have a rule that says, for example: If you're in the "circling" state and the player shoots somewhere closer than 10 pixels from you, switch to the "dodging" state. And another rule that says: If you've been in the circling state for more than 40 seconds, switch to the "attack" state. And another that says: If the player attacks another ship and its health/shield level is less than 33%, and you're less than 300 pixels away, go to the "distract" state. And so on. You add rules for transitioning from each state to each of the other states that make sense. (Usually you have at least a transition back to the "default" state, "circling", from every other state.)
The collection of states and rules for transitioning between them is called a state machine, and is very common for this kind of task. You can achieve surprisingly complex, "intelligent" behaviors with just a few states, some very basic behaviors in each state, and smart rules for transitioning between them.
This sounds more like or exactly like the things I wanted it to be able to do. I wanted an AI thing like that and then the ability to script or call up certain things on command if I wanted to as well.
My hopes it to use that one battle room we created earlier this week and use it for multiple battles and script it to know which battle im in and which ships etc to put there and what their moves are and such.
I'll let you review my answers and then you can advice further on what I need to do or be looking into to achieve this stuff.