• entries
    437
  • comments
    1000
  • views
    335623

I hate these titles

Sign in to follow this  
evolutional

70 views

Here's the current details of the GMSX_API:-


GMGX API
--------

Game Library
------------

gm_request_quit( )
returns [null]

gm_register_state_name( [string: a_name], [int: a_id] );
returns [null]

gm_resolve_state( [string: a_name] )
returns [int]

gm_resolve_state( [int: a_id] )
returns [string]

gm_set_state( [int: a_game_state_id] )
gm_set_state( [string: a_game_state] )
returns [null]

gm_get_state( )
returns [int]


Graphics Library
----------------

gfx_set_display_mode( [int: width], [int: height], [int: depth], [int: fullscreen] )
returns [0=fail; 1=Ok]

gfx_get_display_mode( )
returns [table: width, height, depth, fullscreen]



Texture Library
---------------

tex_load_texture( [string: filename] )
tex_load_texture( [string: filename], [int: ignore_mask] ) // Don't create a collision mask
returns [int: texture_id, 0=fail]

tex_release_texture( [int: texture_id] )
returns [null]


Sprite Library
--------------

sprite [type]
{
.id [int] [read]
.width [int] [read]
.height [int] [read]
.scale_width [int] [read]
.scale_height [int] [read]
.texture_id [int] [read]
}

spr_create( [int: texture_id] )
spr_create( [int: texture_id], [int: width], [int: height] ) // Scaled sprite
returns [sprite: sprite created]

spr_scale( [sprite: a_sprite], [int: x], [int: y] )
spr_scale( [sprite: a_sprite], [int: factor] )
returns [null]

spr_set_texture( [sprite: a_sprite], [int: texture_id] )
returns [null]

spr_release( [sprite: a_sprite] )



Entity Library
--------------

entity [type]
{
.id [int] [read]
.position [vector] [read]
.sprite [sprite] [read / write]
.state_id [int] [read / write]
.props [table] [read / write values]
.events [table] [read / write values]
.set_pos [function ([vector] a_pos)] // Absolute pos
.move_pos [function ([vector] a_pos)] // Relative pos
.set_event [funtion ([entity: a_entity], [string: event_name], [function: a_event_handler] )]
.is_onscreen [function ([int] onscreen)]
}

ent_create( [int: entity_type_id] )
ent_create( [int: entity_type_id], [sprite: a_sprite] )
ent_create( [int: entity_type_id], [sprite: a_sprite], [vector: position] )
returns [entity]

ent_destroy( [entity: a_entity] )

ent_enable_offscreen_collisions( [int: 0=disable, 1=enable] )
returns [null]

ent_set_collision_mode( [int: entity_1_type], [int: entity_2_type], [int: mode] )
returns [int: old mode]



Event Library
-------------

event [type]
{
.id [int] [read]
.name [string] [read]
.target [entity] [read]
.props [table] [read / write values]
}

evt_create( [string: event name] )
returns [event]

evt_fire( [entity: target] )
evt_fire( [table: target_list] ) // fires event to all ents in table
returns [int: 0=fail, 1=ok]


Trigger Library
---------------

trigger [type]
{
.id [int] [read]
.test [function] [read]
.action [function] [read]
.props [table] [read / write values]
.active [int] [read]
.enable [function ([int] 0=disable, 1=enable)] [read]
}

trg_create( [function: a_test_function], [function: a_action_function] )
returns [trigger]

trg_remove( [trigger: a_trigger] )
trg_remove( [int: a_trigger_id] )
return [int: 0=fail, 1=ok]

trg_enable( [trigger: a_trigger] )
trg_enable( [int: a_trigger_id] )
return [int: 0=fail, 1=ok]

trg_disable( [trigger: a_trigger] )
trg_disable( [int: a_trigger_id] )
return [int: 0=fail, 1=ok]







I still have a lot to do, such as allowing global *_get_X functions to retreive items by ID. There's still the graphics stuff to do, such as setting the backgrounds, setting up and switching off parallax scrolling and all that sorts of stuff.

I'm contemplating abstracting the game state into its own object which has its own properties and 'main'. Right now, the concept of a gamestate is a simple numeric id (which can be assigned to a string) - it makes sense to allow states to maintain their own state data.


To respond to Jack's previous question about collisions; I think you're right. It raises an interesting dilemma and I suppose we'll have to see how performance pans out before we need to start getting too overcomplicated with the on/off status of different types. So to start with I'll test for all collisions on all entities, using various methods to optimise and weed out non-colisions as early as possible.

Here's the different tests I'll be running:
- 'point circle'; tests a single vector within the radius of a circle
- 'circle cirle'; tests for two overlapping circle radii
- 'point bounds'; tests a single vector within the bounding box of an entity
- 'point pixel'; tests whether a single vector collides with a pixel within the entity's current texture
- 'box bounds'; tests a box overlapping with another bounding box (used for simple ent/ent collisions)
- 'box bounds pixel'; tests a simple box colliding with the pixels of an entity's texture
- 'pixel pixel'; the 'true' collision test for sprites, tests for pixel collisions between two sprites

Obviously the more hardcore tests first run through the quickest tests to stop pixel tests being done unless needed.

That's all for today...

Any questions/comments/suggestions?
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now