Scripts / Let's play 'challenge the guru'. I'm probably going to regret this!

Author
Message
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jan 2018 16:57
Start by working out (paper & pencil!) what 'states' you need then work out what the 'events' are that cause a change in state. Finally for each state change work out what 'action' should be triggered by the state change.

So one 'state' might be 'throwing dice' the next may be 'move to new square', the 'event' that causes the transition from 'throwing dice' to 'move to new square' is 'dice throw complete'. The 'action' triggered by this change may consist of a PlayAnimation call in addition to a call to move the character to the new square.

Once you have mapped out all the legal state transitions and worked out what needs to happen on each one then you can isolate the small snippets of code for each action in isolation and, more importantly, test each piece in isolation.

For each state transition the code is simply:

if in state A and event 1 occurs then change state to state B and carry out action X


Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 5th Jan 2018 17:04
Ok I will try harder thank you Amenmoses

if anyone would like the Elves I have posted them in my free models thread, please note they are not for commercial use I created them to learn LUA and for a Game Board I have made, they are not the best models only 8k and 102x1024 textures the animations are not very good but they will follow way points

the board is slippy btw LOL



Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jan 2018 17:17
Making the character 'walk' from the current square to the new square will require something a little fancier than that!

To begin with I'd leave the animation out of the equation and simply move straight there. When you have the main game logic sorted then you can work out the finer points.

Btw, just 'square = square + 4' will work fine to start with.

Animation whilst moving is very tricky to get looking good, you need to work out how far you are going to move and how 'far' each animation sequence works for then either repeat the animation sequence enough times to cover the distance or maybe even change the animation speed of the sequence to fit the distance. In simple straight line cases you should be able to work this out up front and just do a simple move each frame to suit. IF done right the animation should 'end' just as the character arrives at the destination.

Been there, done that, got all the T-Shirts!
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 5th Jan 2018 17:34
she walks better than any gg girls so far that i have seen. , and her moves , can get her also a job as a dancer in a nice club. lol
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 4GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Jan 2018 16:35 Edited at: 6th Jan 2018 16:53


Looks good but suffers from the thing people have been complaining about for ages, i.e. the AI just stalls for no apparent reason!

I think if you ask the AI to move to a position that is less than a certain distance away it does nothing.
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 6th Jan 2018 17:05
brilliant lol I'm still on my pencil and paper version. I think my animations are at fault here not GG
It's exactly how I envisioned it awesome work Amenmoses
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Jan 2018 18:07
I've increased the board size (Scale 200) and now she moves around without stalling. I also have her following ladders and snakes.

Next I'll get her playing nice with her friends, I'll get them to simply take turns moving until one 'winner' emerges.

Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Jan 2018 19:29


I've left some debug 'Prompt' commands to show the state engine working, a bit rough and ready but does the job.

Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 6th Jan 2018 20:20
Man you put me to shame LOL well done this is fantastic thank you so much I will play with the scripts
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD

Login to post a reply

Server time is: 2024-12-23 00:39:55
Your offset time is: 2024-12-23 00:39:55