Menu

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 - Wampus

#61
Impressive.

Quote from: ProNerd on 2013-Apr-24
X Void is my first program and my first programming experience in general. I started 4 weeks ago after watching a youtube turorial.

:-[ First program? Most people's first program accomplishes little more than not crashing, if they're lucky.

You'll be creating singularity AI in no time.
#62
You could try this: http://www.glbasic.com/forum/index.php?topic=9023.0

It doesn't use SOUNDPLAYING. Instead it reads the length of the sound from the WAV file and times how long until it needs to repeat by reading GETTIMERALL(). It should fix the problem. If it doesn't then something unusual is happening, like sound being played back at a different rate.
#63
Oooh, those 3D tracks look great. Also, drawing so many tiles in 3D is bound to be slower than drawing a nicely crafted track like in the posts by siatek and mentalthink. The polygon count would be so much lower.

Slydog, reducing the triangles drawn by splitting the map into trunks would be much quicker. I still want to animated tiles though, which would be a pain if I had to store so much in memory. For example, lava that has 6 frames of animation would require just 6 16x16 tiles if I stick to a 128x128 tile map. If I drew the map in chunks then I would still need to keep each chunk stored 6 times for the overall lava effect, which amounts to 6 2048x2048 textures.

I am probably going to be lame and stick to the 128x128 tiles thing, without 3D track drawing or stuff like that. I would make things look that much nicer, if I wasn't in such a rush.  :'(
#64
A huge 2048x2048 texture with changing texture co-ords would work and almost certainly be faster, only I like the idea of having tiles in order to animate water, lava or anything that could be animated on a tile by tile basis.

The other thing is, if the large texture was done using a 4 noded polyvector I think it would have affine texture mapping. This is what I mean:-



The middle example shows what I think would happen.
#65
Marmor that sounds interesting. What kind of draw distance are you thinking of?
#66
I don't know if its due to childhood nostalgia goggles but I liked the battle mode on the first SNES Mario Kart more than the later games. I'll be happy if I can capture some of how much fun that was while also adding a few extra things that hopefully don't break the gameplay.

And yah, not mode 7. Only made to look like it. :)

Because its real 3D its expensive. The track map is comprised of 16,384 tiles (128 by 128 map size). Drawing all that brings the framerate down from the optimum on older PCs. The area outside the track also has to be drawn for a large distance too, otherwise empty spaces show up near the horizon. I'm using Kanonet's libSPRITE routines for the billboard sprites and the track map itself. Its very handy.

Quote from: matchy on 2013-Apr-13
Ambitiously it would be nice with box2d and net multiplayer.

I would love to make use of networked multiplayer. Box2D too. The trouble, as it usually is for all of us, is about the amount of time I can give this. It would take me too long to put together a decent routine for lag compensation. With the physics it will be faster to write a simple simulation myself rather than tweak Box2D, though I have a nice physics editor that can export to Box2D. Hmm.
#67
I've been playing and with some help from Kanonet with OpenGL, came up with this...



It has no physics except the bare minimum for kart movement. I want to make a small battle-mode game for 1GAM. It won't be very ambitious and won't use a fancy physics library. However, if its useful at all I can post the source code of the final game.
#68
Hah. That is actually a fascinating video. Never occurred to me that wheels on a car might have to be driven by the engine at different speeds.
#69
Can't get this to compile (yet). Will have a quick look as to why.

What problems have you been having with collision?

EDIT: Ok I got it to compile. Just a problem with TYPE declaration. In mio.bas I changed line 33 from "TYPE actor" to "TYPE actorit" and line 91 from "GLOBAL actor AS actor" to "GLOBAL actor AS actorit".

Nice looking engine. I noticed I can push objects with my player character in one direction but not the other. Is that an issue you were having? Also pushing an object until it reaches the boundary of the room goes into an infinite loop.
#70
What a great bit of code. Vector sprites and fonts in GLBasic  :good:

It wouldn't be too much of a job to add scaling, rotation and other transformations. Good to know this is here.
#71
Oh, had an idea similar to this and ran into trouble with it. Click here to see the thread ( TLDR Drawing so many tiles was very slow )

While writing Porcupop I found a way to fix the slowness issue. If you need a routine to draw the tiled map very fast I could write something to do that and others could dissect and use it how ever they want.
#72
This looks fixed but I wanted to add an additional comment. In bigosfty's example there is an alternative to taking 1 pixel off the width and height off the texture co-ordinates. Extrude the original tile/sprite edges by 1 to 2 pixels instead, but have the texture co-ordinates set to the original tile/sprite size. So, if a tile/sprite is 64x64 large, then the new tile/sprite would be 66x66 large with the top left corner of the texture starting at 1,1 and ending at 65,65. Does that make sense? Doing this manually in a paint program is a bit of a pain but you could automate the process or use something like Texture Packer. Incidentally, doing this will also get rid of the edge artifacts even without having to modify the default OpenGL texture parameters in GLBasic.

EDIT: I added an attachment example. Its the same code and image from tile.rar although I've changed a couple of things:-

1) I extruded the edges of 1.png by 2 pixels each edge so that the original texture of 200x200 is now 204x204. If you look in the Media folder you should find the original 1.png sprite and the new one called 2.png

