Ranking
Hey Guys,
draw_triangle is a really nice thing.

Maybe you could also rework the event triggering and make the behavior of the state variables more consistent.
If you look in DeScript you see that I go through a lot of pain to just find out in what state the game currently is.
I also noticed while playing around that the variables in get_world_state sometimes differ where they should not depending on whether some functions have been called and or in which hook you look at them. (e.g.: it makes a difference if you unfreeze a game by pressing space or call unfreeze)
"Wenn Sensei Tanaka sein Shodushi ist, dann soll er hingehen und uns den Dimak zeigen!"
If you could note some of the inconsistencies I'd be happy to fix them up.

Aka: What is the difference between space and unfreeze in sp, etc
:D
I tested this in 3.91 beta2:

- unfreeze_game does nothing if the game was not frozen with freeze_game

- is_game_frozen normaly returns 0 when called within the exit_freeze hook
- if unfreeze_game was used after the next call of step_game or pressing space, the is_game_frozen function returns 1

This is just an example I observed other oddities in the new_game hooks and leave_game as well.

I attached a event_log script which I created to implement custom events.
You can use it for buggy state testing as well.

It writes log entries of this format:
00021 enter_frame - 	 {{p=0,mf=0,r=0,tto=-1,f=0,np=2,tf=1,gt=0,win=-1},{f=1,tf=0},{f=1}}
00000 	 - match_unfrozen
Where the first number is the number of frame ticks since the last event followed by the hook name.

Then comes a table consisting of 3 tables. The first is the current state, the second is the state change since the last event and the third holds custom state vars which are carried from one state to the other (not of interest until you want to implement custom events yourself).

For the first two tables the vars mean:
p - game paused
mf - match frame, where 0 means 0, 1 means greater 0 and less then indicated by the rules, 2 means equal or bigger then set in the rules
r - replay mode, can be 0, 1 or 2 (for the demo mode)
tto - turn timeout, where 0 means 0, 1 means greater than frame_tick, -1 means less then frame_tick
f - is_game_frozen
np - number of players
tf - turn frame, where 0 means 0, 2 means greater than indicated by the rules, 1 else
gt - game type, 0 for single, 1 for multi
win - winner, where -1 means no winner set, 1 means there is a winner or draw

The second line shows a configured custom event.
Just for completeness:
You can configure the custem events by editing the event_map table within the script file.
You will notice that there the same state table format is used as outputed by the script, so you can use copy and paste to map a custom event to a hook and state. If there a variable is missing it means "don't care about it". You can add a fourth table to the state there, the vars within will become part of the third table in the next event.

If you manage to create a config that triggers all custom 'game_..', 'match_..' and 'replay_..' events at the right time and don't misses one post it.
I never made it because of the oddities.

So happy testing!
Attached Files
event_log.lua (13.1 KB, 5 views)
Last edited by DeFransen; Jan 26, 2011 at 11:38 PM. Reason: Forgot Attachment
"Wenn Sensei Tanaka sein Shodushi ist, dann soll er hingehen und uns den Dimak zeigen!"
Thanks I'll look into it tomorrow
:D
Blam, is it possible to add those features ?

- textures for 3D objects, or at least 2D billboards in the 3D world.
- skybox (image files like those, rendered around the 3D scene)
- some control on blood particles (set_blood_pos, set_blood_age, set_blood_radius ans set_blood_vel...)
Maybe you could add the damage a joint has taken to get_joint_info().
And it would be nice if at least functions like draw_text() were able to do newlines.
Of course I can solve this probmlem myself but it's annoying to write several lines of code instead of "\n".
Signature temporarily out of order.