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

Topics - Scott_AW

Use a image strip(series of images in one vertical or horizontal tile) to create a VOX file(a raw 3d voxel model) which can be converted in Slab6 to be used with build engine or whatever else.

Also exports a DDD file, glbasic model file and a OBJ w/ MTL files for use in other projects.

This is just a beta, so the OBJ doesn't have proper normals defined, nor is it optimized much.

It also creates a MTL file with the object which includes all the color info.

As a simple test, I ran a 16x16x3 strip, opened the obj in Anim8tor, export it as a 3ds, and then used poly2vox to convert it into a voxel again.  Its not worth the effort though as poly2vox creates some garbage pixels even if the models is made of cubes.  Still, a fun test, and the color data was retained in the 3ds.

However, my next step before I start to optimize the model building is to allow you to reverse a VOX file into a model.

The normal issue seems to be simple, and I just kind of threw empty ones in for now, just will take some tweaking.
When switching to 16bit color, I found my getpixel command was much more accurate.

I haven't tried other things that have had issue on different systems yet.  Grabsprite tends to work on some computers and not others.

Lately I found my get pixel routine was very off, completely ignoring white against black in some areas.  But switching to 16bit allowed it to properly function.
I'm not entirely sure I had this problem with version 7.

Right now I'm using the latest update of 8.

On -most- computers grabsprite works like it should, but on my new netbook vs. old it exports emptiness.

I found a work around using CREATESCREEN and SAVEBMP, works about the same as GRABSPRITE except it works for the Netbook that was having the problem.

Thought I'd bring this up if anyone else has experienced something similar.
I was somehow interested in world generation, while playing Dune 2000(its free now) and wasting time.  Then I had a bunch of thoughts that eventually led me to world generation.

I'll save you from the chain-like tangent that brought me to this....

Anyway I first started looking it, checking out perlin noise.  Now I kind of get it, but then not enough to feel comfortable using.  So I started looking for, then found a nice alternative.  Unfortunatly I can't recall the link, but it had a nice few sentences that described how you can generate semi-realistic worlds with a simple alogorithm.

You start out with a world array and a stack array for storing positions.

Fill in a few random places with land and water tiles, saving those locations in the stack.

Then scan through the stack, checking 8 direction around of tile and then setting them up either land or water.  If the home tile is water, all adjacent tiles turn to water.

Code attached at the bottom, references to images in the demo above.

Its not perfect perfect, but I'm sure with a little toying around you can get it to do what you want.

Oh, and add this line after //set grassy areas in sand
Code (glbasic) Select
// Remove sand from grass
      IF world[sx][sy] = 2 AND (range[0] > 1 AND range[1] > 1 AND range[2] > 1 AND range[3] > 1) ; world[sx][sy] = 3 ; CONTINUE ; ENDIF

Heres a more recent screenshot/demo, I plan on uploading the updated code sometime soon.


Photoshopped the mini map into that.

[attachment deleted by admin]
Any plans on future support for this OS?  I know its pretty new but seems to support C based programs and the likes.

Anyone have any more information on this?
Code Snippets / roto-poly
Since I needed it, I made a rotatable polyvector function

Code (glbasic) Select

DRAWRECT 0,0,16,16,RGB(255,0,0)
DRAWRECT 16,0,16,16,RGB(0,255,0)
DRAWRECT 0,16,16,16,RGB(0,0,255)
DRAWRECT 16,16,16,16,RGB(255,255,0)
GLOBAL imh, imw


  PRINT dir,0,0

  IF dir < 360
    INC dir, 1
    dir = 0

FUNCTION rotopoly: x, y, dir
  LOCAL w = imw/2, h = imh/2
    POLYVECTOR cast_x(x,w,dir+90), cast_y(y,h,dir+90), 0, 0, RGB(255,255,255)
    POLYVECTOR cast_x(x,-w,-dir+180), cast_y(y,h,-dir+180), 0, h*2, RGB(255,255,255)
    POLYVECTOR cast_x(x,w,-dir+180), cast_y(y,-h,-dir+180), w*2, 0, RGB(255,255,255)
    POLYVECTOR cast_x(x,w,dir-90), cast_y(y,h,dir-90), w*2, h*2, RGB(255,255,255)

FUNCTION cast_x: x, dist, dir
  RETURN x+(COS(dir)*dist)

FUNCTION cast_y: y, dist, dir
  RETURN y+(SIN(dir)*dist)
Here's the latest version of my game, Shield Breaker, a block smashing game were your own attack can be your destruction.

The engine is starting to come together, although the rebound is not perfect yet.  Still have a few more things to add like power-up drops, the mini-shields and such.

Here's the latest version in GLBasic, I'll try and get a mac version up sometime later.
Win32 version_9/22/10
New link if other doesn't work, Download

You can find the Game Maker version here, which is the template for this remake, however background will most likely be different in the end.  Currently there are no backgrounds in the GLB version.