2) To reflect the extruded edges the drawing code is now...

      sx = 200
      sy = 200

      ...

      POLYVECTOR x1,y1,2,2,color
      POLYVECTOR x1,y1+y2,2,sy+2,color
      POLYVECTOR x1+x2,y1+y2,sx+2,sy+2,color
      POLYVECTOR x1+x2,y1,sx+2,2,color

Instead of

      GETSPRITESIZE num, sx, sy

      ...

      POLYVECTOR x1,y1,0,0,color
      POLYVECTOR x1,y1+y2,0,sy,color
      POLYVECTOR x1+x2,y1+y2,sx,sy,color
      POLYVECTOR x1+x2,y1,sx,0,color

Obviously it wouldn't be right to hard code the texture coordinates this way for each sprite. For the purposes of the example its ok though.
#73
Well, I don't know about super sound. With any luck it should be simple sound though.  :-[

It might be a bit difficult to learn to use it at first. In theory it could speed up development time. Sound always seems to be time consuming, confusing to me or throws up unexpected problems during rapid development for 1GAM, Ludum Dare, etc. This routine was meant to help me with that. I hope its useful to someone else too.
#74
The attached proggy is an alternative way of handling sound in GLBasic. It should be simple to use and especially helpful for platforms that may only play a small number of sounds concurrently. At its base the code uses standard GLBasic commands. Because of this it should compile fine on all platforms. You can also use it in addition to other sound code without having to replace what you've done already, unless you want to.

Why do this at all? Because I wanted 1) a suitable and simple approach to the issue described in this thread, 2) an easy way to deal with needing multiple instances of the same sound playing at once, 3) universal volume control and 4) looping sounds.

The attached proggy uses only 4 channels. I did this deliberately for demonstration purposes. Of course, you'll probably want more than that with your apps. :)

Clicking the left mouse buttons plays a shooting sound. Pressing space starts or stops a looped sound. Clicking the right mouse button plays a wibbly sound that can't be interrupted until its finished. If what you see on screen seems confusing, sorry. There is a bunch of internal information you don't need to know being displayed for test purposes. I don't have the time to write a more suitable demonstration right now.

It should be fairly easy to use. For instance, this is a comparison of loading, playing and stopping a sound in GLBasic and how you would do it with SSound (keeping in mind SSound does more than what is shown here):-








GLBasic    ---    SSound
GLOBAL mysound%, channel%    ---    GLOBAL mysound%, channel%
mysound% = GENSOUND()
LOADSOUND "explosion.wav", mysound%, 1
    ---    mysound% =  SSLoad("explosion.wav")
channel% = PLAYSOUND(mysound%, 0.0, 1.0)    ---    channel% = SSPlay(mysound%)
STOPSOUND channel%    ---    SSKillSound(mysound%) or SSKillChan(channel%)
HUSH    ---    SSKillAllSounds()

However, if you want understand better how it works and what its doing you need to grasp these components:-

A sound is any standard .wav file you've loaded.

