CP - Alien Breed Remake - 4

Community Forums/Showcase/CP - Alien Breed Remake - 4

Rimmsy(Posted 2004) [#1]
http://www.perturbatio.com/files/AB/code.zip
http://www.perturbatio.com/files/AB/media.zip
http://www.perturbatio.com/files/AB/music.zip



Mark has recently added scripting support for the editor so we need graphics for the object tiles, some more scripting in the code aswell as our standard TODO:


Player, Alien clipping and accuracy
- improve collision detection with player/alien, bullet/alien, alien/player, alien/wall and player/wall.

Weapon Graphics
- For when you see them on the ground and pick em up! Also we need dead people decals! (see extend editor)

Different bad guys (need more, more!!!)
- Extend the Alien type to allow for different bad guys, including face huggers scuttling around and stuff. This would mean the radius needs to be included in the type and probably an offset variable so the image is drawn centrally, ie 64x64 would have an offset of 32 a 32x32 would have an offset of 16 etc.

Sound (partially done)
- There is some sound media in the original downloads from coffeedotbean but this needs to be implemented.

Ammo
- Needs to distiguish what weapons it's for

Intex system console
- Tiles for the intex systems so player can access it, this allows players to buy armour, weapons, ammo, health, etc. Maybe even sell stuff too?!

More Alien media
- Currently it's not animated, doesn't die etc etc. And if we made more than one alien too, also I think we need static bad guys too like auto cannons etc.

More Player media
- Personally I think we can cut half the animation frames out and you'd not notice, and use the spares for death and pain animation.
- More rotation animation?

Extend Editor (nearly/partially done)
-Need an object & script editor

Extend Scripting (basics in place)
- Need trigger code for 'onevery(n)' and 'onrandom(n,m)' and script support for createalien(), playsound(), animate()
for placing bad guy spawn points , ambient sounds, animated decals etc. (Mark Tiffany to progress code, feel free to create some animations).




(tu) ENAY(Posted 2004) [#2]
This is looking great. Are there seperate graphics for each of the two players?
Because four player mode (like Gauntlet) would be fantastic.


Rimmsy(Posted 2004) [#3]
Not at the moment, but we could put that on the todo list. I think we'll come up with the final player image/frames/animation before we copy it and make others. We could have different version you could play with.


(tu) ENAY(Posted 2004) [#4]
An idea to save memory could be to have all the players looking the same but have different coloured shadows. Or a different coloured helmet drawn over the top of the image.

I agree with what someone else said in a seperate thread about doing the gfx in Blitz3D.
You would only have to need about 3 or 4 frames of animation. The rest is about rotating the sprite and entity colouring the image for seperate players. In 3D you could allow for clockwise/anticlockwise turning instead of 8 way movement. This would also allow split screen and for the camera to turn and zoomed out views.


Mark Tiffany(Posted 2004) [#5]
The idea of separating out the graphics engine is a good one - it would be neat if the same engine could support a pure 2d and 2d in 3d mode. Personally, I prefer the straight 2d, but there's no reason why you couldn't abstract it out...

I'd actually quite like to see an isometric view too, although I'm thinking of holding onto my iso code for the next community project... ;-)

Rims, on the todo list, can you amend the notes as follows:

Extend Editor (nearly/partially done)
-Need an object & script editor

Extend Scripting (basics in place)
- Need trigger code for 'onevery(n)' and 'onrandom(n,m)' and script support for createalien(), playsound(), animate()
for placing bad guy spawn points , ambient sounds, animated decals etc. (Mark Tiffany to progress code, feel free to create some animations).

Doors
- Currently any key will open any door, need to extend addkey() and checkkey() script commands to open different doors with different keys. (Mark Tiffany to progress)


I'll try to knock up a crappy intex graphic and add an object / script for that tonight.


Perturbatio(Posted 2004) [#6]
I just created this input box function, still not working properly, (wrapping text needs sorted, and it doesn't scroll).



*EDIT*
belongs in editor.bb
*EDIT*
Updated slightly
add the following global to the top of editor.bb
Global LastInput = MilliSecs()





Mark Tiffany(Posted 2004) [#7]
Ta pert'. That'll no doubt be useful for the object / script editor. Now for some more updates from moi!

Changes:
- added playsoundonce() to scripting, and moved health and key sounds into scripts
- added different door colours to match keys, and updated scripting to make them work
- updated objects.png with new doors and (very) basic intex graphic
- updated map with keys / doors / intex
- amended loadgraphics to determine number of tiles itself (rather than hardcoding)
- reuse loadgraphics in editor and engine
- minor bug in palettes fixed whereby last tile wasn't shown

(and yes, I know that the one intex on the map doesn't do anything...yet!)

Rims, you can get rid of the doors TODO completely now! ;)

You'll need *this* zip containing a new map and obj file, plus the updated objects.png.

In players.bb, replace keycheck() with the following:
Function keycheck(player,keyid%)
	For p.pickedup = Each pickedup
		If p\player = player And p\obj =keyid Then Delete p:Return True
	Next
	Return False
End Function

In script.bb, RunScript, update the "checkey" command to:
			Case "checkkey"
			   	If Not keycheck(pl\id,Int(si\param)+2) Then ClearScriptFrom(si):Return

and add this function:
Function ClearScriptFrom(si.scriptitem)
	Repeat
		nsi.scriptitem=After si
		Delete si
		si=nsi
	Until nsi=Null
End Function

In map.bb, update opendoor()
Function opendoor(x,y,vis=True)
	id%=map(x,y,LayerObject)
	map(x,y,LayerObject)=0
	map(x,y,0)=0
	
	If map(x,y-1,LayerObject)=id Then opendoor(x,y-1,False)
	If map(x,y+1,LayerObject)=id Then opendoor(x,y+1,False)
	If map(x+1,y,LayerObject)=id Then opendoor(x+1,y,False)
	If map(x-1,y,LayerObject)=id Then opendoor(x-1,y,False)

	; check the vis from this newly opened door!
	If vis Then CheckVis(x,y)
	
End Function

In the "editor include.bb", remove hardcoded numbers for maxobject and maxtile and move these to map.bb. Also move the global tiles, object, cursor and tiles_small.
Remove loadgraphics from "editor include.bb" and replace it in map.bb with this:

And in the palette drawing code, remove the -1's
	;palette
	For n=0 To 68
		tileno = n + tileoffset
		
		
		If activelayer <> 2
			If tileno<maxtile Then DrawBlock tiles,((n-(Floor(n/23)*23))*32)+32,490+(Floor(n/23)*32),n+tileoffset
			Else
			If tileno<maxobject Then DrawBlock objects,((n-(Floor(n/23)*23))*32)+32,490+(Floor(n/23)*32),n+tileoffset
		EndIf

		If tileno = activetile Then Color 0,255,0:Rect ((n-(Floor(n/23)*23))*32)+32,490+(Floor(n/23)*32),32,32,False

	Next

In engine.bb, replace the lines immediately following the "loading Gfx.." text with loadgraphics()

In script.bb, remove references to playoneshot(), and add this case statement:
			Case "playsoundonce"
				Select param
					Case "health_pickup":playoneshot(health_pickup,x,y)
					Case "key_pickup":playoneshot(key_pickup,x,y)
				End Select

If you ignore the fixes / tweaks above, hopefully this illustrated how easy it is to add new scripting stuff. Just add the code to support the command to RunScript and create/update an object to use it!


Perturbatio(Posted 2004) [#8]
looks like a typo here:
			Case "playsoundonce"
				Select param
					Case "health_pickup":playoneshot(health_pickup,x,y)
					Case "key_pickup":playoneshot(key_pickup,x,y)
				End Select


Should be:
			Case "playsoundonce"
				Select si\param <-----
					Case "health_pickup":playoneshot(health_pickup,x,y)
					Case "key_pickup":playoneshot(key_pickup,x,y)
				End Select


*EDIT*
Also, on the new door colours (nice btw) you can shoot out a single section but the other sections do not open, if you shoot out the middle section, the two parts are now treated as separate doors.


Matthew Smith(Posted 2004) [#9]
Guys,

the player animation code was accidentally removed from Player_UpdateAll. Add this at the bottom to fix:
	;Animation
	If move Then
		pl\fpause = (pl\fpause+1) Mod 5
		If pl\fpause = 0 Then 
			pl\frame = (pl\frame+1) Mod 15
		End If	
		
	End If



Perturbatio(Posted 2004) [#10]
Ok, it's 4am and I've going to bed, but I'm having some trouble in the InputBox function, if I set the fndWidth to a random value (using Rand(6,8)) I can display text in the edit windows, if I use the GetCharWidth Function (which does return a value) it does not display any text.

AAAAAaaaargh!



Rimmsy(Posted 2004) [#11]
I had a look at your code and... you're going to kick yourself... it's because you were drawing the text in the colour of the background. I added a colour 0,0,0 before you draw the text and it works.

For those who want to just download the differences to the media.zip instead of downloading 1.7 meg, the objects image is here: www.3030deathwar.com/downloads/ab/objects.png


Mark Tiffany(Posted 2004) [#12]
@Pert' : Ta for fixing the sound, although I'm positive it was working for me!?! Going mad I guess...

And regarding the shooting doors thing, I suspect that's how it was working before my changes. The opendoor function looks for matching doors next to the current door section, and always has done - so I'm pretty sure that's an old 'bug'. Not sure how we deal with it: either we say that destroying one section of a door prevents all other sections from working as a door (you have to blow it all up), or we destroy the entire door on destroying one section. OR, (and I think I prefer this), don't have destroyable doors that can be opened by keys. I'm not convinced it makes sense to allow you to either use force or a key on any one door. By all means, we could have a new door object that looks like a door, but nothing opens it, forcing you to blast your way through. Requires a bit of thought...

@Matt : ta for picking up on that clumsy omission of the animation by yours truly. ;-)


Perturbatio(Posted 2004) [#13]

I had a look at your code and... you're going to kick yourself... it's because you were drawing the text in the colour of the background. I added a colour 0,0,0 before you draw the text and it works.


Doh! *Puts on some hobnailed boots*.

It is however too damn slow, I think I'll try precalculating it.

@Pert' : Ta for fixing the sound, although I'm positive it was working for me!?! Going mad I guess...

It was playing both the key pickup sound and the health pickup sound for me.


And regarding the shooting doors thing, I suspect that's how it was working before my changes.


No, the entire door opened when shot previously, I think it's because the different coloured doors need a const set in consts.bb and a check in the case statement of DamageTile. It was just going to the default case for non-yellow doors.

code.bb:
;OBJECT CONSTS (ot=ObjectType)
Const otVDoorYellow = 7
Const otHDoorYellow = 8

Const otVDoorRed    = 12
Const otHDoorRed    = 13

Const otVDoorBlue   = 14
Const otHDoorBlue   = 15

Const otVDoorGreen  = 16
Const otHDoorGreen  = 17


in map.bb - DamageTile
			;horizontal door
			Case otHDoorYellow,otHDoorRed,otHDoorBlue,otHDoorGreen
				OpenDoor(x,y)
			;vertical door
			Case otVDoorYellow,otVDoorRed,otVDoorBlue,otVDoorGreen
				OpenDoor(x,y)



Mark Tiffany(Posted 2004) [#14]
I didn't realise it previously opened the entire door. To be honest, I'd prefer to see the logic that you've got there in a script, rather than hardcoding. i.e. an "ondestroy" trigger that the above map code runs, which runs a script along the lines of "opendoor(7):remove(nearby)".

However, that implies two triggers for the same object (ontouch and ondestroy), which we hadn't allowed for. I'll have to think about that...


Matthew Smith(Posted 2004) [#15]
I was looking at the script code and added the following for spawning aliens:
			Case "createalien"
				Select si\param
					Case "alien":SpawnAlien(x,y,-1,STANDARD_ALIEN)
					Case "hugger":SpawnAlien(x,y,-1,FACE_HUGGER_ALIEN)
				End Select


and add this to the test.obj:

18
1
Spawn (Alien)
createalien(alien)|remove(me)
19
1
Spawn (Hugger)
createalien(hugger)|remove(me)

I would imagine a couple of 'invisible' tiles would be added to the objects as triggers (just knocked up a couple of temp ones myself).


Couple of questions come from this?

* best way to determine x,y location to 'create' alien? specific spawn location, random ??
* alien ID - should we track this as part of the SpawnAlien process? ie. global counter
* spawning a number of aliens at once?

You have done a great job with this Mark!


Mark Tiffany(Posted 2004) [#16]
We shouldn't need a blank tile image in objects.png, setting the image id to -1 ought to do it, although that's untested! (Feel free to amend the code to sort that out) With your additions to test.obj, you should also update the first line to specify the total number of objects (i.e. add 2) else the objects won't load!

As for your questions, in reverse order:
3)to create multiple aliens, use createalien() more than once. e.g. "createalien(hugger)|createalien(hugger)|createalien(alien)" would create a whole bunch.
2)do we need to track alien ids at all?
1)I was thinking that createalien should take the x,y as inputs...e.g. createalien(x,y,type).

On the last one, I was thinking that it'd be neat if the following script syntaxes were understood:

"createalien(x,y,hugger)" - creates a hugger at the objects x,y location
"createalien(px,py,hugger)" - creates a hugger at the players location (may be different to object)
"createalien(x-1,y+1)" - creates a hugger SW of the object (useful for creating a generic trap that creates 4 aliens around the trap)
"createalien(123,456,hugger) - creates a hugger at a very specific location on the map (useful for very specific scripted events)

Fancy implementing some of them? ;-)

Also, your code (and OBJ file) will only ever create aliens when the player touches the object square. At some point I was planning to extend the triggers to include "onevery(10)" and "onrandom(100,200)" to generate events at a specified number of game logic loops - i.e. spawning one alien every 100-200 loops. I haven't fully thought through yet whether this should only happen when the object is on screen or not though...

And I think I now see your point about counters of alien types - it might be nice if spawn points only create a new alien once an old one dies...maybe we need an optional ID in the createalien params too?


Mark Tiffany(Posted 2004) [#17]
Another update! Changes:
-objects can now have multiple triggers (and a different script for each)
-ondestroy() trigger added
-Yellow doors now destroy properly (i.e. fully open when destroyed)

Updated the object type in consts.bb to allow for text based triggers and up to 5 trigger scripts per object.
Type objdef
	Field image%
	Field name$
	Field trigger$ ; see constants below
	Field script$[5]
End Type

and the constants for script items
Const ScriptTrigger_OnOver$="|onover("
Const ScriptTrigger_OnTouch$="|ontouch("
Const ScriptTrigger_OnDestroy$="|ondestroy("
Const ScriptTrigger_OnAction$="|onaction("


Updated the object load part of map.bb load() to deal with multiple trigger scripts
			For i=1 To NumObjects
				objectdef(i)=New objdef
				objectdef(i)\image=ReadLine(filein)
				objectdef(i)\trigger=ReadLine(filein) 
				;add a separator to the start to make searching simpler
				If Left(objectdef(i)\trigger,1)<>"|" Then objectdef(i)\trigger="|"+objectdef(i)\trigger
				objectdef(i)\name=ReadLine(filein)		
				For n=1 To CountString(objectdef(i)\trigger,"|")
					objectdef(i)\script[n]=ReadLine(filein)
				Next
			Next

And the equivalent in save()
	For i=1 To NumObjects
		WriteLine fileout, objectdef(i)\image
		WriteLine fileout, Mid(objectdef(i)\trigger,2) ; chop off the first | for saving
		WriteLine fileout, objectdef(i)\name		
		For n=1 To CountString(objectdef(i)\trigger,"|")
			WriteLine fileout,objectdef(i)\script[n] 
		Next
	Next

Add this to util.bb:
Function CountString(s$,search$)
	n=0
	While Instr(s$,search$)
		n=n+1
		s$=Mid(s$,Instr(s$,search$)+1)
	Wend
	Return n
End Function

and add util.bb as an include to editor.bb
Okay, so that sorts out defining multiple triggers on an object. Now to make them do something!

In players.bb, player_updateall, amend the four 'touch' lines that look like this
If objectdef(tile)\trigger=ScriptTrigger_OnTouch Then RunScript(pl,objectdef(tile),pl\x,pl\y+playerradius)
to this
If Instr(objectdef(tile)\trigger,ScriptTrigger_OnTouch) Then RunScript(pl,objectdef(tile),ScriptTrigger_OnTouch,pl\x,pl\y+playerradius)

and update the collect lines to:
	; collect objects
	If map(pl\x/32,pl\y/32,LayerObject)>0 Then 
		If Instr(objectdef(map(pl\x/32,pl\y/32,LayerObject))\trigger,ScriptTrigger_OnOver) Then RunScript(pl,objectdef(map(pl\x/32,pl\y/32,LayerObject)),ScriptTrigger_OnOver,pl\x,pl\y)
	End If

and update the top of the RunScript function to look like this:
Function RunScript(pl.player,obj.objdef,trigger$,x,y)
	p=Instr(obj\trigger,trigger)
	n=CountString(Left(obj\trigger,p),"|")
	si.scriptitem=ParseScript(obj\script[n])
	While si<>Null

That allows the scripting to process the two existing triggers on the saem object, but to fix the doors, we need to implement the ondestroy() trigger.
So, back to map.bb, and this time update DamageTile code for <1 hit to:
	;if run out of hits
	If map(x,y,LayerHits) <1 Then 
		
		If map(x,y,LayerObject)>0 Then 
			If Instr(objectdef(map(x,y,LayerObject))\trigger,ScriptTrigger_OnDestroy) Then 
				;TODO: we probably need to keep track of which player owns which bullet, and pass that player in here
				RunScript(Player(1),objectdef(map(x,y,LayerObject)),ScriptTrigger_OnDestroy,x*32,y*32)
			Else
				;default action for any other destructible object
				Map(x,y,LayerObject) = 0 
				Map(x,y,LayerCollision) = 0
			End If			
		End If
		
	EndIf

And to actually fix the door problem, and support the new OBJ file model for triggers, an updated test.obj - note that only yellow doors will destruct 'properly' on the basis we probably want the other key types to never be destructible.


Finally, for reference, I've updated the script.bb comments:



Snader(Posted 2004) [#18]
Mark, do you ever sleep? (great work by the way!)


Rimmsy(Posted 2004) [#19]
He's a robot, you know. I've had no time to update this tonight and my eyes kill. I'll update and actually get some code done tomorrow. Honestly!


Matthew Smith(Posted 2004) [#20]
Mark,

Just back on the 'invisible' tiles thing, if we set the objectID to -1 how would you add this 'trigger' tile to the editor?

Do we need some sort of flag (true/false) to determine if an object is a visible object or collectable or trigger? This way it would be shown on the editor but not in the game itself.

I'll have a look at processing multiple parameters if you like.

Again, you have done a great job with the scripting stuff!!


Mark Tiffany(Posted 2004) [#21]
Nah, just an humble ace coder. ;-)

(The trick is that I think about exactly how I want something to work in my head before I even consider coding anything. Luckily, 99% of the time it works first time...)

Matt, go ahead with multiple params stuff - assume that you'll need to deal with any number of params separated by commas, but also make sure you consider quotes (e.g. for showconv(px,py"I'm gonna get you, you scum eating alien!")

As for invisible tiles, the object ID is defined by it's position in the OBJ file, *not* the number in the file. That number is the image to be used by that object, and it should be possible to set it to -1 to force it to be invisible.

However, as you've spotted, there is a flaw in this. Although you'll be able to set the object in the editor, and it will work in the engine, you won't see it on the map (or palette) in either. I realised this last night, and am thinking along these lines (feel free to do this yourself, probably won't have time myself tonight):

- Ensure image numbers in OBJ file start from 1 not 0.
- Change drawmap and palette drawing to deal with this.
- Use negative numbers in the OBJ file for images to be used in editor, but not in the engine.
- Amend drawmap to know if it's in the editor or engine, and draw negative OBJ image in the editor only (using the positive image id)
- Amend the editor palette to do the same

I'd also quite like to see a 'tile info' area in the editor that specifies what each layer is currently set to on the tile you're currently hovering over. In this way, you can also display the object name in the editor, making it easier to understand what objects are!


Snader(Posted 2004) [#22]
Just played a game of Alien Breed in DosBox and captured some images of the intexsystems. Don't know if we want to use these or use them as an example for the version this community is making. I also captured and slighly altered some tiles like the ones in Alien Breed for the Intex Terminals.
Also included the 'INTEX SYSTEMS' female voice.

http://home.wanadoo.nl/~snader/intexsystems.zip

BTW, these are the weapons used in Alien Breed 1:

Broadhurst DJ Twinfire 3LG (Rapid fire) - 10000 Credits
Dalton Arc Flame (Rapid fire) - 24000 Credits
Robinson Plasma Gun (Pump action) - 35000 Credits
Ryxx Firebolt MK22 (Flamethrower) - 48000 Credits
Styrling Multimatic (Triple barrel) - 60000 Credits
High Impact Astro Laser (Lazer) - 75000 Credits


Rimmsy(Posted 2004) [#23]
I get a stack overflow with this updated scripting. It occurs in the opendoor function which seems to get called an infinite amount of times. I added some checking for coords in the function so it now reads:
Function opendoor(x,y,vis=True)
	id%=gettile(x,y,LayerObject)
	putTile(x,y,LayerObject,0) ; set to 0
	putTile(x,y,LayerCollision,0)
	
	If gettile(x,y-1,LayerObject)=id Then opendoor(x,y-1,False)
	If gettile(x,y+1,LayerObject)=id Then opendoor(x,y+1,False)
	If gettile(x+1,y,LayerObject)=id Then opendoor(x+1,y,False)
	If gettile(x-1,y,LayerObject)=id Then opendoor(x-1,y,False)

	; check the vis from this newly opened door!
	If vis Then CheckVis(x,y)	
End Function

But on my computer with debug on it simply quits and with debug off it displays a "stack overflow" which is likely caused by and infinite loop. I suspect it has something to do with on touch AND on destroy but I'm not sure where it's from. Here's the broken code at the moment with all these updates: www.3030deathwar.co.uk/downloads/ab/temp_code.zip

-----
Thanks for those Snader. They seem a bit pricy especially if you're just picking up 10,50 and 100 credit chips. We'll probably have to play test those!


Mark Tiffany(Posted 2004) [#24]
Does it break when destroying the door, or when opening it with a key (or both?)?

Is it definitely clearing the door objects that relate to the door being destroyed / opened? That would cause a loop, as it would move on to the nearby object, then back to the original ad infinitum...

Is the id being picked up correctly? If it's getting a zero instead of the id of the object, then that would also cause a horrendous loop as above, but across (almost) the entire map. Yuck! I did wonder if I should pass in the id, but thought it neater to determine it in the function - maybe there's a scenario where the x,y doesn't match the object location?

(I'm not likely to get a chance to do anything tonight, so thought I'd throw in as many thoughts as possible in the hope someone else spots my mistake...it was working okay for me, so I must've slipped up and missed a change somewhere)


Rimmsy(Posted 2004) [#25]
No, it was me I think. When I first ran it there was some boundry error when checking the map array. So I added a call to getTile instead of directly to the array. Thing is, these use different coords; the map 32x32 and the getTile the screencoords. It works now though.

I've added some new weapons. I did some crap graphics so if someone can spruce them up I won't be so embarressed. I've also made a change to the obj file. Whilst I was adding objects I found it quite hard, so I've modified to read:

image = 0
trigger = onover()
description = Ammo
addammo(50)|remove(me)

for simplicity, seeing as it's a pre-compiled handwritten version. The map->load/save functions update this as well. The onl problem I've discovered is that the editor won't let me add any weapons after the 3rd, I think. I'm not sure what the problem is. I've got to polish the gun picking up section, but at the moment you can pick up guns and shoot them. Still to do: changing weapons, noises, power, notifying you you picked one up, etc.

The code and media have been updated, but, as always if you don't want to update the entire media.zip you can download the new objects.png from here: www.3030deathwar.co.uk/downloads/ab/objects.png
Also, for those who don't want to dl media.zip, here's the updated map.obj:



Matthew Smith(Posted 2004) [#26]
Guys,

If we want to use more of the intex system gfx, I have been able to grab clean images from the amiga version.

These include the backgrounds, weapon images and text. It was something I wanted to look at - just been too busy with work.

What do you rekon?


Perturbatio(Posted 2004) [#27]
vis seems to be slightly broken, when I shoot the row of credits, it doesn't update, you then walk into a void.


Perturbatio(Posted 2004) [#28]
suggested updated objects.png:

<See further down.>

*EDIT*

I need to adjust the lighting on the terminal graphics actually, but we do need four directions for them.


Rimmsy(Posted 2004) [#29]
I'm not sure why that is, perty. I've made some updates including adding your image. Have a look at the history.txt for more info.


Perturbatio(Posted 2004) [#30]
I'm now going to flay myself for not reading the docs, stringwidth has solved my character width issue in about 5 seconds flat.

Oh the shame.


Rimmsy(Posted 2004) [#31]
Ha! I've just used your getInput function quite a lot. The new version (newer than 10 minutes ago) has some new editor code:

- Added a simple commandline to editor. maps\test will load that map.
- Right clicking on the object in the object palette will allow you to edit the script.

Don't flay yourself too much. I'm pretty sure it's illegal in 18 states.

Matt, as for the intex screenies, I'm not sure. Should we use graphics from the actual game? I know we're not selling it, but since we've done our own version so far I think we should probably steer clear of copying. I don't know, though. They're cool, aren't they. What do you think?


Perturbatio(Posted 2004) [#32]
I've updated the InputBox to have proper character wrap, no word wrap yet.
It has key repeat for backspace (and the cursor keys) and now has a CaratPos so that you can go back and forward and insert text.

The GetCharWidth function can probably be removed now as it is obsolete (doh!).

in editor.bb:


add the following after SetFont font:



Perturbatio(Posted 2004) [#33]
there's a slight bug in your script editing code that wipes the code if escape is pressed.

In the main loop change the RMB action to:




Perturbatio(Posted 2004) [#34]
the media.zip file is coming down as a 32kb corrupt zip.


Snader(Posted 2004) [#35]
As for the intex screens, maybe I can make something similar. I think the green used in the original is very cool as it symbolizes the old terminal screens.


Perturbatio(Posted 2004) [#36]
might want to change the CaratSymbol actually because it clashes with the pipe character in the scripts.

Maybe change it to 0x166 ( ¦ )


Caff(Posted 2004) [#37]
Rims - the latest media pack is not working here :/ is the zip corrupted?


Rimmsy(Posted 2004) [#38]
Sorry guys. I've uploaded it again. I may be coming to end of my bandwidth allowance. I've emailed Chad about borrowing some. I've uploaded the media.zip again, so it *should* work this time.

Done the carat symbol as well.


Perturbatio(Posted 2004) [#39]
Added CTRL+ARROW Key to jump to next delimiter (delimiters are currently set as the pipe character, and the left and right brackets).




Perturbatio(Posted 2004) [#40]
modified Function Button:



Added scancodes.bb to includes ( Include "inc\scancodes.bb" ):


modified code in main loop to test new button:
	If Button(650,300,140,"Save",False,False,KEY_F1) Then saveBlitzVersion()
	If Button(650,320,140,"Load",False,False,KEY_F2) Then loadBlitzVersion()


And it works!

*EDIT*

changed layer buttons in main loop to have number keys for shortcuts:



Perturbatio(Posted 2004) [#41]
I can host the files on my server if you like, I have an enormously large amount of bandwidth (i.e. unlimited).


Perturbatio(Posted 2004) [#42]
When I try to open the red door that leads into the central room, I get:

Function Map->OpenDoor(60,33,1) has tried to access a tile with nothing in it.


All the other doors I've tried open fine.
If I create a new red door in front of or behind that door, I get the same error.
If I create one further up the map, it opens fine.

I'm a tad confused with this one.


Perturbatio(Posted 2004) [#43]
Added LoadLast function and changed Load Old to Load Last:

Function LoadLast()
	FileIn = ReadFile("prefs.txt")
		FileName$ = ReadString(FileIn)
	CloseFile(FileIn)
	If Len(FileName$) > 0 Then Load(FileName$)
End Function


in SaveBlitzVersion after the save command, add:
	
	;Save last file name
	fileout = WriteFile("prefs.txt")
		WriteString fileout,FileName$
	CloseFile(fileout)


Change the buttons at the end of the main loop to:
	If Button(650,280,140,"New",False,False,KEY_F8) Then createRandomMap()
	If Button(650,300,140,"Save",False,False,KEY_F1) Then saveBlitzVersion()
	If Button(650,320,140,"Load",False,False,KEY_F4) Then loadBlitzVersion()
	If Button(650,340,140,"Load Last",False,False,KEY_F5) Then LoadLast()



Perturbatio(Posted 2004) [#44]
Updated lighting on intex consoles in objects.png:

<object image in media.zip>

new map.obj:




Perturbatio(Posted 2004) [#45]
Regarding the door issue, if you approach a door from the right or above, it will open fine, if you try to open it from the left or below, it causes the runtime error.
It would appear to be offset by one tile when approached from these sides.


Perturbatio(Posted 2004) [#46]
ok, solved it, in players.bb - Player_UpdateAll modify the collision code to:



It was adding the playerradius to p1\y in all directions except Right.

*EDIT*
Also in script.bb - RunScript

the opendoor case should really floor() the x and y values:
			Case "opendoor"
				opendoor(Floor(x/32),Floor(y/32))



Mark Tiffany(Posted 2004) [#47]
Looks like some good progress has been made - and some good fixes for my stupid mistakes! ;-)

As for the line of credits and vis - I think I stuffed up DamageTile. Currently, if a map tile is marked as destructible, and there is no OBJECT present, then the tile will not be detroyed. Equally, if there IS an object present, but it doesn't have an ondestroy() trigger, or actions within the object script that will auto 'CheckVis()' like the opendoor() script command, then it won't sort things out. I don't have time now, but will try to fix this later unless someone else beats me to it...I think it's just restructuring the If block and adding CheckVis() to code rather than rely on the script.

I'll also look at adding an action key too, such that we can get the intex systems working properly...


Matthew Smith(Posted 2004) [#48]
Guys,

I'm currently working on an Intex systems console - will have something to update hopefully around this time tomorrow night.


Perturbatio(Posted 2004) [#49]
Is there a way currently to attach the same script to multiple objects?
i.e. have a generic explode me on destroy script and attach it to barrels, vents, computers.

I don't necessarily mean in the editor, but has provision been made for this in the script section?


Rimmsy(Posted 2004) [#50]
I *think*, according to the way mark's done it, a new script will have to be made for each. So you'll have a script and image for an exploding barrel; a script and image for an exploding red barrel, etc.

But you only have to do this once and it can be reused, so it's sort of a long way of doing it for a shorter production time kind of thing. I prefer it this way.

Looking forward to seeing what you've got for the intex, Matt. As for the hosting, yeah Perty, if I could pass the torch to you for now... how should we go about this? You take my position as keeper of the code? I'll make a final update...


Perturbatio(Posted 2004) [#51]
I'm thinking we should sign up for a SourceForge account, that way it makes it easier to update the project and they will host it.
And if I understand how it works correctly, then there's a CVS service as well, which would make an individual code keeper unnecessary.
I can't guarantee that I will be able to regularly update the code you see.
I have however hosted the media and music on my site (see my sig)


Rimmsy(Posted 2004) [#52]
ahhh, good idea. I'm not sure how sourceforge works. I've seen it before but not really had a look. I'll read up on it tonight. Go ahead and sign up, I'm all for it. What about you other guys?


Mark Tiffany(Posted 2004) [#53]
SourceForge sounds good, although I've never used it. I guess we need to check out the T&C...

As for reuse of scripting, and your example of exploding barrels, I'd see this as:

Implement a 'bigexplosion()' command in runscript to do the whole graphical explosion thing, and add 'big_explosion' as a sound to 'playsoundonce()'. Then for each object definition that needs to use it (barrel, vent, computer) they each have the ondestroy() trigger pointing at a script that says 'bigexplosion()|playsoundonce(big_explosion)'. So yes, each object definition needs to have it's own copy of the script, but the script commands should be at a high enough level that reuse isn't a problem.

Oh, and another scripting command that would be nice to add to the end of that: destroy(nearby). i.e. ondestroying one barrel, we trigger the destroy script for any nearby barrels! woohoo! I think I might implement that command soon... ;-)


Perturbatio(Posted 2004) [#54]
As I understand the T&C, you need to actually be developing an open source project that complies with these restrictions:
http://opensource.org/docs/definition.php


Perturbatio(Posted 2004) [#55]
how about destroy(nearby|<Radius>) i.e. only destroy items within the specified radius (in tiles).


Perturbatio(Posted 2004) [#56]
on another note, it might be a good idea to move the GUI functions of the editor into an include, so that they and any future ones can be used in the main game if necessary.

i.e. We can have GUI functions for the intex system in the same file and usuable anywhere.


Mark Tiffany(Posted 2004) [#57]
Pert, good idea (both the radius and GUI stuff). In fact, if we go with SourceForge (and having read the details, I don't see any reason not too ; this is effectively an open source project), it's probably better in some ways if we have as many separate files as possible (within reason!).


Perturbatio(Posted 2004) [#58]
yes, that was another reason for my suggestion, it means someone can add GUI stuff without blocking access to the main editor code.

*EDIT*

We do need to decide which license to use though. I don't know enough about the specifics of the license to make a suggestion at the moment.
Presumably we want one that prevents someone else from selling the source or a compiled product without the explicit permission from the copyright holders?


Perturbatio(Posted 2004) [#59]
Ok, I've separated the gui as much as I can just now, I'm going to have to go out soon. I had trouble with the fonts for some reason, although they may not need to be separated anyway.

In editor, change the top section to:



gui.bb:



Mark Tiffany(Posted 2004) [#60]
Reading sourceforge docs now. In the end I haven't made any changes since my last update, anyone else who wants to take a stab at them feel free, I may not get much time to code (but will pop in to discuss) over the next couple of days...


Mark Tiffany(Posted 2004) [#61]
Oh, and as for licenses, I'm perfectly happy that whatever we do is open source, but I agree that I would only want it to be used in non-commercial works without permission. Isn't that the essence of the GPL? The sourceforge don't *include* the GPL, but do their terms *preclude* us applying the GPL? Still reading...


Mark Tiffany(Posted 2004) [#62]
Okay, so as I understand SourceForge, their T&C essentially just force you to make it open source, and to distribute code with everything (or make available). They then allow you to use a number of different licenses for your software, including the GNU General Public License.

I've read the SourceForge T&C, Open Source definition (required by the T&C) and the GNU GPL and am happy with them. They embody the sentiments above of myself, and, I think Perturbatio. I suggest all others take a look at these documents and post whether they're happy with them.

GNU General Public License
GPL FAQ
SourceForge T&C
Open Source Definition (part of SF's T&C)

Provided there's no problems, then I'll submit the new project (I've registered today) Tuesday / Wednesday about 2000 GMT. And if we (Rob?) decides otherwise later on, we can always take the project off SourceForge, and only the version as it stands at that point remains 'open-sourced' or 'GPL'ed' - at least that's how I read it!


Rimmsy(Posted 2004) [#63]
I'm confused by all the licence speak, but does this mean anyone can download, compile and sell this project? I'd be a bit miffed if that happened.


wizzlefish(Posted 2004) [#64]
Wow. What you guys are doing here is really amazing. Who knew a 2D game could be so cool?


Perturbatio(Posted 2004) [#65]
I would suggest that anyone that has not already added something to this, delay in doing so until we have decided upon the license we are going to use.
(so that they can be sure they want to adhere to that license).


Perturbatio(Posted 2004) [#66]
I'm a little confused by the whole GPL thing actually, if we offer the source and binaries for free, as far as I can tell, under the GPL any person who receives these can then charge for them. This isn't what I thought the GPL did.

I would like it to be that we offer the source and binaries for free, and no one can charge for the source or modified source or binaries.

*EDIT*
Basically and Open-Source Free of Charge and free to modify software license.


Mark Tiffany(Posted 2004) [#67]
The way I read it:
I think anyone can charge a reasonable fee for redistribution, but not sell it as such. i.e. a CD packed full of free games can be sold in shops for £5 on the basis of redistribution costs, but just hosting the software as a standalone download wouldn't allow a charge to be levied.

If someone wanted to include the software within another piece of software, then provided that software is not a derivative work (i.e. not just changing the gfx and code a bit to create a slightly different game, but say as a demo in the BlitzMax distro), a fee can be charged for the package as a whole.

Derivative works must retain the same license.

I think the GPL FAQ covers a lot of these, and I intend to read that over the next few days (I've only read the license itself).


Perturbatio(Posted 2004) [#68]
The GPL FAQ doesn't seem to cover what happens if someone sells software that was originally released without charge.

It covers the inverse (i.e. people can distribute it without charge, even if we were to charge for the initial download).


If I distribute GPL'd software for a fee, am I required to also make it available to the public without a charge?
No. However, if someone pays your fee and gets a copy, the GPL gives them the freedom to release it to the public, with or without a fee. For example, someone could pay your fee, and then put her copy on a web site for the general public.




Mark Tiffany(Posted 2004) [#69]
Okay, I've read the GPL FAQ, and I'm happy. Specifically:

*Modified versions*

Any modified version is bound by the GPL. This means it can be distributed *under the GPL*, i.e. for free and must make source code available.

*Charging*

Even if someone chooses to charge a fee for it, or a derivative work, anyone who purchases that copy may a) distribute that same version FREE b) request, and distribute the source of that version. Effectively, the GPL renders the sale of versions worthless, as any purchasers can then redistribute the same thing for free! So while charging for copies is not ruled out, they won't make much money out of it!

*Creating a non-GPL version*

Essentially, only the copyright holders can choose to distribute a non-free version of the software. I suggest we all claim joint copyright to each module of code. We can, or someone else can, *by mutual consent from all copyright holders*, choose to create a non-free version. i.e. if we collectively decide to take the code and make a commercial game from it, provided we *all* agree, we can. However, anyone could still gain access to the original GPL version if they so wish, so it'd have to be sufficiently different to justify someone buying that new version. (I'm not suggesting we want to do this, but it's not precluded in the agreement...)

Hope that answers everyone's key questions - it does mine!


Mark Tiffany(Posted 2004) [#70]
Heh, cross post Pert'!

I reckon that section that you posted renders the sale worthless. If someone is selling a version (modified or unmodified), then anyone else can buy it and distribute it under the GPL, i.e. FOR FREE. The sold version must include the GPL, which states that it can be distributed FOR FREE. The seller, unless it's a really hot game, and no-one catches on for some time, is therefore unlikely to make much money out of our work. They might make a little, but nothing worth worrying about.

While I personally would prefer an explicitly statement of 'no charge', I think the reasons for doing it the way they have done, while complex, are reasonable.


Rimmsy(Posted 2004) [#71]
yeah alright, sounds fair enough to me.


Perturbatio(Posted 2004) [#72]
Yeah I suppose that's reasonably safe, but what we could do is have a statement like 'This software is provided "As Is" free of charge by the copyright holders under the GNU GPL' on the loading screen so that our intent is plainly obvious.


Phil Newton(Posted 2004) [#73]
http://www.cvsdude.org/ does free CVS and SubVersion hosting if you don't want to use SourceForge. I haven't used it, but heard it's very good.


Mark Tiffany(Posted 2004) [#74]
Part of the GNU GPL actually includes a formal statement regrding 'fitness for purpose' etc, so even that's covered! Also, it requires that anyone publishing a modified version must clearly attribute their name to their changes, so as not to damage the reputation of the original authors.

Ty, thanks for the link; however I think we do need to get a copyright & license statement in there even if we go with somewhere that doesn't require it. i.e. some protection is better than none. (and before someone points it out, yes I know copyright always holds unless it's stated as public domain, I think we need a statement of some form, and GPL does it for me)

I think we should wait until Rob gets back though before doing this - it was his code base, and so mainly his copyright: I don't believe we have any right to issue this under any license without his say-so.

In the meantime, if you're happy with the GNU GPL, code away! Let's not let this hold up the good work we've done!


Clyde(Posted 2004) [#75]
Great stuff, looking cooler each time :)


Mark Tiffany(Posted 2004) [#76]
Suggest we post some screenies in the gallery, and link to those from the top of the thread if we're having bandwidth problems...


Rimmsy(Posted 2004) [#77]
Mark, could you please do it? I keep getting weird file not found, jpeg not detected errors when it's clearly a jpg and I've clearly selected the file. Perhaps it's a firewall issue. I doubt it though.


Mark Tiffany(Posted 2004) [#78]
Will try tonight when I get home from work...


Perturbatio(Posted 2004) [#79]
I can't submit one either, I even tried saving a JPG from a program other than photoshop and it still can't read the image.

feel free to link to this image at the top of this thread:

<image link removed since it's been added>


Rimmsy(Posted 2004) [#80]
Yeah, weird innit? Could you email me your email address perty so I can send you the latest code to host temporarily until we get this sourceforge up and running?


Perturbatio(Posted 2004) [#81]
email sent.


Perturbatio(Posted 2004) [#82]
I'm currently attempting to rewrite the InputBox so that it's more organised, it's a bit of a kludge at the moment.

I've noticed a problem with the editor.

You can't create a new map without an obj file for it, since it won't allow you to add an object without a script for it.


Perturbatio(Posted 2004) [#83]
latest code in my sig.


Rimmsy(Posted 2004) [#84]
Mmmm, yeah. Maybe we can have an obj import button as well. Or a default obj file to import and edit.


Mark Tiffany(Posted 2004) [#85]
A default OBJ file is probably the best idea, including all the basics (doors, keys, exploding barrels, etc.).

What you could do, is have the load function assume that if there is no OBJ file, then use "default.obj" and rename our current OBJ file to that. It's likely we'll be building up the basic OBJ file for now anyway until we start creating maps for the story with scripted events...


Perturbatio(Posted 2004) [#86]
Yes, a default OBJ would be a good way to do it, but it also needs to be done on new.


Perturbatio(Posted 2004) [#87]
simple graphic for Alien Queen:




(tu) ENAY(Posted 2004) [#88]
I think Rims should post a link to the zip right at the top of this page so people can easily find which is the latest version to download.


wizzlefish(Posted 2004) [#89]
when do you suppose this will be done? looks GREAT!


Matthew Smith(Posted 2004) [#90]
Hi guys,

Sorry, been really busy and work and cricket this week. Have most of the weekend off so am trying to finish the intex menu - have got quite a bit done and it seems to work quite well.


Blitzblaster(Posted 2004) [#91]
Really nice game. It is normal when i shot then i have no shoot sfx ? And the walk is not really good, i can`t see the feeds from the player and he walk so strong with your body left and right. But it is a cool game.

Regards Blitzblaster


Perturbatio(Posted 2004) [#92]
another weapon has been added that has no sfx and the bullets fire way too slowly, the default weapon should have sound and be fast firing.


Rob Farley(Posted 2004) [#93]
3 days without anyone posting... not good guys... time to get some momentum going again.

Rims, is the latest update the downloads at the top, you've not posted recently so just curious if I need to hack in any code or if the zips bring me 100% up to date.

Is the todo list at the top up to date?

I've got a bit of reading to do to see what's been going on so I'll take a look at where we are this evening.


Perturbatio(Posted 2004) [#94]
As far as I know, no code updates have been made since the latest upload to my server. (links at top and in my sig).

I have started work on more GUI stuff, but it's going a little slower than I would've liked since I have other things in my life to sort out as well.


Rob Farley(Posted 2004) [#95]
What's the date of those uploads? Just need to know if those zips are up to date or if code from this thread needs adding in.


Rimmsy(Posted 2004) [#96]
Yeah, they're about as up to date as possible. We've been considering moving this to sourceforge (read up a bit) so I've made no modifications to the code on my end. What are your thoughts rob? We've got no bandwidth problems at the moment since perty's taken the load but with regards to updating and such perhaps we should move to sourceforge.


Mark Tiffany(Posted 2004) [#97]
Hey Rob, good holiday?

Been a bit busy myself recently, but hope to have some time in the next couple of days, although I'm away again over the weekend. To be honest, I was kind of waiting for your return to kick off the whole license / source control discussion again. What are your thoughts?


Rob Farley(Posted 2004) [#98]
Rims, No ideas about sourceforge as I have no experience of it... I'll look into it.

Mark, yep thanks. I'll look into some of the discussions in more detail later. From what I've seen from them it looks like there are some perfect legal doobies there that we just need to add to the zips.


Matthew Smith(Posted 2004) [#99]
Guys,

Note: I have also e-mailed each of you the images as I don't have anywhere to host as yet.


Here's the start of the Intex Systems I've been working on:

Create 'Intex-new.bb'
;Images 
Global intexBackground = LoadImage("gfx\intex-background-sm.png")
Global intexFrame = LoadImage("gfx\intex-frame.png")
Global intexText = LoadAnimImage("gfx\intex-text-sm.png",8,11,0,40)
MaskImage intexText,255,0,255
;Global intexWeapon = LoadAnimImage("gfx\intex-weapons.png",320,88,0,6)
;MaskImage intexWeapon,255,0,255

Global intexChars$ = "*ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:?"
Const pauseMax = 75
Const maxLines = 20

Const charWidth = 8
Const xOffset = 146
Const yOffset = 100

Type MenuSystem
	Field id
	Field build
	Field bChar
	Field bLine
	Field menuText$[maxLines]
	Field x[maxLines]
	Field y[maxLines]
	Field subMenu[maxLines]
	Field highlight[maxLines]
	Field total
	Field pauseCounter
	Field cursorRow
	Field cursorX
	Field cursorY
	Field bCharCounter
	
End Type

Global intexMenu.MenuSystem

Function IntexMenu(pl.player)
	Local currentMenu = 0
	Local exitMenu = False
	Local preBootCounter = 0
	Local menuUpdateCounter
	
	;Create a menu store
	intexMenu.MenuSystem = New MenuSystem
	
	;Get the boot text
	GetMenuText(currentMenu,pl)
	
	While Not KeyHit(1) Or exitMenu = True
		;Set buffer
		SetBuffer BackBuffer()
		
		;Draw
		DrawBlock intexFrame,xOffset-15,yOffset-12
		DrawImage intexBackground,xOffset,yOffset 
			
		;Drawtext
		ProcessMenuText()
		
		;Individual menu functions
		If intexMenu\build = False Or currentMenu = 11 Then
			Select currentMenu
				Case 0	;Intex Boot
					;Set menu to Main Menu 
					currentMenu = 1
					GetMenuText(currentMenu,pl)

				Case 1,2,3	;Main Menu
					DrawImage intexText,32+xOffset,intexMenu\y[intexMenu\highlight[intexMenu\cursorRow]], 0
					
					;Menu Up/Down
					If menuUpdateCounter = 0 Then
						If control(pUp,pl\id) And intexMenu\cursorRow > 1 Then
							intexMenu\cursorRow = intexMenu\cursorRow - 1
							menuUpdateCounter = 10
							
						ElseIf control(pDown,pl\id) And intexMenu\highlight[intexMenu\cursorRow + 1] <> 0 Then
							intexMenu\cursorRow = intexMenu\cursorRow + 1
							menuUpdateCounter = 10
							
						End If
						
					Else
						;Control the speed of the menu movement
						If menuUpdateCounter > 0 Then
							menuUpdateCounter = menuUpdateCounter - 1
						
						End If
						
					End If
					
					;Menu select
					If control(pfire1,pl\id) And intexMenu\subMenu[intexMenu\highlight[intexMenu\cursorRow]] > 0 Then
						currentMenu = intexMenu\subMenu[intexMenu\highlight[intexMenu\cursorRow]]
						GetMenuText(currentMenu,pl)
						
					End If
						
				Case 7
					If control(pfire1,pl\id) Then
						;Return to main menu
						currentMenu = 1
						GetMenuText(currentMenu,pl)
						
					End If
										
				Case 10	;Disconnect
					exitMenu = True
							
			End Select
			
		End If
		
		;Draw
		Flip True
		
	Wend
	
	;Clear keys
	FlushKeys()
	
	;Tidyup
	Delete Each menuSystem
	
End Function

Function GetMenuText(menu, pl.player)
	Local totalLines, lines
	Local lineText$, x, y, subMenu, max
	Local highlight

	Select menu
		Case 0	;Intex Boot
			Restore menuIntexBoot
			
		Case 1	;Menu
			Restore menuIntexMain

		Case 2	;Weapon Supplies
			Restore menuIntexWeaponsSupply
			
		Case 3	;Tool Supplies
			Restore menuIntexToolSupply
			
		Case 7	;Statistics
			Restore menuIntexStatistics
			
		Case 10	;Disconnect
			Restore menuIntexDisconnect
			
	End Select
	
	;Read the data
	Read totalLines
	
	;Clear
	For lines = 1 To maxLines
		intexMenu\highlight[lines] = 0
	Next
	
	;Process the lines
	For lines = 1 To totalLines
		Read lineText, x, y, subMenu, highlight
		intexMenu\menuText$[lines] = UpdateTags(Upper(lineText), pl)
		intexMenu\x[lines] = x/2 + xOffset
		intexMenu\y[lines] = y/2 + yOffset
		intexMenu\subMenu[lines] = subMenu
		
		;Set line selection
		If highlight <> -1 Then
			intexMenu\highlight[highlight] = Lines
			
		End If
		
	Next
	
	;Set remaining fields
	intexMenu\build = True
	intexMenu\bChar = 0
	intexMenu\bLine = 1
	intexMenu\id = menu
	intexMenu\pauseCounter = 0
	intexMenu\total = totalLines + 1
	intexMenu\cursorRow = 1
	intexMenu\bCharCounter = 0
	
End Function

Function UpdateTags$(lineText$, pl.player)
	;Update tags
	lineText = Replace(lineText,"%PLSCORE%",LSet(pl\score,6))
	lineText = Replace(lineText,"%PLCREDITS%",LSet(pl\credits,6))
	lineText = Replace(lineText,"%PLKILLS%",pl\kills)
	lineText = Replace(lineText,"%PLSHOTS%",LSet(pl\shots,6))
	lineText = Replace(lineText,"%PLDOORS%",LSet(pl\doors,6))
	lineText = Replace(lineText,"%PLAMMO%",LSet(pl\clip,6))
	lineText = Replace(lineText,"%PLENERGY%","GOOD")
	lineText = Replace(lineText,"%PLCURRENTWEAPON%",Upper(pl\weapon\name))	;Current
	lineText = Replace(lineText,"%WBROADHURST%",WeaponStatus(pl\ownedWeapons[1]))
	lineText = Replace(lineText,"%WDALTON%",WeaponStatus(pl\ownedWeapons[2]))
	lineText = Replace(lineText,"%WROBINSON%",WeaponStatus(pl\ownedWeapons[3]))
	lineText = Replace(lineText,"%WRYXX%",WeaponStatus(pl\ownedWeapons[4]))
	lineText = Replace(lineText,"%WSTYRLING%",WeaponStatus(pl\ownedWeapons[5]))
	lineText = Replace(lineText,"%WIMPACT%",WeaponStatus(pl\ownedWeapons[6]))

	;Return
	Return lineText
	
End Function

function WeaponStatus$(wp.weapon)
	If wp<>Null Then
		Return "YES"
		
	End If
	Return " NO"
End Function

Function ProcessMenuText()
	Local currentChar$,x,y,maxChar,char
	Local charCounter = 0
	Local drawCursor = False
	
	If intexMenu\build Then
		If intexMenu\bChar > 0 Then
			;Get the current char
			Repeat
				currentChar = Mid(intexMenu\menuText[intexMenu\bLine],intexMenu\bChar,1)
				If currentChar = " " And intexMenu\bChar < Len(intexMenu\menuText[intexMenu\bLine]) - 1 Then
					;Skip over any spaces
					intexMenu\bCharCounter = intexMenu\bCharCounter + 1
					intexMenu\bChar = intexMenu\bChar + 1
					
				ElseIf currentChar = "+" Then
					;We need to pause
					intexMenu\pauseCounter = (intexMenu\pauseCounter +1) Mod pauseMax
				    Exit
				    
				Else
					;Exit out
					Exit
					
			    End If
			    			    
		    Forever
			
		End If
		
		;Continue to process text
		If intexMenu\pauseCounter = 0 Then
			;Increment number of shown characters
			intexMenu\bCharCounter = intexMenu\bCharCounter + 1
			
			;Increment char
			intexMenu\bChar = (intexMenu\bChar + 1) Mod Len(intexMenu\menuText[intexMenu\bLine])
			If intexMenu\bChar = 0 Then
				;Increment line
				intexMenu\bLine = (intexMenu\bLine + 1) Mod intexMenu\total
				If intexMenu\bLine = 0 Then
					;Set each item to it's max
					intexMenu\bLine = intexMenu\total - 1
					intexMenu\bChar = Len(intexMenu\menuText[intexMenu\bLine])
					
					;Finish
					intexMenu\build = False
					FlushKeys()
					
				End If
				
			End If
			
		End If
		
	End If
	
	;Draw text
	For drawLine = 1 To intexMenu\bLine
		;Set co-ords for current line
		x = intexMenu\x[drawLine]
		y = intexMenu\y[drawLine]
			
		;Draw current line
		For drawChar = 1 To Len(intexMenu\menuText[drawLine])
			;Increment letter count
			charCounter = charCounter + 1
			
			;Get current char
			char = Instr(intexChars, Mid(intexMenu\menuText[drawLine],drawChar,1)) - 1
			If char > -1 Then
				DrawImage intexText,x,y,char
			
			End If
			
			;Building the menu, if so pause on last char and display cursor
			If intexMenu\build Then
				;Slight pause when first displaying character?
				If (charCounter = intexMenu\bCharCounter) Then 
					Delay 15
					intexMenu\cursorX = x
					intexMenu\cursory = y
					drawCursor = True
					Exit
				
				End If
					
			End If
			
			x = x + charWidth
			
		Next
			
		If drawCursor Then
			DrawImage intexText,intexMenu\cursorX,intexMenu\cursorY,0
			Exit
			
		End If
		
	Next
	
End Function

;Data Structure
;No of lines
;Text$,X,Y,SubMenu

.menuIntexBoot
Data 10
Data "INTEX NETWORK CONNECT: CODE ABF01DCC60 ",8,96,-1,-1
Data "CONNECTING..................... ",8,120,-1,-1
Data "INTEX NETWORK SYSTEM V10.0 ",8,168,-1,-1
Data "2G RAM:           OK ",8,192,-1,-1
Data "EXTERNAL DEVICE:  OK ",8,216,-1,-1
Data "SYSTEM V1.10 CS:  OK ",8,240,-1,-1
Data "VIDEODISPLAY:     DAMAGED+ ",8,264,-1,-1
Data "EXECUTING DOS 5.0 ",8,312,-1,-1
Data "SYSTEM DOWNLOADING NETWORKDATA..... OK ",8,336,-1,-1
Data "INTEX EXECUTED!+ ",8,360,-1,-1

.menuIntexMain
Data 8
Data "INTEX MAIN MENU ",192,64,-1,-1
Data "INTEX WEAPON SUPPLIES ",144,136,-1,1
Data "INTEX TOOL SUPPLIES ",160,160,3,2
Data "INTEX RADAR SERVICE ",160,184,-1,3
Data "LEVEL INFORMATION UPDATE ",128,208,-1,4
Data "INTEX ENTERTAINMENT ",160,232,-1,5
Data "STATISTICS ",240,256,7,6
Data "EXIT INTEX NETWORK ",176,280,10,7

.menuIntexWeaponsSupply
Data 2
Data "INTEX WEAPON SUPPLIES ",144,48,-1,-1
Data "WEAPON SUPPLIES REQUEST: ",48,96,-1,-1

.menuIntexToolSupply
Data 8
Data "INTEX TOOL SUPPLIES ",160,72,-1,-1
Data "ELECTRONIC HAND MAP        500 CR ",64,144,-1,1 
Data "AMMO NYBBLE               1000 CR ",64,192,-1,2
Data "FIRST AID KIT             2000 CR ",64,240,-1,3
Data "6 KEYS                    4000 CR ",64,288,-1,4
Data "EXTRA LIFE               10000 CR ",64,336,-1,5
Data "EXIT ",288,384,1,6
Data "YOUR CREDIT LIMIT IS: %PLCREDITS% CR ",80,432,-1,-1

.menuIntexStatistics
Data 16
Data "INTEX STATISTICS ",176,32,-1,-1
Data "PLAYER SCORES:  %PLSCORE% PTS ",80,80,-1,-1
Data "ALIENS KILLED:  %PLKILLS% ",80,104,-1,-1
Data "SHOTS FIRED:  %PLSHOTS% BULLETS ",112,128,-1,-1
Data "CREDITS OWNED:  %PLCREDITS% CR ",80,152,-1,-1
Data "DOORS OPENED:  %PLDOORS% ",96,176,-1,-1
Data "AMMO OWNED:  %PLAMMO% CLIP",128,200,-1,-1
Data "ENERGY STATE:  %PLENERGY% ",96,224,-1,-1
Data "CURRENT WEAPON:  %PLCURRENTWEAPON%",64,248,-1,-1
Data "WEAPONS AVAILABLE: ",16,272,-1,-1
Data weaponBroadhurst + "... %WBROADHURST% ",48,320,-1,-1		;112
Data weaponDalton + "...           %WDALTON% ",48,344,-1,-1
Data weaponRobinson + "...        %WROBINSON% ",48,368,-1,-1
Data weaponRyxx + "...         %WRYXX% ",48,392,-1,-1
Data weaponStyrling + "...        %WSTYRLING% ",48,416,-1,-1
Data weaponImpact + "...    %WIMPACT% ",48,440,-1,-1

.menuIntexDisconnect
Data 1
Data "DISCONNECTING..............+ ",32,128,-1,-1


Other Changes:
;Player.bb ----------------------------------------------------------------------------------
type player
	Field score, kills, shots, doors
End Type

;Function Player_updateall
	; weapons (player specific)
	If control(p_weapon1,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponBroadhurst))
	If control(p_weapon2,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponDalton))
	If control(p_weapon3,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponRobinson))
	If control(p_weapon4,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponRyxx))
	If control(p_weapon5,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponStyrling))
	If control(p_weapon6,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponImpact))

;Engine.bb -----------------------------------------------------------------------------------

createWeapon(1,weaponBroadhurst,    1.5, 	5, 	25, 	100, 3.0, 	2,			21, "sfx\mgun.mp3", "", "sfx\pistolreload1.mp3")
createWeapon(2,weaponDalton,    	10.0,	1, 	25,  	500, 6.3, 	1,			22, "", "", "")
createWeapon(3,weaponRobinson,  	8.0, 	5, 	25, 	300, 2.6, 	0,			23, "", "", "")
createWeapon(4,weaponRyxx,      	0.4, 	5, 	25, 	100, 3.0, 	-1,			24, "", "", "")
createWeapon(5,weaponStyrling,  	1.5, 	5, 	25, 	100, 3.0, 	3,			25, "", "", "")
createWeapon(6,weaponImpact,    	1.5, 	5, 	25, 	100, 3.0, 	3,			26, "", "", "")

;Script.bb ------------------------------------------------------------------------------------

;Function RunScript
			Case "pickupweapon"
				Select Int(si\param)
					Case 1:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponBroadhurst))
					Case 2:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponDalton))
					Case 3:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponRobinson))
					Case 4:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponRyxx))
					Case 5:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponStyrling))
					Case 6:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponImpact))
				End Select

			Case "opendoor"
				opendoor(Floor(x/32),Floor(y/32))
				;Update counter for player status
				pl\doors = pl\doors + 1

;Weapons.bb ---------------------------------------------------------------------------------

Const weaponBroadhurst$ = "Broadhurst DJ Twinfire 3LG"
Const weaponDalton$ = "Dalton Arc Flame"
Const weaponRobinson$ = "Robinson Plasma Gun"
Const weaponRyxx$ = "Ryxx Firebolt MK22"
Const weaponStyrling$ = "Styrling Multimatic"
Const weaponImpact$ = "High Impact Astro Laser"

;Function Shoot

		;Update counter for player status
		p\shots = p\shots + 1
		; create muzzle flash
		p\weapon\fireSoundChannel=PlaySound(p\weapon\fireSound)		
		
;Function HandleBullets
			For al.alien = Each alien
				If ImagesCollide(bulletgfx,b\x,b\y,1,		al\image,al\x-al\offset,al\y-al\offset,al\dir)
				;circlesoverlap(al\x,al\y,al\radius,bx+16,by+16,3)
					; knock alien back
					If Rand(1,10)=1
						al\x = al\x + (Sin((al\dir*45)+180))*3
						al\y = al\y - (Cos((al\dir*45)+180))*3
					EndIf
					
					killed = alien_hit(al,b\damage)
					If killed = True Then
						;Update counter for player status
						b\owner\kills = b\owner\ammo + 1

					End If
					ok=False ;bullet hit alien
					
					
				EndIf
			Next


;Aliens.bb ------------------------------------------------------------------------------------------

Function alien_hit(al.alien,damage#=1.0)
	
	al\health = al\health - damage
	al\mode="underattack"
	
	If Rand(0,2)=0 Then playoneshot(snd_alienhit(Rand(0,3)),al\x,al\y)
	
	
	
	;random alien blood splats
	d=Rand(0,359)
	f=Rand(0,3)
	createparticle(al\x,al\y,Sin(d)*2,Cos(d)*2,Rand(10,100),f,f,particles,16)
		
	If al\health<=0 Then 
		alien_die(al)
		;Return true so we know the alien died
		Return True
		
	End If
	
	Return False
	
End Function


Also add this stuff into engine.bb
Include "inc\intex-new.bb"

If KeyHit(23) Then IntexMenu(player(1)):time=MilliSecs()-period  ;Need to determine player activates


Hopefully that's everything - if not, get it in there and I will check to see if anything is missing.


Matthew Smith(Posted 2004) [#100]
Re-ordered the rendering to display particles in a different order - the aliens appeared above some things.

	; ********* RENDER WORLD		
	drawmap(ScreenX,ScreenY,1)
	drawmap(ScreenX,ScreenY,2)
	drawbullets()
	Alien_DrawAll()
	drawparticles()
	Player_DrawAll()
	drawAnimations()
	drawmap(ScreenX,ScreenY,3)
	drawmap(ScreenX,ScreenY,4)
	drawHUD()
	; end of render



Perturbatio(Posted 2004) [#101]
Have you changed the function CreateWeapon in any way? I'm getting a too many parameters error.

*EDIT*

have uploaded the images zip file to my server.


Rob Farley(Posted 2004) [#102]
I quite liked my intex systems, I thought it looks quite cool :( oh well... if you guys prefer this...

I've been trying to get some graphics together to make the players and aliens look nice. Also I was thinking about different player classes (like gauntlet) that can carry heavier weapons, move faster/slower, better armour etc etc.

Anyway...


Perturbatio(Posted 2004) [#103]
You could have an electronics expert that only carries a basic weapon and a limited amount of ammo, but can override doors, computers, etc.


Rob Farley(Posted 2004) [#104]
I'm going to have a go at flashying up the new intex systems, if I use the new background as an tint to what's underneith or something... hmmm...

Pert, yeah, that's the idea, but of course it would have to be balanced so even if you didn't have the electronics guy you could still get through the door through brute force.

Anyway, that's getting ahead of ourselves a little!


Perturbatio(Posted 2004) [#105]
I'm thinking that it would be good if the intex data was not hard coded, that way you can change it per level if you want, would allow for more game flexibility.


RiK(Posted 2004) [#106]
Just a quickie to say I've been watching this evolve since the project started and you guys are doing a great job. I've been getting loads of inspiration and some good ideas for my own stuff too.

Keep it up!


Rimmsy(Posted 2004) [#107]
I've updated the latest code but left the media. I've emailed Perty with the latest code.zip. To get it running add the images supplied by matt in the gfx dir.

If you're not getting any sound it's because I've added a "use_sound" global at the top.

Glad to have you back rob. We only slowed down a few days ago but now that you're back we're go, baby. We'll have to revise the todo list and possibly get it a little more specific so we can farm out things for each of us to do.


Perturbatio(Posted 2004) [#108]
new code has been uploaded.


Rob Farley(Posted 2004) [#109]
Rims/Pert.

Time for a new thread I think!

Screenshot, downloads, and todo list at the top!

I'll let you guys start the thread as you've got the info at the moment, I still need a couple of minutes to catch up on where we are!


Perturbatio(Posted 2004) [#110]
I'll create the thread now.


BlitzSupport(Posted 2004) [#111]
It's over here...

http://www.blitzbasic.com/Community/posts.php?topic=38864