I'm also working on trying to get a rotatable polyvector function to replace rotozooming.  Currently the blocks are prerender at intervals of rotation for per-pixel collision purposes, so its a little choppy.  I plan to replace the drawing with a smooth rotating polygon instead of frames, but keep the frames for collisions.
Off and on I've been working on creating a 3d FPS RPG with voxels, using Ken Silverman's Evaldraw.  It display voxel(3d pixel) models with othro squares and create a neat retro look.  Something like how a SNES RPG would look in 3d but without polygons.

Evaldraw version

Currently I've been translating the code from the ED engine to GLB, but voxel rendering itself is hardcoded into ED and I'll be left with doing that.

I've devised a format that should contain all the info to quickly(haven't tested yet) render voxel models in the form of ortho objects in a 3d space.

The engine itself is based of a grid for the map, scanning the area and decoding values to display walls, floor and cielings.  Each face of a wall block can have a unique model.

Right now its being simulated with DDD models based of the voxel models from the ED version.

Also the tools have been created in GLB so things can work smoothly together.  The map maker and image to voxel program are made in GLB

Heres a pretty raw screenshot of the current progress, there's still some bugs to work out because I'm translating C to GLB code and somethings are a little different.  Map reading seems to work fine though, its my raycasting for the view that needs some more work.

If you check the project website you'll notice that The Crawl is an open source project, and I plan on releasing stable version of the code for GLB further down the line.  Mostly to promote RPG creation and Voxels.

Manged to fix up most of the ray casting issues, now I've switched to working on the shading algorithm.  In the ED version it was per voxel, in the video below its per vertex, creating the illusion of fog.
I started to use sprite2mem in my image to voxel program, to replace the inaccurate and slow process of using get pixel.

I managed to somewhat correct the colors since its ABGR instead of simple RGB, but seem to get neon colors.

The main problem is everything was fine when working on one computer, however when I tried things on two different systems the sprite2mem was no longer storing the data.  I found this out by trying to convert it back to a sprite and ended up with an empty image.

The first system had a decent graphics card, I think ATI.

The second system had on board video, probably nothing that powerful.

The third system was my netbook which normally runs everything fine with it's intel 3150 graphics chip.

All systems are running XP.

Any ideas on what might be wrong?
Off Topic / Free textures

I've decided to release the texture and masks that I made and used for a concept RPG which I'm no longer working on.

So feel free to use them, but please give credit and contact me if its going to be involved in a commercial product.

Otherwise hope you can find them useful.
So I started playing around with Ken Silverman's EvalDraw to make use of that sprite2voxel program I setup.  Mostly because its the only thing I can both have control over and display voxels.

This has led to a new pending project for GLBasic, a map maker for it.

Ken was even nice enough to super optimize my code to convert what was going to be more like EOB to a 6DOF+mouselook 3d engine.  Its a nice surprise.

You can check out the progress and early demo here ->

Once I get a few more things done I'll share the version with Ken's movement/collision detection added and some simulated lighting and fogging I've added.
New Post:
Almost have it down, some issues with tiny parts dissapearing.  You'll find out what I mean if you test the fridge.bmp file in the program, parts of the handle don't get read for some reason.  Was ignoring the first color picked...

Aside from that, it now creates a simple color palette so your VOX files will have color in Slab6.  However the color is limited to 255(last index is for an empty voxel) and if your image exceed that you'll see some weirdness I'm sure, haven't tested it.

Idealy the max (not tested) size of an image you can use is 255x255 with 255 frames.  This may take awhile so I've added some loading bars to show you its just being slow and not dead.  So far I've only tested a 32x32 image with 8 frames, the fridge.   I've added a doorframe sample too, but this one is just 16x16.
Download Some bug in it...

Hopefully I'll get a chance to test some larger sprite strips.

Old Post:

A little while back I started playing with the idea of a fake voxel like dungeon game.  It would generate 3d models based on 16^3 array of cubes.  Then I thought, why couldn't I have it make real voxel files?  So I did!  But currently no color info is transfered yet, but it shouldn't be too difficult now that I've figured out the file format.

Make 16^3 voxels for VOXLAP, no color info yet...

Original topicLast released version, makes models


Find Slab6 here
Quick question, is a mask image(2 color) more efficient to use in a sprcoll vs. the original sprite?
I've replaced the use of drawsprite with a simple command that creates a polyvector instead, due to improved performance and greater flexibility that polyvector provides.  Also since I'm using large graphics and there is clipping, I updated the command to be a little smarter, only drawing in the screen and what is visible.

screen_width and screen_height need to be defined by you though.  Doesn't have scaling or rotation features yet, but I need to do them soon for my project.

Code (glbasic) Select

  FUNCTION DrawPolySprite: image, x, y, w, h, color
    LOCAL adjx = x, adjy = y, adjw = w, adjh = h, adjsw = 0, adjsh = 0, adjpw = w, adjph = h
    IF x < 0
      adjx = 0
      adjsw = -x
      adjpw = w+x
    ELSEIF x+w > screen_width
      adjw = w+screen_width-x
      adjpw = adjw
    IF y < 0
      adjy = 0
      adjsh = -y
      adjph = h+y
    ELSEIF y+h > screen_height
      adjh = h+screen_width-y
      adjph = adjh
    STARTPOLY image, 0
      POLYVECTOR adjx, adjy, adjsw, adjsh, color
      POLYVECTOR adjx, adjy+adjph, adjsw, adjh, color
      POLYVECTOR adjx+adjpw, adjy+adjph, adjw, adjh, color
      POLYVECTOR adjx+adjpw, adjy, adjw, adjsh, color
