Jump to content

How would you approach this? (PHP PBP Engine Advice)


Recommended Posts

I am trying to figure out how to run a play-by-play simulation(simulator) for a wrestling game(think WWE/F).
Wrestler1 and Wrestler2 have 100% health to start and each move from the move database does x amount of damage and deducts y amount of energy. If the move is hit it subtracts from health and energy and outputs 1 of 3 random text strings describing the move sequence. If the move is missed it does nothing to health or energy and outputs 1 of 3 random string describing the move "failure" sequence.
Each move will be assigned a move_id, move_name, move_damage, move_energy, move_type, move_section, is_pin, cause_blood in the moves table in the database. 
move_id = autoincrement
move_name = move name
move_damage = how much damage the move does if successful
move_energy = how much energy the move takes away if successful
move_type = Aerial, Impact, Behind, Submission, Strike
move_section = which sections can this move be performed in? Entrance, Opening, Early, Middle, Late, Finish, Post(can have more than 1 section per move to add more variety to sections)
is_pin = does this move go in to a pin count?
cause_blood = does this move cause the opponent to bleed?
Match Sections
  • Each section will have a three scenarios picked randomly to allow freshness and unpredictability.

  • Each section will randomly select moves from the wrestlers table for moves which will be defined in the database as numbers and then called upon moves.php to associate numbers with moves.

  • Each move has 3 success and 3 failure play-by-play text entries.

  • If the user is determined to be successful, it will select randomly a PBP text to generate from the 3. (Same for failure)

  • It will generate the play-by-play text and display it on screen, then move on to the next move.

  • Each section, except Entrance and Post, will generate 10 moves by random depending upon which move_section in the database the are allowed to be executed in.

  • Match cannot end until Finish. Trying to figure out how to incorporate a random pinning text allowing only 1 and 2 counts from Early to Late and 3 count(end) for Finish.



Display by random 1 of 5 different entrance text scenarios.
Generate 10 moves based on the Opening move_section.
Generate 10 moves based on the Early move_section.
Generate 10 moves based on the Middle move_section.
Generate 10 moves based on the Late move_section.
Generate 10 moves based on the Finish move_section.
Display by random 1 of 10 different post-match text scenarios.
Match Summary
$matchwinner defeated $matchloser by $matchfinish(pinfall,submission,etc) at $matchtimelength
$matchrating (* out of 5 stars)(based on algorithm of both wrestlers talent, experience, popularity, modifiers, and boosts)(higher match rating = more skill and experience gains)
$wrestler1 gained $x points in popularity
$wrestler2 lost $y points in popularity
Other Notes
Match PBP will not show sections. It will be the entrance, grouping of 50 moves, post-match, and then followed by the summary. 
Files will be match.php, moves.php, match_entrance.php, and match_post.php. (maybe I am structuring this wrong?)
This is not a generic attack, defend, kill type of RPG/game
I'm just looking for advice. I don't need people to write out this engine because how will I learn? I'm trying gather the approaches some of you more seasoned developers would take in this scenario and in the most effective way possible. Thanks in advance and anything helps!
Link to comment
Share on other sites

Generally speaking this is what object oriented programming excels at. The objects in your game simulation should correlate to the objects you describe, and the attributes of a wrestler will be nicely encapsulated inside a wrestler object. There are design patterns that are widely accepted and used in object oriented programming. Invest some time studying those, and attempt to apply the patterns wherever you see them.


I also would suggest you utilize dependency injection, as you will have a variety of objects that do specific things.


I feel like I'm repeating myself today, but -- why don't you just cut to the chase and start with MVC for your main structure. It really does take care of the primary scaffolding. There are plenty of good frameworks out there -- find one that uses components and utilized composer.


If you have specific questions, feel free to ask.

Link to comment
Share on other sites

That's fine. I'll ask my questions elsewhere without snotty responses.

Yes, heaven forbid you get professional advice for the cost of merely adhering to the Terms of Service agreement you consented to when you first signed up. We'll all miss you terribly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.