Space-Game Development

Hey guys, so I had thought I was onto something, but I seem to have hit a wall. I’m trying to get this code to ~
~ segment the frigCheck to be able to work for all airlock doors.

Heres the code, after the location and its description,

[code] port = lAirlock
starboard = rAirlock
down = frigMH
;

  • lAirlock: AutoClosingDoor ’ port portside airlock door*doors’ ‘portside airlock door’
    ;
    frigCheck: RoomConnector
    room1 = frigCD
    room2 = frigLA
    canTravelerPass(traveler) {return spacesuit.isWornBy(traveler);}
    explainTravelBarrier(traveler)
    {
    "That way is too dangerous to travel without a spacesuit. ";
    }
    ;[/code]

So the way it is currently, if I don’t have the door, I can to Port = frigCheck and it does the job. What I wanted to do, was make frigCheck work for ALL doors, and simply have the doors run frigCheck. which detects whether or not their is a breach in the next room, if not then traveler passes, secondly ensure that the player has the spacesuit on if their IS a breach.

But after adding doors, nothing seems to work. Having RoomConnector seemed the obvious choice, as TravelBarrier didn’t seem to work for me. But I’m having trouble figuring out how to set up a function after creating a Thing that actually works lol. I’ve been at it, reading tutorials and looking up things in the Library Reference Manual and cant seem to find an answer to this. the things I find are slightly relevant, but not incorporatable.

Any assistance would be greatly appreciated, thanks guys

This is where I will post the problems I run into, as well as solutions to perhaps help provide people a link to perhaps read and discuss making a game with the main focus of ->Space.

Its certainly its own beast in its own right, differing than even a boat-game, due to the fact that not only does it more-so rely on Shipboard direction, but most of the time, cardinal directions are removed completely, each moon, planet, and sun typically having its own form of rotation, thus completely shaking up the typical cardinal direction system when it IS used.

I’ve decided to start with a stable structure, such as a decently sized frigate with the potential of containing 7 people comfortably. Symmetry helps curb the original confusion in my opinion. At least for the starting Space-ship.

RoomConnector is a class you need when you want a travel barrier between two rooms, which are connected without doors, that means when there is no physically described object connecting rooms. Let’s have two connected rooms:

[code]firstRoom: Room
north = secondRoom
;

secondRoom: Room
south = firstRoom
;
[/code]
Now you will add a travel barrier:

[code]firstRoom: Room
north = conn
;

secondRoom: Room
south = conn
;

conn: RoomConnector
room1 = firstRoom
room2 = secondRoom

canTravelerPass(traveler) { return spacesuit.isWornBy(traveler); }
explainTravelBarrier(traveler) { "That way is too dangerous to travel without a spacesuit. "; }

;
[/code]
When you want doors in your game then you will use two interlinked Door objects with each room pointing to its door object:

[code]firstRoom: Room
north = firstDoor
;

  • firstDoor: Door
    ;

secondRoom: Room
south = secondDoor
;

  • secondDoor: Door → firstDoor
    ;
    [/code]
    Now if you want travel barrier on doors, you won’t use RoomConnector, but rather you declare TravelBarrier for easy reusement and then link the barrier to each door:

[code]barr: TravelBarrier
canTravelerPass(traveler) { return spacesuit.isWornBy(traveler); }
explainTravelBarrier(traveler) { "That way is too dangerous to travel without a spacesuit. "; }
;

firstRoom: Room
north = firstDoor
;

  • firstDoor: Door
    travelBarrier = barr
    ;

secondRoom: Room
south = secondDoor
;

  • secondDoor: Door → firstDoor
    travelBarrier = barr
    ;
    [/code]

VERY much appreciated, thank you for simplifying it.

The next problem i face, is being able to have the door check in the room next door has a breach, and if so, properly tells the player he needs a helmet in order to enter.

frigCheck: TravelBarrier check() { if(lAb = true) // There is clearly a breach in the left airlock room, there is no oxygen { canTravelerPass(traveler) { return helmet.isWornBy(traveler); } explainTravelBarrier(traveler) { "That way is too dangerous to travel without a helmet on. "; } } else return ; } ; ;

So frigCheck is the Barr code, explained in the previous comment, I was able to get it working, now i want to try and get it to simply register that there is a breach in the next room, this if(lAb = true) then there is a breach, if false, then carry on and enter the next room as if there is no problem. Everybody making If/Else statements overcomplicate it, to the point where I just want a simple command, that checks and responds intelligently.
The tutorials love to slam 12 different things going on at once so I dont know what is the essential components, and what is just 'fancy' programming work.  :unamused:

I want to get the very core-components into this game and make a simplified framework-game to start off using and work with, to help ease my younger sibs into a group-project. The tutorials do good I guess and making functional games and such, but they can get really daunting if one is attempting to read and understand it, and incorporate what is taught in a game. I’ll hopefully just be fleshing out the simple stuff, which will make some tutorials and such much easier to understand.


I seem to have run into another problem, it seems that when I make a travelpushable, surface, I call the Dolly, when i try to push it through these doors, it seems that it says I must have a helmet. It seems that it registers as the Dolly being the ‘Traveler’ instead of me, and thus maybe I need to get it a helmet as well xD . I’m thinking I can fix this with gActor perhaps, instead of traveller. Hmm… :ugeek:

Sure you need to start with simple stuff, lots of basic functionality can be done with declarations only without much of coding. Tutorials are good, but they are only one side of coin. The other side is Learing T3 book with systematic explanation of the basic stuff intertwined with coding tutorials. And third side of coin(?!) is Library reference manual interlinked directly into library source code.

I don’t know for sure, but I would expect that travel barrier is enforced not instead of you, but for both pushed item and for the player maybe to allow pushing item to different room without allowing player to follow the item. But sure you can tweak the condition, perhaps something like: canTravelerPass(traveler) { return traveler != me || helmet.isWornBy(me); }