Less old and older post below, new post:

I made a bunch of tiny improvements, some you'll notice others you won't.  Also caught a few more bugs, enemy shots were not traveling with the map scroll speed, which also happened to the explosions.

Scrolling has also been altered, the ship moves slower horizontally and should allow for better handling.  Let me know if the map is more playable with this update.

Non-seeable changes are a polyvector drawing system that autoclips to the screen.  A example of that can be found on the snippets forum.

There might be some other changes I can't recall, sometimes its fix and forget.

Keys are still arrows, z=shoot, tab=make enemy.

PC version, 042310

MAC version, 042310

On a quick note, I don't really plan on having too many aerial units inside such a level.  Enemies will be foot soldiers, some mech units and turrets.

There's also a bunch of features I haven't decided I want to bring over from the GM version.  Which you can find Heres

Old post now below, new post:

9000+ pixel long level in one go, solid 60fps.  I haven't checked uncapping it.

Still need to fix some things, like making the player bullets faster and enemy AI.  The level is split into 9 1024x600 frames, with a lightmap, solidmap and backmap.  The entire level is pixel based collision, as is all collision in the game.

I built the levels using Tiled, a very nice program, exported images of separate layers and chopped them up.

I left out enemies since they're pretty much ghosts and defy the laws of physics, but in the demo I have of the entire level, shown below, you can press TAB to create some.


It takes a few seconds to load-up the level graphics, displayed by fat white bars on the bottom of the screen.

So, arrow keys to move, Z to shoot, TAB to create random enemy...who defies collisions.

A fancy screenshot.

The whole damn level.  This took awhile to put together, but I may scrap it for a redesign.

Old post:

When I first got glbasic, the first thing I did was play around with a sidescroller schmup that I had made before in GM, previous Qbasic(like 20 years ago....) but anyways, after looking through the forums a bit, I found H.K.'s SCHMUP tutorial video and learned a few useful things regarding game object creation.

Basic use of DIMPUSH and DELETE to handle object creation.

So I scrapped then old code and started over.

Here's a simple demo, Z to shoot, Arrow keys to move and ESC to quit at any time.


Tech demo 2, running 1024x600 with a map w/ collisions.  Enemies and their attacks however are not currently affected by the map.  The map level is a solid image, using SPRCOL against the player and it's attacks.  I think I got the collision working properly, try and break it.

Off Topic / Tablets
With the iPad making depute, I'm sure a lot of you are excited to develop on a tablet system.  I personally don't think the future of the current generation of iPads is too rosey though.  There's a number of issues, lack of camera and any kind of usb or card reading input.  Content is controlled through app stores and that can be swing or miss to get something in there.

Of course there's competition raising, currently I heard of the JooJoo, which is about a $100usd cheaper then the iPad and has various inputs that the iPad lacks.  However its has a special browser based OS so I'm not sure if glbasic can do anything for it.  If its based off linux, maybe but glb's staff would know better than I.

Now HP has there own tablet coming out soon, running off Windows 7 with a decent amount of features, camera, and inputs.  I can see a lot of nice possibilities for this, cost $50usd less than the cheapest iPad.  Now with a window's based tablet you can do a lot more, with lots of other libraries and engines already working for windows.  One thing I find most appealing is that the Slate is running of an Intel Atom, and has comparable specs to the netbooks I use in my developments.

As far as I know, all three of these have accelerometer's.

There's is another low-cost tablet pc that's more of detachable netbook, which tablets are just netbook's with touchscreens and no keyboards.

This in mind, I would be thinking that HP could probably sell their tablet cheaper, I'm sure its base cost is less than that of the iPad, which I think is like ~280usd to build.  I assume that the Slate probably cost less  than 200 to produce, as that's the value of the cheapest comparable netbook, so HP may have a nicer profit margin than Apple.

Just some food for thought.
I'll be making a photoshop swatch of this soon, but til then heres an image I constructed for the purpose of color picking for pixel art or whatever.

7 shade palette, hue transition colors, and 3 shade primary palette.

Download SuperSwatch! Kind of a mess and containing some repeat colors, swatch for Photoshop.
Looks like this.

The palette was original a combination of Doom, Duke3d, Heretix/Hexen, and Blood game palettes obtained from various sources.

When using 3d, with a text overlay.  Everything is fine on PC, but on a G5 w/ OSX the text is displayed by solid white rectangles equal to the character length.

Pretty much how it is

  draw 3d stuff

  draw fps, position stuff

I'm currently working on a model generation program, I believe that model files can store animation frames, but I was wondering is it possible to to create a model with animation in code.  I attempted it, but either I did something wrong or its not supported.

Basicly what I'm doing is generating a model, with an index as the frame number, saving to the same model each new model with a different index.  This crashes the program.
Is it possible to use toon shading but omit the black outline?  If not I suppose I can look for a shader.