Log In  
Follow
Rhys
[ :: Read More :: ]

Cart #16350 | 2015-11-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
89

Hey, long time no see!

I've had this sitting on my hard drive for quite some time, but I don't have the time to work on it right now due to university work... Wasn't doing any good just sitting there (and other people are posting 3d stuff not), so here it is in its current state.

Z to drive, arrows to turn. Unfortunately that's it! No AI, ghosts or even checkpoints/laps at this stage. I got stuck on some integer overflow bugs, which you can still experience a little too easily... It might be finished one day, who knows! Just not soon. :(

P#16351 2015-11-07 12:39 ( Edited 2015-12-05 14:00)

[ :: Read More :: ]

I noticed that 8venture ( https://www.lexaloffle.com/bbs/?tid=2247 ) uses an "unpack" function to define tables from strings, which frees up the code space for like, actual code, by making all tables take up only one token.

array = unpack("1,2,3,4,ideclarea,thumbwar")
table = unpack("x=1,y=2,z=-23.12,hello=there")

This is great, but it didn't support multidimensional arrays or tables! Considering half of We Missed You is literally a huge multidimensional table, a solution to this could greatly benefit more complicated projects, or just people who like doing everything in hilariously roundabout confusing ways. Now you can do things like thiss::

mission = unpack("x=1,y=3,type=0,ents={{x=56,y=76,props={sdir=0.5,scone=0.125,swing=0.12,rate=0.00869,t=0,rad=64},n=218,tfra=8,type=0,update=pvis},{x=104,y=42,props={sdir=0.25,scone=0.125,swing=0.25,rate=0.00869,t=0.5,rad=48},n=218,tfra=8,type=0,update=pvis}}")

Here's the modified function:

function unpack(s)
 local a={}
 local key,val,c,auto,ob
 local i=1
 local l=0
 s=s..","  auto=1
 while i<=#s do
  c=sub(s,i,i)
  if c=="{" then
   l=i
   ob=1
   while ob>0 do
    i+=1
    c=sub(s,i,i)
    if c=="}" then ob-=1 
    elseif c=="{" then ob+=1 end
   end
   val=unpack(sub(s,l+1,i-1))
   if not key then
    key=auto
    auto+=1
   end
   a[key]=val
   key=false
   i+=1 --skip comma
   l=i
  elseif c=="=" then
   key=sub(s,l+1,i-1)
   l=i
  elseif c=="," and l~=i-1 then
   val=sub(s,l+1,i-1)
   local valc=sub(val,#val,#val)
   if valc>="0" and valc<="9" then
    val=val*1
    -- cover for a bug in string conversion
    val=shl(shr(val,1),1)
   elseif val=="true" then
    val=true
   elseif val=="false" then
    val=false
   end
   l=i
   if not key then
    key=auto
    auto+=1
   end
   a[key]=val
   key=false
  end
  i+=1
 end
 return a
end

Downsides:

  • Can't use spaces or newlines. You can change it to accept spaces, but it'll cost you in tokens to implement.
  • Can't use calculations, variables or functions as values, duh.
  • Won't be of much use unless your game is table heavy! Using this with We Missed You as a test only shaved off ~200 tokens and there were a lot of tables. Adding more missions would only cost a cool 4 tokens now, though. ;)
  • Takes a while to unpack. Don't do this in realtime, it's an init step. :P

I'll post a version of We Missed You with this unpack function utilized once it's ready.

P#13740 2015-09-06 00:23 ( Edited 2015-09-06 08:10)

[ :: Read More :: ]

Cart #13021 | 2015-08-24 | Code ▽ | Embed ▽ | No License
104

(LD page: http://ludumdare.com/compo/ludum-dare-33/?action=preview&uid=7339)

It's your average day working in the postal service. What better time to go out on deliveries when everyone is at work?

With over 10 exciting deliveries and a few detours in a "HUUUGE" city, there's no telling what you'll experience while being basically the worst kind of monster humanity has to offer.

Make sure to drive as recklessly as possible, or the roads will become so safe that people will deliver their own packages!

If you manage to finish this "difficult" "challenge", post your score in the comments!

===== INSTRUCTIONS =====

YOU NEED TO BACK INTO THE CAR BETWEEN DELIVERIES TO GET ANOTHER SLIP!

Arrows: Move person/drive car
Z (PICO BUTTON 1): Start game
X (PICO BUTTON 2): Get in/out of car

Walk up to people's doorsteps to leave them a note. There are two types of vision you need to avoid:

  • Car Vision: People will come out of their house if they see your car within their vision cone. These are large, usually come from the house and appear dark red when your car is not in them.

  • Person Vision: Some people are waiting outside for you! Yikes! These people have BRIGHT RED vision cones all the time and will catch you if you are within them, car or not.

===== KNOWN BUGS =====

Completing a delivery and losing on the same frame skips the next delivery. Very rare and may crash the game.

P#13022 2015-08-23 21:48 ( Edited 2016-10-12 02:57)

[ :: Read More :: ]

Cart #10420 | 2015-05-02 | Code ▽ | Embed ▽ | No License
17

Controls
P1: Arrows to move, action buttons to change height
P2: Same with p2 controls, but need to press P2 Action to enable split screen.

About
Just a quick demo, I'm going to try implementing simple spherical collision to see if I can make a reasonable racing game using the space available. Right now the engine uses half of the available code space, but a lot of this is actually the mat4 and vec3 functions, so it should be reusable for game logic. Some unnecessary things are even in there, like text drawing and sprite drawing.

Specific places that need improving are the clipping function (hilariously long lines) and maybe some optimisation on the tri filler (use memset?)

I have an obj converter script, but it doesn't have a frontend and things are quite complex to get the data into the cart... so I'll make a tool for this separate.

Scene
The scene used was made in blender and has 196 triangles. That should give an indication of where the limits are, but visually it could look better as I'm wasting a ton of triangles in the small torus. And also all the colours are completely random.

P#10421 2015-05-02 12:19 ( Edited 2015-05-02 16:35)

Follow Lexaloffle:          
Generated 2024-03-28 23:30:26 | 0.071s | Q:15