Bogdanovist's Recent Forum Activity

  • Say you have three objects in a layout. Lets say one is a (slowly moving) bullet type object headed towards a target object. A third object is invulnerable to the 'bullet' and wants get between the bullet and the target to intercept, or block, the bullet and protect the target. How could one achieve this in C2?

    So far I am using the custom movement behaviour for the 'blocker' object for other purposes, so a solution using that would be best.

    Here is my pseudo code solution, but I don't know how to do this in C2?

    * Find the bullet nearest to the target (in case there are more than one)

    * Find the point of intersection between the line between target and bullet and the shortest line between the blocker and this line ( I hope that makes sense)

    * Set angle of motion of blocker to that point

    * Set the speed of the blocker to as fast as possible (limited by an instance variable of the blocker)

    Note that this doesn't anticipate the bullet's motion, so isn't the most optimal solution for the blocker to save the target, but it would be a start.

    I can't find the required information in order to construct a (complex!) expression that could be used to set the blockers angle of motion. How do I determine the location of the closest bullet? The location of the target I can do.

    I know C2 is supposed to be 'programming free' but is it possible to in expressions to create temporary variables in some way? I need to set the blockers angle of motion, but first I need to work out the point to set the motion towards, then do some trig to get the angle. This would be a mighty ugly site as a single expression, even if I could find the required raw numbers to put it together. If I could insert a small 'script' in place of the expression that would be clearest.

    Any ideas?

  • Thanks all. I agree with everything that's been said. It's a shame C2 can't be persuaded to handle the server side of things as the behaviours and events framework has everything I need for implementing the battle side of the game.

    My one last point in desperation is whether there is any browser out there that could be persuaded to launch displaylessly on the server, open the address of the C2 'game' in order to trigger the battle using C2, saving the results each tick for players to later view? The server 'game' would be a different thing to the player game in order for the required battle(s) to be resolved simply by navigating to the page (i.e. the server 'game' would talk to the database which would tell it how to setup the pieces etc given what the players have uploaded).

    I know this is would be a very odd workflow and maybe there is a Java (or something else) toolkit out there that would give me equivalent functionality to the C2 behaviours and events for constructing the server side of the game, I just haven't seen anything that works so nicely as C2 does for doing this kind of stuff.

  • Thanks for that. The only thing that bothers me with that approach is ensuring everyone has exactly the same reality. These battle sequences will be complex and contain randomness in some of the events. I can ensure seeds are consistent (if C2 can do that? I assume so??) to make sure the dice roll the same for everyone, but I'm not sure whether I'd trust every browsers and device to detect every collision at exactly the same tick, ensuring all subsequent actions are completely consistent etc etc. It feels safer to crank the handle in a server process, save the outcome and have everyone look at that, rather than everyone crank their own handles with the same initial conditions hoping that the result will be identical.

    Am I explaining this clearly enough? I could make it so that whichever player first logs in to view the results the details gets saved then everyone else would just be viewing a replay (although the experience is the same and the players are none the wiser) but this falls down as soon as two player log in at the same time, which would happen at some point.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This is not so much a 'how do I?' question as a 'is it possible'? I have had an idea for a game kicking around for a while and started work on a version of it in Java a couple of years ago before shelving it when life got in the way. I've been looking to start work on it again and was considering moving to HTML5/Java script in order to be able to run on smartphones and tablets as well as in browsers. Then I came across construct 2 and I've been able to make a lot of progress in a few days.

    However, there is a major issue that I'm not sure Construct 2 can handle. The game is intended to be a tactical simulation/manager game where the player sets up tactics, upgrades units etc between battles then hits 'GO' and then watches the battle unfold. The player should also be able to analyse replays of battles carefully (fast forward, rewind, pause, step forward etc). For a 1 player game against AI I can see how this could be done in C2. The battle is controlled using sprites with different behaviours and events, but every tick the positions and states of every sprite could be saved to a web storage DB (or whatever type of storage C2 provides that would be appropriate), allowing replays of the exact same events.

    For multiplayer though, battles would take place at regular time intervals (i.e. once a day at 3UT say). In my original Java version, this would have worked fine as you could simply run the battle from a scheduled task on the server using the submitted info of the players, save the results and then players would all be viewing the same replay in their browsers when they log on. From what I have read so far in tutorials and the manual I can't see how C2 could be used to do something like this. Please let me know if this is possible somehow. I just need keywords of any features to look into further, not a full explanation of the whole procedure. I just want to know if C2 is the right tool for this task.

    I really hope this is possible as for the battles themselves C2 provides the perfect range of behaviours and events to be able to implement what I want. I'd love to be able to spend 100% of my time on the game design and content rather than 90% of my time debugging crappy event detection code...

Bogdanovist's avatar

Bogdanovist

Member since 11 Mar, 2013

None one is following Bogdanovist yet!

Trophy Case

  • 11-Year Club

Progress

11/44
How to earn trophies