A buffer is the number of times a sound has been stored in memory. The more of these you assign for any sound, the more instances of that sound you can overlap at the same time without any cutting out or failing to play (depending on the mode - see below)

A channel is one of a limited set of available tracks that a sound can be played on. For example, on my Nexus 7 the number of sounds that can be played at the same time is set to 8 in GLBasic. Therefore the maximum number of channels should be set / would be set to 8.

The mode the sound is played with determines how it is treated by the routine. 0 is standard - the sound will be played on the next available channel. If no channel is available then it will be played on the channel that is the oldest, i.e. the sound that has been playing the longest is cut off to make way for the new sound. Also, if there aren't enough buffers for a new channel then an already used channel playing the sound is used. This works out fine on the ear in most cases. 1 is looped - the sound will continue to loop unless you tell it to stop and cannot be interrupted like a standard sound. 2 is not a looped sound but can't be interrupted, so will continue to play until it is finished unless you kill it. If no channels are available because all are taken up with uninterruptable sounds then a call to play a new sound will do nothing <- this should be rare because SSound was created to help prevent this in all but the worst cases.

OK, here are the commands:-

soundenum% = SSLoad ( filename$, buffers% )
Loads a sound from the current set directory with the name filename$. If your require it to be possible for more than one instance of the sound to be played at once, e.g. more than one overlapping sounds of bullets or explosions, then set the optional value buffers% to how many you anticipate. The value soundenum% is the index of the sound returned by SSLoad.

channel% = SSplay ( soundenum%, volume#, mode%, pan# )
Plays a sound loaded into the index soundenum%. The channel used is returned to channel% but you probably don't need to know this for most purposes so can leave it out. Values for volume#, mode% and pan# are also optional. Volume# and pan# work the same as GLBasic PLAYSOUND(). For mode% these are possible values:-
0 - Standard. Use this unless you need a looped sound or sound that must not be interrupted (e.g. a voice over).
1 - Looped sound. Sound will loop indefinitely unless stopped with SSKillSound, SSKillChan or SSKillAllSounds.
2 - Uninterruptable sound. Similar to GLBasic default behaviour, the sound will continue to play until it is completely finished and can't be interrupted.


SSInitialise ( numofchannels% )
If you want to use more or less channels than the default 8 then you need to call this function before you start loading sounds. numofchannels% is the required number of channels you want to use.

num% = SSTestNumSoundChannels% ( filename$, chanmax%)
Uses the .wave file in filename$ to test how many sound channels are available for use. I don't advise using this every time an app starts up. Just execute it on first boot and store the value for later reference. Use 1/4 second of total silence for the .wav file or the test may destroy the ears and/or speakers of the person using your app! The value chanmax% is the maximum number of channels to test for. By default its set to 64 but can be much larger. My main PC returns positive for > 2048 channels. Note: This function has not been tested on more than one PC and a good, recent android device. Not sure how reliable it will be unless tested.

SSUpdate ()
If you want to use sound looping then this must be present in your main loop. If you aren't going to use looping sounds then you don't need to use this function.

SSVolume ( vol# )
Sets the universal volume to vol#. All sounds played are proportional to the universal volume. For example, if you played a collision sound at full volume using SSPlay(collisionsound%, 1.0) and the universal volume was set to half at 0.5 then the resulting sound would be half the full volume.

SSKillSound ( soundenum% )
Stops playing the sound with index soundenum%. All channels playing the sound will be halted and all buffers for the sound are released.

SSKillChan ( channel% )
Alternative to SSKillSound. Stops playing the sound playing on channel channel%. Only the channel specified and consequent buffer will be clear. All other sounds are left alone.

SSKillAllSounds ()
Stops all sounds, freeing all buffers and channels.

---------

There are other functions but almost all of them are internal to the commands above so you don't need to know anything about them.
#75
Math / Re: Simplex Noise
2013-Mar-14
Thanks. Very much.  =D

Quote from: fivesprites on 2013-Mar-11

I'm sure you guys can put this to better use (generating funky heightmap data etc) and I can't wait to see the results :)


Nor me. :)