Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Slydog

Was your solution as easy as this?:

1. Calculate the player's movement vector (x and y change for this frame).
2. Calculate each enemy's movement vector (independent of the player).
3. Update each enemy's position (relative to the player's fixed (0,0) position) by adding the vector difference of the enemy movement vector and the player's current movement vector.
4. Adjust all positions so that (0,0) is the center of the screen. (or just always use the actual center pixel location in the above calculations)
Announcements / Re: V8 beta
I haven't tried it myself.
But, could it be specifically only when you use CALLBACK functions?

The error states:
Code (glbasic) Select
C:\DOCUME~1\GregBUG\IMPOST~1\Temp\glbasic\gpc_tempg.cpp: In member function `DGInt __GLBASIC__::geTimer::LogicUpdater(DGNat)':

And your function definition for LogicUpdater is:
Code (glbasic) Select
CALLBACK FUNCTION LogicUpdater: GamePhase%

Can you even have CALLBACK functions nested in a TYPE?

Quote from: gregbug on 2010-Jun-30
nobody has the same problem with the IDE? (compile error with function folding?)
Announcements / Re: V8 beta
Or, how about adding a general code folding directive, like Visual Studio:

Code (glbasic) Select

#region Region Title
... code ...

This would be handy for organizing larger projects / files by grouping common routines as one region.
Ha, but then what about nested regions?!
Are you planning on creating a 2D top-down game, or a 3D game.
Either would work.

If 3D, then the camera would just follow the player, and the world would scroll automatically.
It would look nicer with 3D models and be easier (or not!) with model animation.
You wouldn't need physics if you kept it simple enough, just basic colliders.
You could either create your world map in a 3D modeling package,
or use a text file like a tile map and dynamically create your world 3D model.
I've done it the tile map way, its not as bad as it sounds, just create basic functions like Mesh_AddQuad() etc.
Then if you want to add a 'wall' tile, it would just be 5 quads at that x/z co-ordinate. (4 walls and a top)

2D may be much simpler in other ways.
But you have to handle the scrolling yourself.
If you had a 2nd map of all your entities rounded to nearest 'tile_size', then you can simply draw only entities within a screen width/height around your player like:
Code (glbasic) Select

FOR x = player.mappos.x - (tiles_wide / 2) TO player.mappos.x + (tiles_wide /2)
  FOR y = player.mappos.y - (tiles_tall / 2) TO player.mappos.y + (tiles_tall /2)
    IF entity_map[y][x] > 0
       DrawEntity(entity_map[y][x])   // Draw entity with ID stored at map location

Then have an array of all you entities, with pixel locations etc.
And, I'm sure the iPhone can handle it, as I've seen a lot more complicated games released!

For multiplayer/network, each loop would refer to that player's position.
I've read some good tile map tutorials from these forums, may be a good place to start.
Good luck,

Depending on how many entities you have, your way may be faster / simpler.
Just loop for all entities, and check if within a certain x / y position.
The more entities you have NOT on the screen, the slower this would be.
I was researching it a bit, and it does get complicated, for something that seems so easy.

I found this page on

It gets into how to handle ads that don't return anything, and how to handle a banner touch.
In the error handling, it has a line:
Code (glbasic) Select
self.bannerIsVisible = NO;
So this is maybe how we hide it when not needed anymore.
It mentions 'self', which I assume is referring to the iAd instance?

But, since I've never even loaded XCode yet, or touched Objective C, I've got a lot of learning ahead!
Wow, amazing! 
I was going to have to figure this out on my own!

I took a look at your code, it seems easy to implement.
But, I'm not quite sure how to use it.

Do I call 'GLB_iAd_Init()' just before I want to display an iAd?
For example, call it on a loading screen.
But then how do I clear it when the level is ready?
I noticed the 'GLB_iAd_Init()' call is outside of your SHOWSCREEN loop.

And, does it automatically revert to an actual iAd (not a 'testing' ad) when deployed to iTunes?

I've got conflicting emotions!  I feel like I'm being dissed!  Trying to care . . .  :blink:
ha, but just don't talk trash about hockey!
Since I don't speak German, I use Google translate often on these forums.
Would there be a way to automate that from the GLBasic forums?! 
(ie. Choose your language, plus have each forum post flagged as to what the original language was or something, then pass that phrase (forum reply) through Google translate.?!)

Recently, some German text looked interesting, so I translated it.
So, I found out that the soccer World Cup is happening. 
Ha, damn, I'm from Canada, how was I to know!?  :-[  (Do we even have a team!?)

Wow, that's convenient!  Thanks.
Scratch that off my 'To Do' list!

Quote from: Kitty Hello on 2010-Jun-23
If you want that many options, try:
So, if a song is being played when the game starts, it will keep playing.
And no way to start playing your own custom game music in that case.
(but sound effects would still work?)

That's not a bad option, if the user wants to listen to his/her own music, just start playing it before your game starts.
Otherwise you can play your own music.

When their song ends, the music is over?
It'd be cool to auto set their repeat mode (repeatMode) (default to MPMusicRepeatModeAll?) so the music never ends.
(but is this global?  you may have to set it back when exiting)

How hard is it to allow them to choose songs from their own library while in your game!?  That would be neat.  Does Apple even expose that? 

(Same as photos too I guess.  Having custom photos in your game would add a personal touch.  (A family portrait in a hallway, billboards, etc).  (With the user's permission of course!))

To initialize the playback queue to contain every song in the library, use this:  (Objective C I assume?)
// assign a playback queue containing all media items on the device
[myPlayer setQueueWithQuery: [MPMediaQuery songsQuery]];

from the page:

We could then give them next / previous buttons in our app and call 'skipToNextItem' and 'skipToPreviousItem'.
But with inline code, how do you insert Objective C? or translate it!?
Here's a good resource for music playback:

You use an MPMusicPlayerController object, or music player, to play media items from the iPod library. There are two types of music player:

  • The application music player plays music locally within your application. It is not aware of the iPod app's now-playing item, nor does it affect the iPod state.
  • The iPod music player employs the built-in iPod application on your behalf. On instantiation, it takes on the current iPod application state, such as the identification of the now-playing item. If a user quits your application while music is playing, that music continues to play. The iPod application then has your music player's most recently-set repeat mode, shuffle mode, playback state, and now-playing item.
From Wikipedia:
Apple states the following basic Leopard (version 10.5) system requirements, although, for some specific applications and actions (such as iChat backdrops) an Intel processor is required:[52]

    * Processor must be any Intel, PowerPC G5 or G4 (867 MHz and faster)
    * DVD drive (for installation of the operating system)
    * At least 512 MB of RAM (additional RAM (1 GB) is recommended for development purposes)
    * At least 9 GB of disk space available.

I'm not Macliterate, so I don't know where your system stands.

[Edit] "It stands right beside my desk, why?"  :D
Wow, that's much smaller than I was expecting.
Now, I have no static models (files), only dynamically created, so if I can trim my mp3s, I should get it to under 1 or 2 MBs!

Android emulator:

As for Androids having difference specs, I don't see that as a big problem.
Screen size / orientation is simple.
Just code your elements to be relative to an anchor (top, top-left, bottom-right, top-center), plus perhaps a pixel offset.
So, no matter what size screen or orientation, you score is always bottom-right, for example.
You just need a 'ConvertAnchorToScreenCoordinates()' function.

Same as game content.  A tile map would be easy, just pre-calculate the number of tiles down and across, etc.

But I see the problem with various input methods: keyboard, single touch, multi-touch, etc.
You would have to create a custom library to account for it all.
Use this in your game initialization:
Code (glbasic) Select
IF Device.HasKeyboard()
  Input.EventAdd_Keyboard("Fire", kAscii_Space)
//ELSEIF Device.IsMultitouch()
ELSEIF Device.IsTouch()
  Input.EventAdd_TouchPoint("Fire", 100, 200)
  Input.EventAdd_HWButton("Fire", kHardwareButton_3)

This code (ha, I just made that all up, sure to have logic/bug problems) will setup a 'Fire' event that could be called anywhere in your game logic and would work for any device, iPhone, Computer, etc, such as:
Code (glbasic) Select

IF Input.IsEvent("Fire") THEN . . .

It would be better (faster) to use constants instead of strings for event names, instead of "Fire", use kEvent_Fire, but you get the idea.

The 'Input.IsEvent' code would then handle the device specific checking as initialized earlier.
This keeps your game logic clean and device independent.
But since I've never done this, I'm sure there may be hurdles I can't predict yet.

I'm starting this soon for my own project, using compiler directives.
... If iPhone then rotate means tilting, else rotate means analog stick movement, etc.
(Input.AxisAdd_Tilt("Rotate", "XAxis"), or Input.AxisAdd_Joystick("Analog2.XAxis")    maybe)
view_x = Input.GetAxis("Rotate") (or something)
So testing on the PC versus the iPhone won't require any extra thought/changes.

This could also allow for more than one input method on the SAME device.  Add a touch point AND keyboard key to both trigger a 'Fire' event.
Does any body have any example numbers on how large their final iPhone app is, from GLBasic?
In other game dev languages, it can start at 10Mb just for the minimum file libraries.
Or, how large would a simple 'Hello World' app be?